Merge pull request #69 from TheBlueMatt/main v0.0.106.0
authorMatt Corallo <649246+TheBlueMatt@users.noreply.github.com>
Mon, 4 Apr 2022 21:33:49 +0000 (21:33 +0000)
committerGitHub <noreply@github.com>
Mon, 4 Apr 2022 21:33:49 +0000 (21:33 +0000)
c-bindings-gen/src/main.rs
c-bindings-gen/src/types.rs
ldk-net/ldk_net.c
lightning-c-bindings/demo.cpp
lightning-c-bindings/include/lightning.h
lightning-c-bindings/include/lightningpp.hpp
lightning-c-bindings/src/c_types/derived.rs
lightning-c-bindings/src/c_types/mod.rs
lightning-c-bindings/src/lightning_invoice/mod.rs

index d62b2a315f5b366ec03c51fb44924a0abdf54120..7c7cad305f4d3ffb2da97a79cf94842d41bcff7d 100644 (file)
@@ -1245,13 +1245,22 @@ fn writeln_impl<W: std::io::Write>(w: &mut W, i: &syn::ItemImpl, types: &mut Typ
                                                writeln!(w, "\torig.clone()").unwrap();
                                                writeln!(w, "}}").unwrap();
                                        } else if path_matches_nongeneric(&trait_path.1, &["FromStr"]) {
-                                               if let Some(container) = types.get_c_mangled_container_type(
-                                                               vec![&*i.self_ty, &syn::Type::Tuple(syn::TypeTuple { paren_token: Default::default(), elems: syn::punctuated::Punctuated::new() })],
-                                                               Some(&gen_types), "Result") {
+                                               let mut err_opt = None;
+                                               for item in i.items.iter() {
+                                                       match item {
+                                                               syn::ImplItem::Type(ty) if format!("{}", ty.ident) == "Err" => {
+                                                                       err_opt = Some(&ty.ty);
+                                                               },
+                                                               _ => {}
+                                                       }
+                                               }
+                                               let err_ty = err_opt.unwrap();
+                                               if let Some(container) = types.get_c_mangled_container_type(vec![&*i.self_ty, &err_ty], Some(&gen_types), "Result") {
                                                        writeln!(w, "#[no_mangle]").unwrap();
                                                        writeln!(w, "/// Read a {} object from a string", ident).unwrap();
                                                        writeln!(w, "pub extern \"C\" fn {}_from_str(s: crate::c_types::Str) -> {} {{", ident, container).unwrap();
                                                        writeln!(w, "\tmatch {}::from_str(s.into_str()) {{", resolved_path).unwrap();
+
                                                        writeln!(w, "\t\tOk(r) => {{").unwrap();
                                                        let new_var = types.write_to_c_conversion_new_var(w, &format_ident!("r"), &*i.self_ty, Some(&gen_types), false);
                                                        write!(w, "\t\t\tcrate::c_types::CResultTempl::ok(\n\t\t\t\t").unwrap();
@@ -1259,7 +1268,15 @@ fn writeln_impl<W: std::io::Write>(w: &mut W, i: &syn::ItemImpl, types: &mut Typ
                                                        write!(w, "{}r", if new_var { "local_" } else { "" }).unwrap();
                                                        types.write_to_c_conversion_inline_suffix(w, &*i.self_ty, Some(&gen_types), false);
                                                        writeln!(w, "\n\t\t\t)\n\t\t}},").unwrap();
-                                                       writeln!(w, "\t\tErr(e) => crate::c_types::CResultTempl::err(()),").unwrap();
+
+                                                       writeln!(w, "\t\tErr(e) => {{").unwrap();
+                                                       let new_var = types.write_to_c_conversion_new_var(w, &format_ident!("e"), &err_ty, Some(&gen_types), false);
+                                                       write!(w, "\t\t\tcrate::c_types::CResultTempl::err(\n\t\t\t\t").unwrap();
+                                                       types.write_to_c_conversion_inline_prefix(w, &err_ty, Some(&gen_types), false);
+                                                       write!(w, "{}e", if new_var { "local_" } else { "" }).unwrap();
+                                                       types.write_to_c_conversion_inline_suffix(w, &err_ty, Some(&gen_types), false);
+                                                       writeln!(w, "\n\t\t\t)\n\t\t}},").unwrap();
+
                                                        writeln!(w, "\t}}.into()\n}}").unwrap();
                                                }
                                        } else if path_matches_nongeneric(&trait_path.1, &["Display"]) {
index ced1f34b0e91c31493127c14bf8c9e7db31748ac..da2d1807db088e6336b7a9186a0d9df85d0e338c 100644 (file)
@@ -883,6 +883,14 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
 
                        "core::convert::Infallible" => Some("crate::c_types::NotConstructable"),
 
+                       "bitcoin::bech32::Error"|"bech32::Error"
+                               if !is_ref => Some("crate::c_types::Bech32Error"),
+                       "bitcoin::secp256k1::Error"|"secp256k1::Error"
+                               if !is_ref => Some("crate::c_types::Secp256k1Error"),
+
+                       "core::num::ParseIntError" => Some("crate::c_types::Error"),
+                       "core::str::Utf8Error" => Some("crate::c_types::Error"),
+
                        "bitcoin::bech32::u5"|"bech32::u5" => Some("crate::c_types::u5"),
                        "core::num::NonZeroU8" => Some("u8"),
 
@@ -894,8 +902,6 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                                if is_ref  => Some("*const [u8; 32]"),
                        "bitcoin::secp256k1::key::SecretKey"|"bitcoin::secp256k1::SecretKey"
                                if !is_ref => Some("crate::c_types::SecretKey"),
-                       "bitcoin::secp256k1::Error"|"secp256k1::Error"
-                               if !is_ref => Some("crate::c_types::Secp256k1Error"),
                        "bitcoin::blockdata::script::Script" if is_ref => Some("crate::c_types::u8slice"),
                        "bitcoin::blockdata::script::Script" if !is_ref => Some("crate::c_types::derived::CVec_u8Z"),
                        "bitcoin::blockdata::transaction::OutPoint" => Some("crate::lightning::chain::transaction::OutPoint"),
@@ -961,6 +967,12 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
 
                        "core::convert::Infallible" => Some("panic!(\"You must never construct a NotConstructable! : "),
 
+                       "bitcoin::bech32::Error"|"bech32::Error" if !is_ref => Some(""),
+                       "bitcoin::secp256k1::Error"|"secp256k1::Error" if !is_ref => Some(""),
+
+                       "core::num::ParseIntError" => Some("u8::from_str_radix(\" a\", 10).unwrap_err() /*"),
+                       "core::str::Utf8Error" => Some("core::str::from_utf8(&[0xff]).unwrap_err() /*"),
+
                        "std::time::Duration"|"core::time::Duration" => Some("core::time::Duration::from_secs("),
                        "std::time::SystemTime" => Some("(::std::time::SystemTime::UNIX_EPOCH + std::time::Duration::from_secs("),
 
@@ -1043,6 +1055,12 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
 
                        "core::convert::Infallible" => Some("\")"),
 
+                       "bitcoin::bech32::Error"|"bech32::Error" if !is_ref => Some(".into_rust()"),
+                       "bitcoin::secp256k1::Error"|"secp256k1::Error" if !is_ref => Some(".into_rust()"),
+
+                       "core::num::ParseIntError" => Some("*/"),
+                       "core::str::Utf8Error" => Some("*/"),
+
                        "std::time::Duration"|"core::time::Duration" => Some(")"),
                        "std::time::SystemTime" => Some("))"),
 
@@ -1133,6 +1151,14 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
 
                        "core::convert::Infallible" => Some("panic!(\"Cannot construct an Infallible: "),
 
+                       "bitcoin::bech32::Error"|"bech32::Error"
+                               if !is_ref => Some("crate::c_types::Bech32Error::from_rust("),
+                       "bitcoin::secp256k1::Error"|"secp256k1::Error"
+                               if !is_ref => Some("crate::c_types::Secp256k1Error::from_rust("),
+
+                       "core::num::ParseIntError" => Some("crate::c_types::Error { _dummy: 0 } /*"),
+                       "core::str::Utf8Error" => Some("crate::c_types::Error { _dummy: 0 } /*"),
+
                        "bitcoin::bech32::u5"|"bech32::u5" => Some(""),
 
                        "bitcoin::secp256k1::key::PublicKey"|"bitcoin::secp256k1::PublicKey"|"secp256k1::key::PublicKey"
@@ -1143,8 +1169,6 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                                if is_ref => Some(""),
                        "bitcoin::secp256k1::key::SecretKey"|"bitcoin::secp256k1::SecretKey"
                                if !is_ref => Some("crate::c_types::SecretKey::from_rust("),
-                       "bitcoin::secp256k1::Error"|"secp256k1::Error"
-                               if !is_ref => Some("crate::c_types::Secp256k1Error::from_rust("),
                        "bitcoin::blockdata::script::Script" if is_ref => Some("crate::c_types::u8slice::from_slice(&"),
                        "bitcoin::blockdata::script::Script" if !is_ref => Some(""),
                        "bitcoin::blockdata::transaction::Transaction"|"bitcoin::Transaction" if is_ref => Some("crate::c_types::Transaction::from_bitcoin("),
@@ -1206,6 +1230,14 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
 
                        "core::convert::Infallible" => Some("\")"),
 
+                       "bitcoin::secp256k1::Error"|"bech32::Error"
+                               if !is_ref => Some(")"),
+                       "bitcoin::secp256k1::Error"|"secp256k1::Error"
+                               if !is_ref => Some(")"),
+
+                       "core::num::ParseIntError" => Some("*/"),
+                       "core::str::Utf8Error" => Some("*/"),
+
                        "bitcoin::bech32::u5"|"bech32::u5" => Some(".into()"),
 
                        "bitcoin::secp256k1::key::PublicKey"|"bitcoin::secp256k1::PublicKey"|"secp256k1::key::PublicKey"
@@ -1216,8 +1248,6 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                                if !is_ref => Some(")"),
                        "bitcoin::secp256k1::key::SecretKey"|"bitcoin::secp256k1::SecretKey"
                                if is_ref => Some(".as_ref()"),
-                       "bitcoin::secp256k1::Error"|"secp256k1::Error"
-                               if !is_ref => Some(")"),
                        "bitcoin::blockdata::script::Script" if is_ref => Some("[..])"),
                        "bitcoin::blockdata::script::Script" if !is_ref => Some(".into_bytes().into()"),
                        "bitcoin::blockdata::transaction::Transaction"|"bitcoin::Transaction" => Some(")"),
index 8bae7af192c1c08b0f41f1bbf1310718fb635c5b..97521368fc7c94f20a14942a9f40d8fb0e1b6def 100644 (file)
@@ -168,6 +168,31 @@ static inline LDKSocketDescriptor get_descriptor(struct SocketHandler *handler,
        return ret;
 }
 
+static LDKCOption_NetAddressZ get_remote_network_address(int fd) {
+       struct sockaddr_storage sockaddr;
+       socklen_t remote_addr_len = sizeof(sockaddr);
+       if (getpeername(fd, (struct sockaddr*)&sockaddr, &remote_addr_len) == -1) {
+               return COption_NetAddressZ_none();
+       }
+
+       switch (sockaddr.ss_family) {
+       case AF_INET: {
+               const struct sockaddr_in *remote_addr = (struct sockaddr_in*)&sockaddr;
+               LDKFourBytes addr;
+               memcpy(&addr, &remote_addr->sin_addr.s_addr, 4);
+               return COption_NetAddressZ_some(NetAddress_ipv4(addr, ntohs(remote_addr->sin_port)));
+       }
+       case AF_INET6: {
+               const struct sockaddr_in6 *remote_addr = (struct sockaddr_in6*)&sockaddr;
+               LDKSixteenBytes addr;
+               memcpy(&addr, &remote_addr->sin6_addr.s6_addr, 16);
+               return COption_NetAddressZ_some(NetAddress_ipv6(addr, ntohs(remote_addr->sin6_port)));
+       }
+       default:
+               return COption_NetAddressZ_none();
+       }
+}
+
 static void *sock_thread_fn(void* arg) {
        struct SocketHandler *handler = (struct SocketHandler*) arg;
 
@@ -214,10 +239,7 @@ static void *sock_thread_fn(void* arg) {
                                                                if (newfd >= 0) {
                                                                        // Received a new connection, register it!
                                                                        LDKSocketDescriptor new_descriptor = get_descriptor(handler, newfd);
-                                                                       LDKCOption_NetAddressZ remote_network_address = {
-                                                                               .tag = LDKCOption_NetAddressZ_None,
-                                                                       };
-                                                                       LDKCResult_NonePeerHandleErrorZ con_res = PeerManager_new_inbound_connection(&handler->ldk_peer_manager, new_descriptor, remote_network_address);
+                                                                       LDKCResult_NonePeerHandleErrorZ con_res = PeerManager_new_inbound_connection(&handler->ldk_peer_manager, new_descriptor, get_remote_network_address(newfd));
                                                                        if (con_res.result_ok) {
                                                                                if (register_socket(handler, newfd, 0))
                                                                                        shutdown(newfd, SHUT_RDWR);
@@ -381,10 +403,7 @@ int socket_connect(void* arg, LDKPublicKey pubkey, struct sockaddr *addr, size_t
        if (register_socket(handler, fd, 0)) return -4;
 
        LDKSocketDescriptor descriptor = get_descriptor(handler, fd);
-       LDKCOption_NetAddressZ remote_network_address = {
-               .tag = LDKCOption_NetAddressZ_None,
-       };
-       LDKCResult_CVec_u8ZPeerHandleErrorZ con_res = PeerManager_new_outbound_connection(&handler->ldk_peer_manager, pubkey, descriptor, remote_network_address);
+       LDKCResult_CVec_u8ZPeerHandleErrorZ con_res = PeerManager_new_outbound_connection(&handler->ldk_peer_manager, pubkey, descriptor, get_remote_network_address(fd));
        if (con_res.result_ok) {
                ssize_t write_count = send(fd, con_res.contents.result->data, con_res.contents.result->datalen, MSG_NOSIGNAL);
                if (write_count != con_res.contents.result->datalen)
index ec7a0d104e2a2dcb6ac5fd2ca70a40fc12d4f81a..fa75140a59e9be8c53bc48034513e6f63977e10b 100644 (file)
@@ -331,12 +331,9 @@ public:
                t2 = std::thread(&sock_read_data_thread, pipefds_1_to_2[0], &sock2, &net2);
 
                // Note that we have to bind the result to a C++ class to make sure it gets free'd
-               LDKCOption_NetAddressZ remote_network_address = {
-                       .tag = LDKCOption_NetAddressZ_None,
-               };
-               LDK::CResult_CVec_u8ZPeerHandleErrorZ con_res = PeerManager_new_outbound_connection(&net1, ChannelManager_get_our_node_id(&cm2), sock1, remote_network_address);
+               LDK::CResult_CVec_u8ZPeerHandleErrorZ con_res = PeerManager_new_outbound_connection(&net1, ChannelManager_get_our_node_id(&cm2), sock1, COption_NetAddressZ_none());
                assert(con_res->result_ok);
-               LDK::CResult_NonePeerHandleErrorZ con_res2 = PeerManager_new_inbound_connection(&net2, sock2, remote_network_address);
+               LDK::CResult_NonePeerHandleErrorZ con_res2 = PeerManager_new_inbound_connection(&net2, sock2, COption_NetAddressZ_none());
                assert(con_res2->result_ok);
 
                auto writelen = write(pipefds_1_to_2[1], con_res->contents.result->data, con_res->contents.result->datalen);
index ac086be8eb562b667066621c342136cae53ae403..ee15c0f2ee797b439aa36d3a5a7771285dcaafb3 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef LDK_C_BINDINGS_H
 #define LDK_C_BINDINGS_H
 
-/* Generated with cbindgen:0.17.0 */
+/* Generated with cbindgen:0.20.0 */
 
 /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
 
@@ -7132,36 +7132,151 @@ typedef struct LDKCResult_PaymentIdPaymentErrorZ {
 } LDKCResult_PaymentIdPaymentErrorZ;
 
 /**
- * The contents of CResult_SiPrefixNoneZ
+ * Represents an error returned from the bech32 library during validation of some bech32 data
  */
-typedef union LDKCResult_SiPrefixNoneZPtr {
+typedef enum LDKBech32Error_Tag {
+   /**
+    * String does not contain the separator character
+    */
+   LDKBech32Error_MissingSeparator,
+   /**
+    * The checksum does not match the rest of the data
+    */
+   LDKBech32Error_InvalidChecksum,
+   /**
+    * The data or human-readable part is too long or too short
+    */
+   LDKBech32Error_InvalidLength,
+   /**
+    * Some part of the string contains an invalid character
+    */
+   LDKBech32Error_InvalidChar,
+   /**
+    * Some part of the data has an invalid value
+    */
+   LDKBech32Error_InvalidData,
+   /**
+    * The bit conversion failed due to a padding issue
+    */
+   LDKBech32Error_InvalidPadding,
+   /**
+    * The whole string must be of one case
+    */
+   LDKBech32Error_MixedCase,
+   /**
+    * Must be last for serialization purposes
+    */
+   LDKBech32Error_Sentinel,
+} LDKBech32Error_Tag;
+
+typedef struct LDKBech32Error {
+   LDKBech32Error_Tag tag;
+   union {
+      struct {
+         uint32_t invalid_char;
+      };
+      struct {
+         uint8_t invalid_data;
+      };
+   };
+} LDKBech32Error;
+
+/**
+ * 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;
+
+/**
+ * Errors that indicate what is wrong with the invoice. They have some granularity for debug
+ * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user.
+ */
+typedef enum LDKParseError_Tag {
+   LDKParseError_Bech32Error,
+   LDKParseError_ParseAmountError,
+   LDKParseError_MalformedSignature,
+   LDKParseError_BadPrefix,
+   LDKParseError_UnknownCurrency,
+   LDKParseError_UnknownSiPrefix,
+   LDKParseError_MalformedHRP,
+   LDKParseError_TooShortDataPart,
+   LDKParseError_UnexpectedEndOfTaggedFields,
+   LDKParseError_DescriptionDecodeError,
+   LDKParseError_PaddingError,
+   LDKParseError_IntegerOverflowError,
+   LDKParseError_InvalidSegWitProgramLength,
+   LDKParseError_InvalidPubKeyHashLength,
+   LDKParseError_InvalidScriptHashLength,
+   LDKParseError_InvalidRecoveryId,
+   LDKParseError_InvalidSliceLength,
+   /**
+    * Not an error, but used internally to signal that a part of the invoice should be ignored
+    * according to BOLT11
+    */
+   LDKParseError_Skip,
+   /**
+    * Must be last for serialization purposes
+    */
+   LDKParseError_Sentinel,
+} LDKParseError_Tag;
+
+typedef struct MUST_USE_STRUCT LDKParseError {
+   LDKParseError_Tag tag;
+   union {
+      struct {
+         struct LDKBech32Error bech32_error;
+      };
+      struct {
+         struct LDKError parse_amount_error;
+      };
+      struct {
+         enum LDKSecp256k1Error malformed_signature;
+      };
+      struct {
+         struct LDKError description_decode_error;
+      };
+      struct {
+         struct LDKStr invalid_slice_length;
+      };
+   };
+} LDKParseError;
+
+/**
+ * The contents of CResult_SiPrefixParseErrorZ
+ */
+typedef union LDKCResult_SiPrefixParseErrorZPtr {
    /**
     * A pointer to the contents in the success state.
     * Reading from this pointer when `result_ok` is not set is undefined.
     */
    enum LDKSiPrefix *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_SiPrefixNoneZPtr;
+   struct LDKParseError *err;
+} LDKCResult_SiPrefixParseErrorZPtr;
 
 /**
- * A CResult_SiPrefixNoneZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
+ * A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
  */
-typedef struct LDKCResult_SiPrefixNoneZ {
+typedef struct LDKCResult_SiPrefixParseErrorZ {
    /**
-    * The contents of this CResult_SiPrefixNoneZ, accessible via either
+    * The contents of this CResult_SiPrefixParseErrorZ, accessible via either
     * `err` or `result` depending on the state of `result_ok`.
     */
-   union LDKCResult_SiPrefixNoneZPtr contents;
+   union LDKCResult_SiPrefixParseErrorZPtr contents;
    /**
-    * Whether this CResult_SiPrefixNoneZ represents a success state.
+    * Whether this CResult_SiPrefixParseErrorZ represents a success state.
     */
    bool result_ok;
-} LDKCResult_SiPrefixNoneZ;
+} LDKCResult_SiPrefixParseErrorZ;
 
 
 
@@ -7189,36 +7304,69 @@ typedef struct MUST_USE_STRUCT LDKInvoice {
 } LDKInvoice;
 
 /**
- * The contents of CResult_InvoiceNoneZ
+ * 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
+ * like wrong signatures, missing fields etc. could mean that someone tampered with the invoice.
+ */
+typedef enum LDKParseOrSemanticError_Tag {
+   /**
+    * The invoice couldn't be decoded
+    */
+   LDKParseOrSemanticError_ParseError,
+   /**
+    * The invoice could be decoded but violates the BOLT11 standard
+    */
+   LDKParseOrSemanticError_SemanticError,
+   /**
+    * Must be last for serialization purposes
+    */
+   LDKParseOrSemanticError_Sentinel,
+} LDKParseOrSemanticError_Tag;
+
+typedef struct MUST_USE_STRUCT LDKParseOrSemanticError {
+   LDKParseOrSemanticError_Tag tag;
+   union {
+      struct {
+         struct LDKParseError parse_error;
+      };
+      struct {
+         enum LDKSemanticError semantic_error;
+      };
+   };
+} LDKParseOrSemanticError;
+
+/**
+ * The contents of CResult_InvoiceParseOrSemanticErrorZ
  */
-typedef union LDKCResult_InvoiceNoneZPtr {
+typedef union LDKCResult_InvoiceParseOrSemanticErrorZPtr {
    /**
     * A pointer to the contents in the success state.
     * Reading from this pointer when `result_ok` is not set is undefined.
     */
    struct LDKInvoice *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_InvoiceNoneZPtr;
+   struct LDKParseOrSemanticError *err;
+} LDKCResult_InvoiceParseOrSemanticErrorZPtr;
 
 /**
- * A CResult_InvoiceNoneZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::Invoice on success and a () on failure.
+ * A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
  */
-typedef struct LDKCResult_InvoiceNoneZ {
+typedef struct LDKCResult_InvoiceParseOrSemanticErrorZ {
    /**
-    * The contents of this CResult_InvoiceNoneZ, accessible via either
+    * The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
     * `err` or `result` depending on the state of `result_ok`.
     */
-   union LDKCResult_InvoiceNoneZPtr contents;
+   union LDKCResult_InvoiceParseOrSemanticErrorZPtr contents;
    /**
-    * Whether this CResult_InvoiceNoneZ represents a success state.
+    * Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
     */
    bool result_ok;
-} LDKCResult_InvoiceNoneZ;
+} LDKCResult_InvoiceParseOrSemanticErrorZ;
 
 
 
@@ -7245,36 +7393,37 @@ typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
 } LDKSignedRawInvoice;
 
 /**
- * The contents of CResult_SignedRawInvoiceNoneZ
+ * The contents of CResult_SignedRawInvoiceParseErrorZ
  */
-typedef union LDKCResult_SignedRawInvoiceNoneZPtr {
+typedef union LDKCResult_SignedRawInvoiceParseErrorZPtr {
    /**
     * A pointer to the contents in the success state.
     * Reading from this pointer when `result_ok` is not set is undefined.
     */
    struct LDKSignedRawInvoice *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_SignedRawInvoiceNoneZPtr;
+   struct LDKParseError *err;
+} LDKCResult_SignedRawInvoiceParseErrorZPtr;
 
 /**
- * A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
- * containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
+ * A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
  */
-typedef struct LDKCResult_SignedRawInvoiceNoneZ {
+typedef struct LDKCResult_SignedRawInvoiceParseErrorZ {
    /**
-    * The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
+    * The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
     * `err` or `result` depending on the state of `result_ok`.
     */
-   union LDKCResult_SignedRawInvoiceNoneZPtr contents;
+   union LDKCResult_SignedRawInvoiceParseErrorZPtr contents;
    /**
-    * Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
+    * Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
     */
    bool result_ok;
-} LDKCResult_SignedRawInvoiceNoneZ;
+} LDKCResult_SignedRawInvoiceParseErrorZ;
 
 
 
@@ -14514,82 +14663,82 @@ void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentError
 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
 
 /**
- * Creates a new CResult_SiPrefixNoneZ in the success state.
+ * Creates a new CResult_SiPrefixParseErrorZ in the success state.
  */
-struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o);
+struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_ok(enum LDKSiPrefix o);
 
 /**
- * Creates a new CResult_SiPrefixNoneZ in the error state.
+ * Creates a new CResult_SiPrefixParseErrorZ in the error state.
  */
-struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void);
+struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e);
 
 /**
  * Checks if the given object is currently in the success state
  */
-bool CResult_SiPrefixNoneZ_is_ok(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR o);
+bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o);
 
 /**
- * Frees any resources used by the CResult_SiPrefixNoneZ.
+ * Frees any resources used by the CResult_SiPrefixParseErrorZ.
  */
-void CResult_SiPrefixNoneZ_free(struct LDKCResult_SiPrefixNoneZ _res);
+void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res);
 
 /**
- * Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
+ * Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
  * but with all dynamically-allocated buffers duplicated in new buffers.
  */
-struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_clone(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR orig);
+struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_clone(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR orig);
 
 /**
- * Creates a new CResult_InvoiceNoneZ in the success state.
+ * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
  */
-struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o);
+struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o);
 
 /**
- * Creates a new CResult_InvoiceNoneZ in the error state.
+ * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
  */
-struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void);
+struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e);
 
 /**
  * Checks if the given object is currently in the success state
  */
-bool CResult_InvoiceNoneZ_is_ok(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR o);
+bool CResult_InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR o);
 
 /**
- * Frees any resources used by the CResult_InvoiceNoneZ.
+ * Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
  */
-void CResult_InvoiceNoneZ_free(struct LDKCResult_InvoiceNoneZ _res);
+void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res);
 
 /**
- * Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
+ * Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
  * but with all dynamically-allocated buffers duplicated in new buffers.
  */
-struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_clone(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR orig);
+struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig);
 
 /**
- * Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
+ * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
  */
-struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct LDKSignedRawInvoice o);
+struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o);
 
 /**
- * Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
+ * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
  */
-struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void);
+struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e);
 
 /**
  * Checks if the given object is currently in the success state
  */
-bool CResult_SignedRawInvoiceNoneZ_is_ok(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR o);
+bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o);
 
 /**
- * Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
+ * Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
  */
-void CResult_SignedRawInvoiceNoneZ_free(struct LDKCResult_SignedRawInvoiceNoneZ _res);
+void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res);
 
 /**
- * Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
+ * Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
  * but with all dynamically-allocated buffers duplicated in new buffers.
  */
-struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_clone(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR orig);
+struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig);
 
 /**
  * Creates a new tuple which has the same data as `orig`
@@ -25858,6 +26007,126 @@ MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBac
  */
 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
 
+/**
+ * Frees any resources used by the ParseError
+ */
+void ParseError_free(struct LDKParseError this_ptr);
+
+/**
+ * Creates a copy of the ParseError
+ */
+struct LDKParseError ParseError_clone(const struct LDKParseError *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new Bech32Error-variant ParseError
+ */
+struct LDKParseError ParseError_bech32_error(struct LDKBech32Error a);
+
+/**
+ * Utility method to constructs a new ParseAmountError-variant ParseError
+ */
+struct LDKParseError ParseError_parse_amount_error(struct LDKError a);
+
+/**
+ * Utility method to constructs a new MalformedSignature-variant ParseError
+ */
+struct LDKParseError ParseError_malformed_signature(enum LDKSecp256k1Error a);
+
+/**
+ * Utility method to constructs a new BadPrefix-variant ParseError
+ */
+struct LDKParseError ParseError_bad_prefix(void);
+
+/**
+ * Utility method to constructs a new UnknownCurrency-variant ParseError
+ */
+struct LDKParseError ParseError_unknown_currency(void);
+
+/**
+ * Utility method to constructs a new UnknownSiPrefix-variant ParseError
+ */
+struct LDKParseError ParseError_unknown_si_prefix(void);
+
+/**
+ * Utility method to constructs a new MalformedHRP-variant ParseError
+ */
+struct LDKParseError ParseError_malformed_hrp(void);
+
+/**
+ * Utility method to constructs a new TooShortDataPart-variant ParseError
+ */
+struct LDKParseError ParseError_too_short_data_part(void);
+
+/**
+ * Utility method to constructs a new UnexpectedEndOfTaggedFields-variant ParseError
+ */
+struct LDKParseError ParseError_unexpected_end_of_tagged_fields(void);
+
+/**
+ * Utility method to constructs a new DescriptionDecodeError-variant ParseError
+ */
+struct LDKParseError ParseError_description_decode_error(struct LDKError a);
+
+/**
+ * Utility method to constructs a new PaddingError-variant ParseError
+ */
+struct LDKParseError ParseError_padding_error(void);
+
+/**
+ * Utility method to constructs a new IntegerOverflowError-variant ParseError
+ */
+struct LDKParseError ParseError_integer_overflow_error(void);
+
+/**
+ * Utility method to constructs a new InvalidSegWitProgramLength-variant ParseError
+ */
+struct LDKParseError ParseError_invalid_seg_wit_program_length(void);
+
+/**
+ * Utility method to constructs a new InvalidPubKeyHashLength-variant ParseError
+ */
+struct LDKParseError ParseError_invalid_pub_key_hash_length(void);
+
+/**
+ * Utility method to constructs a new InvalidScriptHashLength-variant ParseError
+ */
+struct LDKParseError ParseError_invalid_script_hash_length(void);
+
+/**
+ * Utility method to constructs a new InvalidRecoveryId-variant ParseError
+ */
+struct LDKParseError ParseError_invalid_recovery_id(void);
+
+/**
+ * Utility method to constructs a new InvalidSliceLength-variant ParseError
+ */
+struct LDKParseError ParseError_invalid_slice_length(struct LDKStr a);
+
+/**
+ * Utility method to constructs a new Skip-variant ParseError
+ */
+struct LDKParseError ParseError_skip(void);
+
+/**
+ * Frees any resources used by the ParseOrSemanticError
+ */
+void ParseOrSemanticError_free(struct LDKParseOrSemanticError this_ptr);
+
+/**
+ * Creates a copy of the ParseOrSemanticError
+ */
+struct LDKParseOrSemanticError ParseOrSemanticError_clone(const struct LDKParseOrSemanticError *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new ParseError-variant ParseOrSemanticError
+ */
+struct LDKParseOrSemanticError ParseOrSemanticError_parse_error(struct LDKParseError a);
+
+/**
+ * Utility method to constructs a new SemanticError-variant ParseOrSemanticError
+ */
+struct LDKParseOrSemanticError ParseOrSemanticError_semantic_error(enum LDKSemanticError a);
+
 /**
  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
  */
@@ -26909,17 +27178,27 @@ struct LDKPayer ChannelManager_as_Payer(const struct LDKChannelManager *NONNULL_
 /**
  * Read a SiPrefix object from a string
  */
-struct LDKCResult_SiPrefixNoneZ SiPrefix_from_str(struct LDKStr s);
+struct LDKCResult_SiPrefixParseErrorZ SiPrefix_from_str(struct LDKStr s);
 
 /**
  * Read a Invoice object from a string
  */
-struct LDKCResult_InvoiceNoneZ Invoice_from_str(struct LDKStr s);
+struct LDKCResult_InvoiceParseOrSemanticErrorZ Invoice_from_str(struct LDKStr s);
 
 /**
  * Read a SignedRawInvoice object from a string
  */
-struct LDKCResult_SignedRawInvoiceNoneZ SignedRawInvoice_from_str(struct LDKStr s);
+struct LDKCResult_SignedRawInvoiceParseErrorZ SignedRawInvoice_from_str(struct LDKStr s);
+
+/**
+ * Get the string representation of a ParseError object
+ */
+struct LDKStr ParseError_to_str(const struct LDKParseError *NONNULL_PTR o);
+
+/**
+ * Get the string representation of a ParseOrSemanticError object
+ */
+struct LDKStr ParseOrSemanticError_to_str(const struct LDKParseOrSemanticError *NONNULL_PTR o);
 
 /**
  * Get the string representation of a Invoice object
index 9f863756198c970c093017a4a94552bca50d740e..edd1018da5b7b8c4e73dfc97800ef12e2df4bc92 100644 (file)
@@ -89,6 +89,8 @@ class Payer;
 class Router;
 class RetryAttempts;
 class PaymentError;
+class ParseError;
+class ParseOrSemanticError;
 class Invoice;
 class SignedRawInvoice;
 class RawInvoice;
@@ -217,20 +219,19 @@ class CResult_ReplyChannelRangeDecodeErrorZ;
 class CResult_CommitmentTransactionDecodeErrorZ;
 class COption_C2Tuple_usizeTransactionZZ;
 class CResult_TransactionNoneZ;
-class CResult_SignedRawInvoiceNoneZ;
 class CResult_ClosingSignedFeeRangeDecodeErrorZ;
 class CResult_PingDecodeErrorZ;
 class CResult_GossipTimestampFilterDecodeErrorZ;
 class CResult_InvoiceSignOrCreationErrorZ;
+class COption_FilterZ;
 class CVec_TransactionOutputsZ;
 class CResult_ErrorMessageDecodeErrorZ;
 class CResult_OpenChannelDecodeErrorZ;
 class CVec_CVec_u8ZZ;
-class COption_FilterZ;
 class CResult_ProbabilisticScorerDecodeErrorZ;
 class CResult_SecretKeyErrorZ;
 class CResult_ShutdownScriptDecodeErrorZ;
-class CResult_InvoiceNoneZ;
+class CResult_QueryChannelRangeDecodeErrorZ;
 class CResult_TxCreationKeysDecodeErrorZ;
 class C2Tuple_usizeTransactionZ;
 class CResult_ChannelFeaturesDecodeErrorZ;
@@ -239,7 +240,6 @@ class CVec_TransactionZ;
 class CResult_UpdateFeeDecodeErrorZ;
 class CResult_RouteHopDecodeErrorZ;
 class CResult_NodeAnnouncementDecodeErrorZ;
-class CResult_QueryChannelRangeDecodeErrorZ;
 class CVec_BalanceZ;
 class CResult_HTLCOutputInCommitmentDecodeErrorZ;
 class CResult_boolLightningErrorZ;
@@ -309,6 +309,7 @@ class CResult_PongDecodeErrorZ;
 class CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
 class COption_EventZ;
 class CResult_ChannelTypeFeaturesDecodeErrorZ;
+class CResult_SiPrefixParseErrorZ;
 class CVec_RouteHintZ;
 class COption_u16Z;
 class CVec_CVec_RouteHopZZ;
@@ -341,6 +342,7 @@ class COption_TypeZ;
 class CResult_COption_TypeZDecodeErrorZ;
 class C2Tuple_u32TxOutZ;
 class CResult_UpdateFailHTLCDecodeErrorZ;
+class CResult_InvoiceParseOrSemanticErrorZ;
 class CResult_PaymentSecretNoneZ;
 class CResult_ChannelConfigDecodeErrorZ;
 class CVec_PrivateRouteZ;
@@ -355,7 +357,6 @@ class CVec_PaymentPreimageZ;
 class CVec_C2Tuple_u32ScriptZZ;
 class CResult_NoneChannelMonitorUpdateErrZ;
 class CResult_COption_ClosureReasonZDecodeErrorZ;
-class CResult_SiPrefixNoneZ;
 class CResult_PublicKeyErrorZ;
 class C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
 class CResult_NoneNoneZ;
@@ -373,8 +374,8 @@ class CVec_u5Z;
 class CResult_InMemorySignerDecodeErrorZ;
 class CResult_PaymentSecretAPIErrorZ;
 class CResult_CounterpartyForwardingInfoDecodeErrorZ;
+class CResult_SignedRawInvoiceParseErrorZ;
 class C2Tuple_u32ScriptZ;
-class CResult_ReplyShortChannelIdsEndDecodeErrorZ;
 class CResult_RouteDecodeErrorZ;
 class CResult_BuiltCommitmentTransactionDecodeErrorZ;
 class COption_NoneZ;
@@ -383,6 +384,7 @@ class CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
 class CResult_ChannelUpdateInfoDecodeErrorZ;
 class CVec_UpdateFailHTLCZ;
 class CResult_FundingLockedDecodeErrorZ;
+class CResult_ReplyShortChannelIdsEndDecodeErrorZ;
 
 class Str {
 private:
@@ -2164,6 +2166,36 @@ public:
        const LDKPaymentError* operator &() const { return &self; }
        const LDKPaymentError* operator ->() const { return &self; }
 };
+class ParseError {
+private:
+       LDKParseError self;
+public:
+       ParseError(const ParseError&) = delete;
+       ParseError(ParseError&& o) : self(o.self) { memset(&o, 0, sizeof(ParseError)); }
+       ParseError(LDKParseError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKParseError)); }
+       operator LDKParseError() && { LDKParseError res = self; memset(&self, 0, sizeof(LDKParseError)); return res; }
+       ~ParseError() { ParseError_free(self); }
+       ParseError& operator=(ParseError&& o) { ParseError_free(self); self = o.self; memset(&o, 0, sizeof(ParseError)); return *this; }
+       LDKParseError* operator &() { return &self; }
+       LDKParseError* operator ->() { return &self; }
+       const LDKParseError* operator &() const { return &self; }
+       const LDKParseError* operator ->() const { return &self; }
+};
+class ParseOrSemanticError {
+private:
+       LDKParseOrSemanticError self;
+public:
+       ParseOrSemanticError(const ParseOrSemanticError&) = delete;
+       ParseOrSemanticError(ParseOrSemanticError&& o) : self(o.self) { memset(&o, 0, sizeof(ParseOrSemanticError)); }
+       ParseOrSemanticError(LDKParseOrSemanticError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKParseOrSemanticError)); }
+       operator LDKParseOrSemanticError() && { LDKParseOrSemanticError res = self; memset(&self, 0, sizeof(LDKParseOrSemanticError)); return res; }
+       ~ParseOrSemanticError() { ParseOrSemanticError_free(self); }
+       ParseOrSemanticError& operator=(ParseOrSemanticError&& o) { ParseOrSemanticError_free(self); self = o.self; memset(&o, 0, sizeof(ParseOrSemanticError)); return *this; }
+       LDKParseOrSemanticError* operator &() { return &self; }
+       LDKParseOrSemanticError* operator ->() { return &self; }
+       const LDKParseOrSemanticError* operator &() const { return &self; }
+       const LDKParseOrSemanticError* operator ->() const { return &self; }
+};
 class Invoice {
 private:
        LDKInvoice self;
@@ -4327,21 +4359,6 @@ public:
        const LDKCResult_TransactionNoneZ* operator &() const { return &self; }
        const LDKCResult_TransactionNoneZ* operator ->() const { return &self; }
 };
-class CResult_SignedRawInvoiceNoneZ {
-private:
-       LDKCResult_SignedRawInvoiceNoneZ self;
-public:
-       CResult_SignedRawInvoiceNoneZ(const CResult_SignedRawInvoiceNoneZ&) = delete;
-       CResult_SignedRawInvoiceNoneZ(CResult_SignedRawInvoiceNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SignedRawInvoiceNoneZ)); }
-       CResult_SignedRawInvoiceNoneZ(LDKCResult_SignedRawInvoiceNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SignedRawInvoiceNoneZ)); }
-       operator LDKCResult_SignedRawInvoiceNoneZ() && { LDKCResult_SignedRawInvoiceNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_SignedRawInvoiceNoneZ)); return res; }
-       ~CResult_SignedRawInvoiceNoneZ() { CResult_SignedRawInvoiceNoneZ_free(self); }
-       CResult_SignedRawInvoiceNoneZ& operator=(CResult_SignedRawInvoiceNoneZ&& o) { CResult_SignedRawInvoiceNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SignedRawInvoiceNoneZ)); return *this; }
-       LDKCResult_SignedRawInvoiceNoneZ* operator &() { return &self; }
-       LDKCResult_SignedRawInvoiceNoneZ* operator ->() { return &self; }
-       const LDKCResult_SignedRawInvoiceNoneZ* operator &() const { return &self; }
-       const LDKCResult_SignedRawInvoiceNoneZ* operator ->() const { return &self; }
-};
 class CResult_ClosingSignedFeeRangeDecodeErrorZ {
 private:
        LDKCResult_ClosingSignedFeeRangeDecodeErrorZ self;
@@ -4402,6 +4419,21 @@ public:
        const LDKCResult_InvoiceSignOrCreationErrorZ* operator &() const { return &self; }
        const LDKCResult_InvoiceSignOrCreationErrorZ* 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 CVec_TransactionOutputsZ {
 private:
        LDKCVec_TransactionOutputsZ self;
@@ -4462,21 +4494,6 @@ public:
        const LDKCVec_CVec_u8ZZ* operator &() const { return &self; }
        const LDKCVec_CVec_u8ZZ* 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 CResult_ProbabilisticScorerDecodeErrorZ {
 private:
        LDKCResult_ProbabilisticScorerDecodeErrorZ self;
@@ -4522,20 +4539,20 @@ public:
        const LDKCResult_ShutdownScriptDecodeErrorZ* operator &() const { return &self; }
        const LDKCResult_ShutdownScriptDecodeErrorZ* operator ->() const { return &self; }
 };
-class CResult_InvoiceNoneZ {
+class CResult_QueryChannelRangeDecodeErrorZ {
 private:
-       LDKCResult_InvoiceNoneZ self;
+       LDKCResult_QueryChannelRangeDecodeErrorZ self;
 public:
-       CResult_InvoiceNoneZ(const CResult_InvoiceNoneZ&) = delete;
-       CResult_InvoiceNoneZ(CResult_InvoiceNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceNoneZ)); }
-       CResult_InvoiceNoneZ(LDKCResult_InvoiceNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceNoneZ)); }
-       operator LDKCResult_InvoiceNoneZ() && { LDKCResult_InvoiceNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceNoneZ)); return res; }
-       ~CResult_InvoiceNoneZ() { CResult_InvoiceNoneZ_free(self); }
-       CResult_InvoiceNoneZ& operator=(CResult_InvoiceNoneZ&& o) { CResult_InvoiceNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceNoneZ)); return *this; }
-       LDKCResult_InvoiceNoneZ* operator &() { return &self; }
-       LDKCResult_InvoiceNoneZ* operator ->() { return &self; }
-       const LDKCResult_InvoiceNoneZ* operator &() const { return &self; }
-       const LDKCResult_InvoiceNoneZ* operator ->() const { return &self; }
+       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 CResult_TxCreationKeysDecodeErrorZ {
 private:
@@ -4657,21 +4674,6 @@ public:
        const LDKCResult_NodeAnnouncementDecodeErrorZ* operator &() const { return &self; }
        const LDKCResult_NodeAnnouncementDecodeErrorZ* 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_BalanceZ {
 private:
        LDKCVec_BalanceZ self;
@@ -5707,6 +5709,21 @@ public:
        const LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator &() const { return &self; }
        const LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator ->() const { return &self; }
 };
+class CResult_SiPrefixParseErrorZ {
+private:
+       LDKCResult_SiPrefixParseErrorZ self;
+public:
+       CResult_SiPrefixParseErrorZ(const CResult_SiPrefixParseErrorZ&) = delete;
+       CResult_SiPrefixParseErrorZ(CResult_SiPrefixParseErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SiPrefixParseErrorZ)); }
+       CResult_SiPrefixParseErrorZ(LDKCResult_SiPrefixParseErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SiPrefixParseErrorZ)); }
+       operator LDKCResult_SiPrefixParseErrorZ() && { LDKCResult_SiPrefixParseErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SiPrefixParseErrorZ)); return res; }
+       ~CResult_SiPrefixParseErrorZ() { CResult_SiPrefixParseErrorZ_free(self); }
+       CResult_SiPrefixParseErrorZ& operator=(CResult_SiPrefixParseErrorZ&& o) { CResult_SiPrefixParseErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SiPrefixParseErrorZ)); return *this; }
+       LDKCResult_SiPrefixParseErrorZ* operator &() { return &self; }
+       LDKCResult_SiPrefixParseErrorZ* operator ->() { return &self; }
+       const LDKCResult_SiPrefixParseErrorZ* operator &() const { return &self; }
+       const LDKCResult_SiPrefixParseErrorZ* operator ->() const { return &self; }
+};
 class CVec_RouteHintZ {
 private:
        LDKCVec_RouteHintZ self;
@@ -6187,6 +6204,21 @@ public:
        const LDKCResult_UpdateFailHTLCDecodeErrorZ* operator &() const { return &self; }
        const LDKCResult_UpdateFailHTLCDecodeErrorZ* operator ->() const { return &self; }
 };
+class CResult_InvoiceParseOrSemanticErrorZ {
+private:
+       LDKCResult_InvoiceParseOrSemanticErrorZ self;
+public:
+       CResult_InvoiceParseOrSemanticErrorZ(const CResult_InvoiceParseOrSemanticErrorZ&) = delete;
+       CResult_InvoiceParseOrSemanticErrorZ(CResult_InvoiceParseOrSemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceParseOrSemanticErrorZ)); }
+       CResult_InvoiceParseOrSemanticErrorZ(LDKCResult_InvoiceParseOrSemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ)); }
+       operator LDKCResult_InvoiceParseOrSemanticErrorZ() && { LDKCResult_InvoiceParseOrSemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ)); return res; }
+       ~CResult_InvoiceParseOrSemanticErrorZ() { CResult_InvoiceParseOrSemanticErrorZ_free(self); }
+       CResult_InvoiceParseOrSemanticErrorZ& operator=(CResult_InvoiceParseOrSemanticErrorZ&& o) { CResult_InvoiceParseOrSemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceParseOrSemanticErrorZ)); return *this; }
+       LDKCResult_InvoiceParseOrSemanticErrorZ* operator &() { return &self; }
+       LDKCResult_InvoiceParseOrSemanticErrorZ* operator ->() { return &self; }
+       const LDKCResult_InvoiceParseOrSemanticErrorZ* operator &() const { return &self; }
+       const LDKCResult_InvoiceParseOrSemanticErrorZ* operator ->() const { return &self; }
+};
 class CResult_PaymentSecretNoneZ {
 private:
        LDKCResult_PaymentSecretNoneZ self;
@@ -6397,21 +6429,6 @@ public:
        const LDKCResult_COption_ClosureReasonZDecodeErrorZ* operator &() const { return &self; }
        const LDKCResult_COption_ClosureReasonZDecodeErrorZ* operator ->() const { return &self; }
 };
-class CResult_SiPrefixNoneZ {
-private:
-       LDKCResult_SiPrefixNoneZ self;
-public:
-       CResult_SiPrefixNoneZ(const CResult_SiPrefixNoneZ&) = delete;
-       CResult_SiPrefixNoneZ(CResult_SiPrefixNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SiPrefixNoneZ)); }
-       CResult_SiPrefixNoneZ(LDKCResult_SiPrefixNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SiPrefixNoneZ)); }
-       operator LDKCResult_SiPrefixNoneZ() && { LDKCResult_SiPrefixNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_SiPrefixNoneZ)); return res; }
-       ~CResult_SiPrefixNoneZ() { CResult_SiPrefixNoneZ_free(self); }
-       CResult_SiPrefixNoneZ& operator=(CResult_SiPrefixNoneZ&& o) { CResult_SiPrefixNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SiPrefixNoneZ)); return *this; }
-       LDKCResult_SiPrefixNoneZ* operator &() { return &self; }
-       LDKCResult_SiPrefixNoneZ* operator ->() { return &self; }
-       const LDKCResult_SiPrefixNoneZ* operator &() const { return &self; }
-       const LDKCResult_SiPrefixNoneZ* operator ->() const { return &self; }
-};
 class CResult_PublicKeyErrorZ {
 private:
        LDKCResult_PublicKeyErrorZ self;
@@ -6667,6 +6684,21 @@ public:
        const LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* operator &() const { return &self; }
        const LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* operator ->() const { return &self; }
 };
+class CResult_SignedRawInvoiceParseErrorZ {
+private:
+       LDKCResult_SignedRawInvoiceParseErrorZ self;
+public:
+       CResult_SignedRawInvoiceParseErrorZ(const CResult_SignedRawInvoiceParseErrorZ&) = delete;
+       CResult_SignedRawInvoiceParseErrorZ(CResult_SignedRawInvoiceParseErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SignedRawInvoiceParseErrorZ)); }
+       CResult_SignedRawInvoiceParseErrorZ(LDKCResult_SignedRawInvoiceParseErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SignedRawInvoiceParseErrorZ)); }
+       operator LDKCResult_SignedRawInvoiceParseErrorZ() && { LDKCResult_SignedRawInvoiceParseErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SignedRawInvoiceParseErrorZ)); return res; }
+       ~CResult_SignedRawInvoiceParseErrorZ() { CResult_SignedRawInvoiceParseErrorZ_free(self); }
+       CResult_SignedRawInvoiceParseErrorZ& operator=(CResult_SignedRawInvoiceParseErrorZ&& o) { CResult_SignedRawInvoiceParseErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SignedRawInvoiceParseErrorZ)); return *this; }
+       LDKCResult_SignedRawInvoiceParseErrorZ* operator &() { return &self; }
+       LDKCResult_SignedRawInvoiceParseErrorZ* operator ->() { return &self; }
+       const LDKCResult_SignedRawInvoiceParseErrorZ* operator &() const { return &self; }
+       const LDKCResult_SignedRawInvoiceParseErrorZ* operator ->() const { return &self; }
+};
 class C2Tuple_u32ScriptZ {
 private:
        LDKC2Tuple_u32ScriptZ self;
@@ -6682,21 +6714,6 @@ public:
        const LDKC2Tuple_u32ScriptZ* operator &() const { return &self; }
        const LDKC2Tuple_u32ScriptZ* operator ->() const { return &self; }
 };
-class CResult_ReplyShortChannelIdsEndDecodeErrorZ {
-private:
-       LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ self;
-public:
-       CResult_ReplyShortChannelIdsEndDecodeErrorZ(const CResult_ReplyShortChannelIdsEndDecodeErrorZ&) = delete;
-       CResult_ReplyShortChannelIdsEndDecodeErrorZ(CResult_ReplyShortChannelIdsEndDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ReplyShortChannelIdsEndDecodeErrorZ)); }
-       CResult_ReplyShortChannelIdsEndDecodeErrorZ(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ)); }
-       operator LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ() && { LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ)); return res; }
-       ~CResult_ReplyShortChannelIdsEndDecodeErrorZ() { CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(self); }
-       CResult_ReplyShortChannelIdsEndDecodeErrorZ& operator=(CResult_ReplyShortChannelIdsEndDecodeErrorZ&& o) { CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ReplyShortChannelIdsEndDecodeErrorZ)); return *this; }
-       LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator &() { return &self; }
-       LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator ->() { return &self; }
-       const LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator &() const { return &self; }
-       const LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator ->() const { return &self; }
-};
 class CResult_RouteDecodeErrorZ {
 private:
        LDKCResult_RouteDecodeErrorZ self;
@@ -6817,6 +6834,21 @@ public:
        const LDKCResult_FundingLockedDecodeErrorZ* operator &() const { return &self; }
        const LDKCResult_FundingLockedDecodeErrorZ* 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; }
+};
 
 inline LDK::CResult_NoneErrorZ Persister::persist_manager(const struct LDKChannelManager *NONNULL_PTR channel_manager) {
        LDK::CResult_NoneErrorZ ret = (self.persist_manager)(self.this_arg, channel_manager);
index 0f7cf38f9358cae11dfd6414fa20458c4e2fbb99..f8aeb3e3c8abbd6756e6a12b9907596c2e33fdd0 100644 (file)
@@ -8088,73 +8088,77 @@ impl Clone for CResult_PaymentIdPaymentErrorZ {
 /// but with all dynamically-allocated buffers duplicated in new buffers.
 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
 #[repr(C)]
-/// The contents of CResult_SiPrefixNoneZ
-pub union CResult_SiPrefixNoneZPtr {
+/// The contents of CResult_SiPrefixParseErrorZ
+pub union CResult_SiPrefixParseErrorZPtr {
        /// A 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,
-       /// Note that this value is always NULL, as there are no contents in the Err variant
-       pub err: *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::ParseError,
 }
 #[repr(C)]
-/// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
-/// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
+/// A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_SiPrefixNoneZ {
-       /// The contents of this CResult_SiPrefixNoneZ, accessible via either
+pub struct CResult_SiPrefixParseErrorZ {
+       /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either
        /// `err` or `result` depending on the state of `result_ok`.
-       pub contents: CResult_SiPrefixNoneZPtr,
-       /// Whether this CResult_SiPrefixNoneZ represents a success state.
+       pub contents: CResult_SiPrefixParseErrorZPtr,
+       /// Whether this CResult_SiPrefixParseErrorZ represents a success state.
        pub result_ok: bool,
 }
 #[no_mangle]
-/// Creates a new CResult_SiPrefixNoneZ in the success state.
-pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
-       CResult_SiPrefixNoneZ {
-               contents: CResult_SiPrefixNoneZPtr {
+/// Creates a new CResult_SiPrefixParseErrorZ in the success state.
+pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ {
+       CResult_SiPrefixParseErrorZ {
+               contents: CResult_SiPrefixParseErrorZPtr {
                        result: Box::into_raw(Box::new(o)),
                },
                result_ok: true,
        }
 }
 #[no_mangle]
-/// Creates a new CResult_SiPrefixNoneZ in the error state.
-pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
-       CResult_SiPrefixNoneZ {
-               contents: CResult_SiPrefixNoneZPtr {
-                       err: core::ptr::null_mut(),
+/// Creates a new CResult_SiPrefixParseErrorZ in the error state.
+pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ {
+       CResult_SiPrefixParseErrorZ {
+               contents: CResult_SiPrefixParseErrorZPtr {
+                       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_SiPrefixNoneZ_is_ok(o: &CResult_SiPrefixNoneZ) -> bool {
+pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool {
        o.result_ok
 }
 #[no_mangle]
-/// Frees any resources used by the CResult_SiPrefixNoneZ.
-pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
-impl Drop for CResult_SiPrefixNoneZ {
+/// Frees any resources used by the CResult_SiPrefixParseErrorZ.
+pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { }
+impl Drop for CResult_SiPrefixParseErrorZ {
        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::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
-       fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>> for CResult_SiPrefixParseErrorZ {
+       fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>) -> Self {
                let contents = if o.result_ok {
                        let result = unsafe { o.contents.result };
                        unsafe { o.contents.result = core::ptr::null_mut() };
-                       CResult_SiPrefixNoneZPtr { result }
+                       CResult_SiPrefixParseErrorZPtr { result }
                } else {
-                       let _ = unsafe { Box::from_raw(o.contents.err) };
-                       o.contents.err = core::ptr::null_mut();
-                       CResult_SiPrefixNoneZPtr { err: core::ptr::null_mut() }
+                       let err = unsafe { o.contents.err };
+                       unsafe { o.contents.err = core::ptr::null_mut(); }
+                       CResult_SiPrefixParseErrorZPtr { err }
                };
                Self {
                        contents,
@@ -8162,91 +8166,95 @@ impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>>
                }
        }
 }
-impl Clone for CResult_SiPrefixNoneZ {
+impl Clone for CResult_SiPrefixParseErrorZ {
        fn clone(&self) -> Self {
                if self.result_ok {
-                       Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
+                       Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr {
                                result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
                        } }
                } else {
-                       Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
-                               err: core::ptr::null_mut()
+                       Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr {
+                               err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
                        } }
                }
        }
 }
 #[no_mangle]
-/// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
+/// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
 /// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) }
 #[repr(C)]
-/// The contents of CResult_InvoiceNoneZ
-pub union CResult_InvoiceNoneZPtr {
+/// The contents of CResult_InvoiceParseOrSemanticErrorZ
+pub union CResult_InvoiceParseOrSemanticErrorZPtr {
        /// A 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::Invoice,
-       /// Note that this value is always NULL, as there are no contents in the Err variant
-       pub err: *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,
 }
 #[repr(C)]
-/// A CResult_InvoiceNoneZ represents the result of a fallible operation,
-/// containing a crate::lightning_invoice::Invoice on success and a () on failure.
+/// A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning_invoice::Invoice 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_InvoiceNoneZ {
-       /// The contents of this CResult_InvoiceNoneZ, accessible via either
+pub struct CResult_InvoiceParseOrSemanticErrorZ {
+       /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
        /// `err` or `result` depending on the state of `result_ok`.
-       pub contents: CResult_InvoiceNoneZPtr,
-       /// Whether this CResult_InvoiceNoneZ represents a success state.
+       pub contents: CResult_InvoiceParseOrSemanticErrorZPtr,
+       /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
        pub result_ok: bool,
 }
 #[no_mangle]
-/// Creates a new CResult_InvoiceNoneZ in the success state.
-pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
-       CResult_InvoiceNoneZ {
-               contents: CResult_InvoiceNoneZPtr {
+/// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
+pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ {
+       CResult_InvoiceParseOrSemanticErrorZ {
+               contents: CResult_InvoiceParseOrSemanticErrorZPtr {
                        result: Box::into_raw(Box::new(o)),
                },
                result_ok: true,
        }
 }
 #[no_mangle]
-/// Creates a new CResult_InvoiceNoneZ in the error state.
-pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
-       CResult_InvoiceNoneZ {
-               contents: CResult_InvoiceNoneZPtr {
-                       err: core::ptr::null_mut(),
+/// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
+pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ {
+       CResult_InvoiceParseOrSemanticErrorZ {
+               contents: CResult_InvoiceParseOrSemanticErrorZPtr {
+                       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_InvoiceNoneZ_is_ok(o: &CResult_InvoiceNoneZ) -> bool {
+pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool {
        o.result_ok
 }
 #[no_mangle]
-/// Frees any resources used by the CResult_InvoiceNoneZ.
-pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
-impl Drop for CResult_InvoiceNoneZ {
+/// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
+pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { }
+impl Drop for CResult_InvoiceParseOrSemanticErrorZ {
        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::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
-       fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_InvoiceParseOrSemanticErrorZ {
+       fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
                let contents = if o.result_ok {
                        let result = unsafe { o.contents.result };
                        unsafe { o.contents.result = core::ptr::null_mut() };
-                       CResult_InvoiceNoneZPtr { result }
+                       CResult_InvoiceParseOrSemanticErrorZPtr { result }
                } else {
-                       let _ = unsafe { Box::from_raw(o.contents.err) };
-                       o.contents.err = core::ptr::null_mut();
-                       CResult_InvoiceNoneZPtr { err: core::ptr::null_mut() }
+                       let err = unsafe { o.contents.err };
+                       unsafe { o.contents.err = core::ptr::null_mut(); }
+                       CResult_InvoiceParseOrSemanticErrorZPtr { err }
                };
                Self {
                        contents,
@@ -8254,91 +8262,95 @@ impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> f
                }
        }
 }
-impl Clone for CResult_InvoiceNoneZ {
+impl Clone for CResult_InvoiceParseOrSemanticErrorZ {
        fn clone(&self) -> Self {
                if self.result_ok {
-                       Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
+                       Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
                                result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
                        } }
                } else {
-                       Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
-                               err: core::ptr::null_mut()
+                       Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
+                               err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
                        } }
                }
        }
 }
 #[no_mangle]
-/// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
+/// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
 /// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
 #[repr(C)]
-/// The contents of CResult_SignedRawInvoiceNoneZ
-pub union CResult_SignedRawInvoiceNoneZPtr {
+/// The contents of CResult_SignedRawInvoiceParseErrorZ
+pub union CResult_SignedRawInvoiceParseErrorZPtr {
        /// A 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::SignedRawInvoice,
-       /// Note that this value is always NULL, as there are no contents in the Err variant
-       pub err: *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::ParseError,
 }
 #[repr(C)]
-/// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
-/// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
+/// A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
+/// containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
-pub struct CResult_SignedRawInvoiceNoneZ {
-       /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
+pub struct CResult_SignedRawInvoiceParseErrorZ {
+       /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
        /// `err` or `result` depending on the state of `result_ok`.
-       pub contents: CResult_SignedRawInvoiceNoneZPtr,
-       /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
+       pub contents: CResult_SignedRawInvoiceParseErrorZPtr,
+       /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
        pub result_ok: bool,
 }
 #[no_mangle]
-/// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
-pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
-       CResult_SignedRawInvoiceNoneZ {
-               contents: CResult_SignedRawInvoiceNoneZPtr {
+/// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
+pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ {
+       CResult_SignedRawInvoiceParseErrorZ {
+               contents: CResult_SignedRawInvoiceParseErrorZPtr {
                        result: Box::into_raw(Box::new(o)),
                },
                result_ok: true,
        }
 }
 #[no_mangle]
-/// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
-pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
-       CResult_SignedRawInvoiceNoneZ {
-               contents: CResult_SignedRawInvoiceNoneZPtr {
-                       err: core::ptr::null_mut(),
+/// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
+pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ {
+       CResult_SignedRawInvoiceParseErrorZ {
+               contents: CResult_SignedRawInvoiceParseErrorZPtr {
+                       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_SignedRawInvoiceNoneZ_is_ok(o: &CResult_SignedRawInvoiceNoneZ) -> bool {
+pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool {
        o.result_ok
 }
 #[no_mangle]
-/// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
-pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
-impl Drop for CResult_SignedRawInvoiceNoneZ {
+/// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
+pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { }
+impl Drop for CResult_SignedRawInvoiceParseErrorZ {
        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::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
-       fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
+impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>> for CResult_SignedRawInvoiceParseErrorZ {
+       fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>) -> Self {
                let contents = if o.result_ok {
                        let result = unsafe { o.contents.result };
                        unsafe { o.contents.result = core::ptr::null_mut() };
-                       CResult_SignedRawInvoiceNoneZPtr { result }
+                       CResult_SignedRawInvoiceParseErrorZPtr { result }
                } else {
-                       let _ = unsafe { Box::from_raw(o.contents.err) };
-                       o.contents.err = core::ptr::null_mut();
-                       CResult_SignedRawInvoiceNoneZPtr { err: core::ptr::null_mut() }
+                       let err = unsafe { o.contents.err };
+                       unsafe { o.contents.err = core::ptr::null_mut(); }
+                       CResult_SignedRawInvoiceParseErrorZPtr { err }
                };
                Self {
                        contents,
@@ -8346,23 +8358,23 @@ impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoic
                }
        }
 }
-impl Clone for CResult_SignedRawInvoiceNoneZ {
+impl Clone for CResult_SignedRawInvoiceParseErrorZ {
        fn clone(&self) -> Self {
                if self.result_ok {
-                       Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
+                       Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr {
                                result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
                        } }
                } else {
-                       Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
-                               err: core::ptr::null_mut()
+                       Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr {
+                               err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
                        } }
                }
        }
 }
 #[no_mangle]
-/// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
+/// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
 /// but with all dynamically-allocated buffers duplicated in new buffers.
-pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
+pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) }
 #[repr(C)]
 /// A tuple of 3 elements. See the individual fields for the types contained.
 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
index f31d55bd1b2c7d9ec67f30552f0036d27e5b28a6..80f04c523f421d9fd2cd64fcbb9ae0c767781999 100644 (file)
@@ -169,6 +169,71 @@ impl Secp256k1Error {
                        SecpError::NotEnoughMemory => Secp256k1Error::NotEnoughMemory,
                }
        }
+       pub(crate) fn into_rust(self) -> SecpError {
+               match self {
+                       Secp256k1Error::IncorrectSignature => SecpError::IncorrectSignature,
+                       Secp256k1Error::InvalidMessage => SecpError::InvalidMessage,
+                       Secp256k1Error::InvalidPublicKey => SecpError::InvalidPublicKey,
+                       Secp256k1Error::InvalidSignature => SecpError::InvalidSignature,
+                       Secp256k1Error::InvalidSecretKey => SecpError::InvalidSecretKey,
+                       Secp256k1Error::InvalidRecoveryId => SecpError::InvalidRecoveryId,
+                       Secp256k1Error::InvalidTweak => SecpError::InvalidTweak,
+                       Secp256k1Error::TweakCheckFailed => SecpError::TweakCheckFailed,
+                       Secp256k1Error::NotEnoughMemory => SecpError::NotEnoughMemory,
+               }
+       }
+}
+
+#[repr(C)]
+#[derive(Copy, Clone)]
+/// Represents an error returned from the bech32 library during validation of some bech32 data
+pub enum Bech32Error {
+       /// String does not contain the separator character
+       MissingSeparator,
+       /// The checksum does not match the rest of the data
+       InvalidChecksum,
+       /// The data or human-readable part is too long or too short
+       InvalidLength,
+       /// Some part of the string contains an invalid character
+       InvalidChar(u32),
+       /// Some part of the data has an invalid value
+       InvalidData(u8),
+       /// The bit conversion failed due to a padding issue
+       InvalidPadding,
+       /// The whole string must be of one case
+       MixedCase,
+}
+impl Bech32Error {
+       pub(crate) fn from_rust(err: bech32::Error) -> Self {
+               match err {
+                       bech32::Error::MissingSeparator => Self::MissingSeparator,
+                       bech32::Error::InvalidChecksum => Self::InvalidChecksum,
+                       bech32::Error::InvalidLength => Self::InvalidLength,
+                       bech32::Error::InvalidChar(c) => Self::InvalidChar(c as u32),
+                       bech32::Error::InvalidData(d) => Self::InvalidData(d),
+                       bech32::Error::InvalidPadding => Self::InvalidPadding,
+                       bech32::Error::MixedCase => Self::MixedCase,
+               }
+       }
+       pub(crate) fn into_rust(self) -> bech32::Error {
+               match self {
+                       Self::MissingSeparator => bech32::Error::MissingSeparator,
+                       Self::InvalidChecksum => bech32::Error::InvalidChecksum,
+                       Self::InvalidLength => bech32::Error::InvalidLength,
+                       Self::InvalidChar(c) => bech32::Error::InvalidChar(core::char::from_u32(c).expect("Invalid UTF-8 character in Bech32Error::InvalidChar")),
+                       Self::InvalidData(d) => bech32::Error::InvalidData(d),
+                       Self::InvalidPadding => bech32::Error::InvalidPadding,
+                       Self::MixedCase => bech32::Error::MixedCase,
+               }
+       }
+}
+
+#[repr(C)]
+#[derive(Clone, Copy, PartialEq)]
+/// Sub-errors which don't have specific information in them use this type.
+pub struct Error {
+       /// Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here
+       pub _dummy: u8,
 }
 
 #[repr(C)]
index 760da327713da2aafe6e3373e88ee873391703c9..4afdd97ce0f8d46734a9baaaad527c3ac519b1b6 100644 (file)
@@ -49,40 +49,62 @@ use alloc::{vec::Vec, boxed::Box};
 }
 #[no_mangle]
 /// Read a SiPrefix object from a string
-pub extern "C" fn SiPrefix_from_str(s: crate::c_types::Str) -> crate::c_types::derived::CResult_SiPrefixNoneZ {
+pub extern "C" fn SiPrefix_from_str(s: crate::c_types::Str) -> crate::c_types::derived::CResult_SiPrefixParseErrorZ {
        match lightning_invoice::SiPrefix::from_str(s.into_str()) {
                Ok(r) => {
                        crate::c_types::CResultTempl::ok(
                                crate::lightning_invoice::SiPrefix::native_into(r)
                        )
                },
-               Err(e) => crate::c_types::CResultTempl::err(()),
+               Err(e) => {
+                       crate::c_types::CResultTempl::err(
+                               crate::lightning_invoice::ParseError::native_into(e)
+                       )
+               },
        }.into()
 }
 #[no_mangle]
 /// Read a Invoice object from a string
-pub extern "C" fn Invoice_from_str(s: crate::c_types::Str) -> crate::c_types::derived::CResult_InvoiceNoneZ {
+pub extern "C" fn Invoice_from_str(s: crate::c_types::Str) -> crate::c_types::derived::CResult_InvoiceParseOrSemanticErrorZ {
        match lightning_invoice::Invoice::from_str(s.into_str()) {
                Ok(r) => {
                        crate::c_types::CResultTempl::ok(
                                crate::lightning_invoice::Invoice { inner: ObjOps::heap_alloc(r), is_owned: true }
                        )
                },
-               Err(e) => crate::c_types::CResultTempl::err(()),
+               Err(e) => {
+                       crate::c_types::CResultTempl::err(
+                               crate::lightning_invoice::ParseOrSemanticError::native_into(e)
+                       )
+               },
        }.into()
 }
 #[no_mangle]
 /// Read a SignedRawInvoice object from a string
-pub extern "C" fn SignedRawInvoice_from_str(s: crate::c_types::Str) -> crate::c_types::derived::CResult_SignedRawInvoiceNoneZ {
+pub extern "C" fn SignedRawInvoice_from_str(s: crate::c_types::Str) -> crate::c_types::derived::CResult_SignedRawInvoiceParseErrorZ {
        match lightning_invoice::SignedRawInvoice::from_str(s.into_str()) {
                Ok(r) => {
                        crate::c_types::CResultTempl::ok(
                                crate::lightning_invoice::SignedRawInvoice { inner: ObjOps::heap_alloc(r), is_owned: true }
                        )
                },
-               Err(e) => crate::c_types::CResultTempl::err(()),
+               Err(e) => {
+                       crate::c_types::CResultTempl::err(
+                               crate::lightning_invoice::ParseError::native_into(e)
+                       )
+               },
        }.into()
 }
+#[no_mangle]
+/// Get the string representation of a ParseError object
+pub extern "C" fn ParseError_to_str(o: &crate::lightning_invoice::ParseError) -> Str {
+       alloc::format!("{}", &o.to_native()).into()
+}
+#[no_mangle]
+/// Get the string representation of a ParseOrSemanticError object
+pub extern "C" fn ParseOrSemanticError_to_str(o: &crate::lightning_invoice::ParseOrSemanticError) -> Str {
+       alloc::format!("{}", &o.to_native()).into()
+}
 }
 mod ser {
 
@@ -147,6 +169,400 @@ use crate::c_types::*;
 #[cfg(feature="no-std")]
 use alloc::{vec::Vec, boxed::Box};
 
+}
+/// Errors that indicate what is wrong with the invoice. They have some granularity for debug
+/// reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user.
+#[must_use]
+#[derive(Clone)]
+#[repr(C)]
+pub enum ParseError {
+       Bech32Error(crate::c_types::Bech32Error),
+       ParseAmountError(crate::c_types::Error),
+       MalformedSignature(crate::c_types::Secp256k1Error),
+       BadPrefix,
+       UnknownCurrency,
+       UnknownSiPrefix,
+       MalformedHRP,
+       TooShortDataPart,
+       UnexpectedEndOfTaggedFields,
+       DescriptionDecodeError(crate::c_types::Error),
+       PaddingError,
+       IntegerOverflowError,
+       InvalidSegWitProgramLength,
+       InvalidPubKeyHashLength,
+       InvalidScriptHashLength,
+       InvalidRecoveryId,
+       InvalidSliceLength(crate::c_types::Str),
+       /// Not an error, but used internally to signal that a part of the invoice should be ignored
+       /// according to BOLT11
+       Skip,
+}
+use lightning_invoice::ParseError as nativeParseError;
+impl ParseError {
+       #[allow(unused)]
+       pub(crate) fn to_native(&self) -> nativeParseError {
+               match self {
+                       ParseError::Bech32Error (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               nativeParseError::Bech32Error (
+                                       a_nonref.into_rust(),
+                               )
+                       },
+                       ParseError::ParseAmountError (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               nativeParseError::ParseAmountError (
+                                       u8::from_str_radix(" a", 10).unwrap_err() /*a_nonref*/,
+                               )
+                       },
+                       ParseError::MalformedSignature (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               nativeParseError::MalformedSignature (
+                                       a_nonref.into_rust(),
+                               )
+                       },
+                       ParseError::BadPrefix => nativeParseError::BadPrefix,
+                       ParseError::UnknownCurrency => nativeParseError::UnknownCurrency,
+                       ParseError::UnknownSiPrefix => nativeParseError::UnknownSiPrefix,
+                       ParseError::MalformedHRP => nativeParseError::MalformedHRP,
+                       ParseError::TooShortDataPart => nativeParseError::TooShortDataPart,
+                       ParseError::UnexpectedEndOfTaggedFields => nativeParseError::UnexpectedEndOfTaggedFields,
+                       ParseError::DescriptionDecodeError (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               nativeParseError::DescriptionDecodeError (
+                                       core::str::from_utf8(&[0xff]).unwrap_err() /*a_nonref*/,
+                               )
+                       },
+                       ParseError::PaddingError => nativeParseError::PaddingError,
+                       ParseError::IntegerOverflowError => nativeParseError::IntegerOverflowError,
+                       ParseError::InvalidSegWitProgramLength => nativeParseError::InvalidSegWitProgramLength,
+                       ParseError::InvalidPubKeyHashLength => nativeParseError::InvalidPubKeyHashLength,
+                       ParseError::InvalidScriptHashLength => nativeParseError::InvalidScriptHashLength,
+                       ParseError::InvalidRecoveryId => nativeParseError::InvalidRecoveryId,
+                       ParseError::InvalidSliceLength (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               nativeParseError::InvalidSliceLength (
+                                       a_nonref.into_string(),
+                               )
+                       },
+                       ParseError::Skip => nativeParseError::Skip,
+               }
+       }
+       #[allow(unused)]
+       pub(crate) fn into_native(self) -> nativeParseError {
+               match self {
+                       ParseError::Bech32Error (mut a, ) => {
+                               nativeParseError::Bech32Error (
+                                       a.into_rust(),
+                               )
+                       },
+                       ParseError::ParseAmountError (mut a, ) => {
+                               nativeParseError::ParseAmountError (
+                                       u8::from_str_radix(" a", 10).unwrap_err() /*a*/,
+                               )
+                       },
+                       ParseError::MalformedSignature (mut a, ) => {
+                               nativeParseError::MalformedSignature (
+                                       a.into_rust(),
+                               )
+                       },
+                       ParseError::BadPrefix => nativeParseError::BadPrefix,
+                       ParseError::UnknownCurrency => nativeParseError::UnknownCurrency,
+                       ParseError::UnknownSiPrefix => nativeParseError::UnknownSiPrefix,
+                       ParseError::MalformedHRP => nativeParseError::MalformedHRP,
+                       ParseError::TooShortDataPart => nativeParseError::TooShortDataPart,
+                       ParseError::UnexpectedEndOfTaggedFields => nativeParseError::UnexpectedEndOfTaggedFields,
+                       ParseError::DescriptionDecodeError (mut a, ) => {
+                               nativeParseError::DescriptionDecodeError (
+                                       core::str::from_utf8(&[0xff]).unwrap_err() /*a*/,
+                               )
+                       },
+                       ParseError::PaddingError => nativeParseError::PaddingError,
+                       ParseError::IntegerOverflowError => nativeParseError::IntegerOverflowError,
+                       ParseError::InvalidSegWitProgramLength => nativeParseError::InvalidSegWitProgramLength,
+                       ParseError::InvalidPubKeyHashLength => nativeParseError::InvalidPubKeyHashLength,
+                       ParseError::InvalidScriptHashLength => nativeParseError::InvalidScriptHashLength,
+                       ParseError::InvalidRecoveryId => nativeParseError::InvalidRecoveryId,
+                       ParseError::InvalidSliceLength (mut a, ) => {
+                               nativeParseError::InvalidSliceLength (
+                                       a.into_string(),
+                               )
+                       },
+                       ParseError::Skip => nativeParseError::Skip,
+               }
+       }
+       #[allow(unused)]
+       pub(crate) fn from_native(native: &nativeParseError) -> Self {
+               match native {
+                       nativeParseError::Bech32Error (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               ParseError::Bech32Error (
+                                       crate::c_types::Bech32Error::from_rust(a_nonref),
+                               )
+                       },
+                       nativeParseError::ParseAmountError (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               ParseError::ParseAmountError (
+                                       crate::c_types::Error { _dummy: 0 } /*a_nonref*/,
+                               )
+                       },
+                       nativeParseError::MalformedSignature (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               ParseError::MalformedSignature (
+                                       crate::c_types::Secp256k1Error::from_rust(a_nonref),
+                               )
+                       },
+                       nativeParseError::BadPrefix => ParseError::BadPrefix,
+                       nativeParseError::UnknownCurrency => ParseError::UnknownCurrency,
+                       nativeParseError::UnknownSiPrefix => ParseError::UnknownSiPrefix,
+                       nativeParseError::MalformedHRP => ParseError::MalformedHRP,
+                       nativeParseError::TooShortDataPart => ParseError::TooShortDataPart,
+                       nativeParseError::UnexpectedEndOfTaggedFields => ParseError::UnexpectedEndOfTaggedFields,
+                       nativeParseError::DescriptionDecodeError (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               ParseError::DescriptionDecodeError (
+                                       crate::c_types::Error { _dummy: 0 } /*a_nonref*/,
+                               )
+                       },
+                       nativeParseError::PaddingError => ParseError::PaddingError,
+                       nativeParseError::IntegerOverflowError => ParseError::IntegerOverflowError,
+                       nativeParseError::InvalidSegWitProgramLength => ParseError::InvalidSegWitProgramLength,
+                       nativeParseError::InvalidPubKeyHashLength => ParseError::InvalidPubKeyHashLength,
+                       nativeParseError::InvalidScriptHashLength => ParseError::InvalidScriptHashLength,
+                       nativeParseError::InvalidRecoveryId => ParseError::InvalidRecoveryId,
+                       nativeParseError::InvalidSliceLength (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               ParseError::InvalidSliceLength (
+                                       a_nonref.into(),
+                               )
+                       },
+                       nativeParseError::Skip => ParseError::Skip,
+               }
+       }
+       #[allow(unused)]
+       pub(crate) fn native_into(native: nativeParseError) -> Self {
+               match native {
+                       nativeParseError::Bech32Error (mut a, ) => {
+                               ParseError::Bech32Error (
+                                       crate::c_types::Bech32Error::from_rust(a),
+                               )
+                       },
+                       nativeParseError::ParseAmountError (mut a, ) => {
+                               ParseError::ParseAmountError (
+                                       crate::c_types::Error { _dummy: 0 } /*a*/,
+                               )
+                       },
+                       nativeParseError::MalformedSignature (mut a, ) => {
+                               ParseError::MalformedSignature (
+                                       crate::c_types::Secp256k1Error::from_rust(a),
+                               )
+                       },
+                       nativeParseError::BadPrefix => ParseError::BadPrefix,
+                       nativeParseError::UnknownCurrency => ParseError::UnknownCurrency,
+                       nativeParseError::UnknownSiPrefix => ParseError::UnknownSiPrefix,
+                       nativeParseError::MalformedHRP => ParseError::MalformedHRP,
+                       nativeParseError::TooShortDataPart => ParseError::TooShortDataPart,
+                       nativeParseError::UnexpectedEndOfTaggedFields => ParseError::UnexpectedEndOfTaggedFields,
+                       nativeParseError::DescriptionDecodeError (mut a, ) => {
+                               ParseError::DescriptionDecodeError (
+                                       crate::c_types::Error { _dummy: 0 } /*a*/,
+                               )
+                       },
+                       nativeParseError::PaddingError => ParseError::PaddingError,
+                       nativeParseError::IntegerOverflowError => ParseError::IntegerOverflowError,
+                       nativeParseError::InvalidSegWitProgramLength => ParseError::InvalidSegWitProgramLength,
+                       nativeParseError::InvalidPubKeyHashLength => ParseError::InvalidPubKeyHashLength,
+                       nativeParseError::InvalidScriptHashLength => ParseError::InvalidScriptHashLength,
+                       nativeParseError::InvalidRecoveryId => ParseError::InvalidRecoveryId,
+                       nativeParseError::InvalidSliceLength (mut a, ) => {
+                               ParseError::InvalidSliceLength (
+                                       a.into(),
+                               )
+                       },
+                       nativeParseError::Skip => ParseError::Skip,
+               }
+       }
+}
+/// Frees any resources used by the ParseError
+#[no_mangle]
+pub extern "C" fn ParseError_free(this_ptr: ParseError) { }
+/// Creates a copy of the ParseError
+#[no_mangle]
+pub extern "C" fn ParseError_clone(orig: &ParseError) -> ParseError {
+       orig.clone()
+}
+#[no_mangle]
+/// Utility method to constructs a new Bech32Error-variant ParseError
+pub extern "C" fn ParseError_bech32_error(a: crate::c_types::Bech32Error) -> ParseError {
+       ParseError::Bech32Error(a, )
+}
+#[no_mangle]
+/// Utility method to constructs a new ParseAmountError-variant ParseError
+pub extern "C" fn ParseError_parse_amount_error(a: crate::c_types::Error) -> ParseError {
+       ParseError::ParseAmountError(a, )
+}
+#[no_mangle]
+/// Utility method to constructs a new MalformedSignature-variant ParseError
+pub extern "C" fn ParseError_malformed_signature(a: crate::c_types::Secp256k1Error) -> ParseError {
+       ParseError::MalformedSignature(a, )
+}
+#[no_mangle]
+/// Utility method to constructs a new BadPrefix-variant ParseError
+pub extern "C" fn ParseError_bad_prefix() -> ParseError {
+       ParseError::BadPrefix}
+#[no_mangle]
+/// Utility method to constructs a new UnknownCurrency-variant ParseError
+pub extern "C" fn ParseError_unknown_currency() -> ParseError {
+       ParseError::UnknownCurrency}
+#[no_mangle]
+/// Utility method to constructs a new UnknownSiPrefix-variant ParseError
+pub extern "C" fn ParseError_unknown_si_prefix() -> ParseError {
+       ParseError::UnknownSiPrefix}
+#[no_mangle]
+/// Utility method to constructs a new MalformedHRP-variant ParseError
+pub extern "C" fn ParseError_malformed_hrp() -> ParseError {
+       ParseError::MalformedHRP}
+#[no_mangle]
+/// Utility method to constructs a new TooShortDataPart-variant ParseError
+pub extern "C" fn ParseError_too_short_data_part() -> ParseError {
+       ParseError::TooShortDataPart}
+#[no_mangle]
+/// Utility method to constructs a new UnexpectedEndOfTaggedFields-variant ParseError
+pub extern "C" fn ParseError_unexpected_end_of_tagged_fields() -> ParseError {
+       ParseError::UnexpectedEndOfTaggedFields}
+#[no_mangle]
+/// Utility method to constructs a new DescriptionDecodeError-variant ParseError
+pub extern "C" fn ParseError_description_decode_error(a: crate::c_types::Error) -> ParseError {
+       ParseError::DescriptionDecodeError(a, )
+}
+#[no_mangle]
+/// Utility method to constructs a new PaddingError-variant ParseError
+pub extern "C" fn ParseError_padding_error() -> ParseError {
+       ParseError::PaddingError}
+#[no_mangle]
+/// Utility method to constructs a new IntegerOverflowError-variant ParseError
+pub extern "C" fn ParseError_integer_overflow_error() -> ParseError {
+       ParseError::IntegerOverflowError}
+#[no_mangle]
+/// Utility method to constructs a new InvalidSegWitProgramLength-variant ParseError
+pub extern "C" fn ParseError_invalid_seg_wit_program_length() -> ParseError {
+       ParseError::InvalidSegWitProgramLength}
+#[no_mangle]
+/// Utility method to constructs a new InvalidPubKeyHashLength-variant ParseError
+pub extern "C" fn ParseError_invalid_pub_key_hash_length() -> ParseError {
+       ParseError::InvalidPubKeyHashLength}
+#[no_mangle]
+/// Utility method to constructs a new InvalidScriptHashLength-variant ParseError
+pub extern "C" fn ParseError_invalid_script_hash_length() -> ParseError {
+       ParseError::InvalidScriptHashLength}
+#[no_mangle]
+/// Utility method to constructs a new InvalidRecoveryId-variant ParseError
+pub extern "C" fn ParseError_invalid_recovery_id() -> ParseError {
+       ParseError::InvalidRecoveryId}
+#[no_mangle]
+/// Utility method to constructs a new InvalidSliceLength-variant ParseError
+pub extern "C" fn ParseError_invalid_slice_length(a: crate::c_types::Str) -> ParseError {
+       ParseError::InvalidSliceLength(a, )
+}
+#[no_mangle]
+/// Utility method to constructs a new Skip-variant ParseError
+pub extern "C" fn ParseError_skip() -> ParseError {
+       ParseError::Skip}
+/// 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
+/// like wrong signatures, missing fields etc. could mean that someone tampered with the invoice.
+#[must_use]
+#[derive(Clone)]
+#[repr(C)]
+pub enum ParseOrSemanticError {
+       /// The invoice couldn't be decoded
+       ParseError(crate::lightning_invoice::ParseError),
+       /// The invoice could be decoded but violates the BOLT11 standard
+       SemanticError(crate::lightning_invoice::SemanticError),
+}
+use lightning_invoice::ParseOrSemanticError as nativeParseOrSemanticError;
+impl ParseOrSemanticError {
+       #[allow(unused)]
+       pub(crate) fn to_native(&self) -> nativeParseOrSemanticError {
+               match self {
+                       ParseOrSemanticError::ParseError (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               nativeParseOrSemanticError::ParseError (
+                                       a_nonref.into_native(),
+                               )
+                       },
+                       ParseOrSemanticError::SemanticError (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               nativeParseOrSemanticError::SemanticError (
+                                       a_nonref.into_native(),
+                               )
+                       },
+               }
+       }
+       #[allow(unused)]
+       pub(crate) fn into_native(self) -> nativeParseOrSemanticError {
+               match self {
+                       ParseOrSemanticError::ParseError (mut a, ) => {
+                               nativeParseOrSemanticError::ParseError (
+                                       a.into_native(),
+                               )
+                       },
+                       ParseOrSemanticError::SemanticError (mut a, ) => {
+                               nativeParseOrSemanticError::SemanticError (
+                                       a.into_native(),
+                               )
+                       },
+               }
+       }
+       #[allow(unused)]
+       pub(crate) fn from_native(native: &nativeParseOrSemanticError) -> Self {
+               match native {
+                       nativeParseOrSemanticError::ParseError (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               ParseOrSemanticError::ParseError (
+                                       crate::lightning_invoice::ParseError::native_into(a_nonref),
+                               )
+                       },
+                       nativeParseOrSemanticError::SemanticError (ref a, ) => {
+                               let mut a_nonref = (*a).clone();
+                               ParseOrSemanticError::SemanticError (
+                                       crate::lightning_invoice::SemanticError::native_into(a_nonref),
+                               )
+                       },
+               }
+       }
+       #[allow(unused)]
+       pub(crate) fn native_into(native: nativeParseOrSemanticError) -> Self {
+               match native {
+                       nativeParseOrSemanticError::ParseError (mut a, ) => {
+                               ParseOrSemanticError::ParseError (
+                                       crate::lightning_invoice::ParseError::native_into(a),
+                               )
+                       },
+                       nativeParseOrSemanticError::SemanticError (mut a, ) => {
+                               ParseOrSemanticError::SemanticError (
+                                       crate::lightning_invoice::SemanticError::native_into(a),
+                               )
+                       },
+               }
+       }
+}
+/// Frees any resources used by the ParseOrSemanticError
+#[no_mangle]
+pub extern "C" fn ParseOrSemanticError_free(this_ptr: ParseOrSemanticError) { }
+/// Creates a copy of the ParseOrSemanticError
+#[no_mangle]
+pub extern "C" fn ParseOrSemanticError_clone(orig: &ParseOrSemanticError) -> ParseOrSemanticError {
+       orig.clone()
+}
+#[no_mangle]
+/// Utility method to constructs a new ParseError-variant ParseOrSemanticError
+pub extern "C" fn ParseOrSemanticError_parse_error(a: crate::lightning_invoice::ParseError) -> ParseOrSemanticError {
+       ParseOrSemanticError::ParseError(a, )
+}
+#[no_mangle]
+/// Utility method to constructs a new SemanticError-variant ParseOrSemanticError
+pub extern "C" fn ParseOrSemanticError_semantic_error(a: crate::lightning_invoice::SemanticError) -> ParseOrSemanticError {
+       ParseOrSemanticError::SemanticError(a, )
 }
 /// The maximum timestamp as [`Duration::as_secs`] since the Unix epoch allowed by [`BOLT 11`].
 ///