Update CI references to 0.0.122
[ldk-java] / src / main / jni / bindings.c.body
1 #include <jni.h>
2 // On OSX jlong (ie long long) is not equivalent to int64_t, so we override here
3 #define int64_t jlong
4 #include "org_ldk_impl_bindings.h"
5 #include <lightning.h>
6 #include <string.h>
7 #include <stdatomic.h>
8 #include <stdlib.h>
9
10 #define LIKELY(v) __builtin_expect(!!(v), 1)
11 #define UNLIKELY(v) __builtin_expect(!!(v), 0)
12
13 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
14 #define MALLOC(a, _) malloc(a)
15 #define FREE(p) if ((uint64_t)(p) > 4096) { free(p); }
16 #define CHECK_ACCESS(p)
17 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
18 #define DO_ASSERT(a) (void)(a)
19 #define CHECK(a)
20
21 static jmethodID ordinal_meth = NULL;
22 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class) {
23         ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
24         CHECK(ordinal_meth != NULL);
25 }
26
27 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
28 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
29 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
30 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
31
32 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
33 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
34 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
35
36 typedef jlongArray int64_tArray;
37 typedef jbyteArray int8_tArray;
38 typedef jshortArray int16_tArray;
39
40 static inline jstring str_ref_to_java(JNIEnv *env, const unsigned char* chars, size_t len) {
41         // Java uses "Modified UTF-8" rather than UTF-8. This requires special
42         // handling for codepoints above 0xFFFF, which get converted from four
43         // bytes to six. We don't know upfront how many codepoints in the string
44         // are above 0xFFFF, so we just allocate an extra 33% up front and waste a
45         // bit of space.
46         unsigned char* java_chars = MALLOC(len * 3 / 2 + 1, "str conv buf");
47         unsigned char* next_java_char = java_chars;
48         const unsigned char* next_in_char = chars;
49         const unsigned char* end = chars + len;
50         #define COPY_CHAR_TO_JAVA do { *next_java_char = *next_in_char; next_java_char++; next_in_char++; } while (0)
51
52         while (next_in_char < end) {
53                 if (!*next_in_char) break;
54                 if (!(*next_in_char & 0b10000000)) {
55                         COPY_CHAR_TO_JAVA;
56                 } else if ((*next_in_char & 0b11100000) == 0b11000000) {
57                         if (next_in_char + 2 > end) { CHECK(false); break; } // bad string
58                         COPY_CHAR_TO_JAVA;
59                         COPY_CHAR_TO_JAVA;
60                 } else if ((*next_in_char & 0b11110000) == 0b11100000) {
61                         if (next_in_char + 3 > end) { CHECK(false); break; } // bad string
62                         COPY_CHAR_TO_JAVA;
63                         COPY_CHAR_TO_JAVA;
64                         COPY_CHAR_TO_JAVA;
65                 } else if ((*next_in_char & 0b11111000) == 0b11110000) {
66                         if (next_in_char + 4 > end) { CHECK(false); break; } // bad string
67                         uint32_t codepoint = 0;
68                         codepoint |= (((uint32_t)*(next_in_char    )) & 0b00000111) << 18;
69                         codepoint |= (((uint32_t)*(next_in_char + 1)) & 0b00111111) << 12;
70                         codepoint |= (((uint32_t)*(next_in_char + 2)) & 0b00111111) << 6;
71                         codepoint |= (((uint32_t)*(next_in_char + 3)) & 0b00111111) << 0;
72                         codepoint -= 0x10000;
73                         *next_java_char = 0b11101101;
74                         next_java_char++;
75                         *next_java_char = 0b10100000 | ((codepoint >> 16) & 0b00001111);
76                         next_java_char++;
77                         *next_java_char = 0b10000000 | ((codepoint >> 10) & 0b00111111);
78                         next_java_char++;
79                         *next_java_char = 0b11101101;
80                         next_java_char++;
81                         *next_java_char = 0b10110000 | ((codepoint >>  6) & 0b00001111);
82                         next_java_char++;
83                         *next_java_char = 0b10000000 | ((codepoint >>  0) & 0b00111111);
84                         next_java_char++;
85                         next_in_char += 4;
86                 } else {
87                         // Bad string
88                         CHECK(false);
89                         break;
90                 }
91         }
92         *next_java_char = 0;
93         jstring ret = (*env)->NewStringUTF(env, java_chars);
94         FREE(java_chars);
95         return ret;
96 }
97 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
98         uint64_t str_len = (*env)->GetStringUTFLength(env, str);
99         // Java uses "Modified UTF-8" rather than UTF-8. This requires special
100         // handling for codepoints above 0xFFFF, which we implement below.
101         unsigned char* newchars = MALLOC(str_len, "String chars");
102         unsigned char* next_newchar = newchars;
103         uint64_t utf8_len = 0;
104
105         const unsigned char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
106         const unsigned char* next_char = jchars;
107         const unsigned char* end = jchars + str_len;
108
109         #define COPY_CHAR_FROM_JAVA do { *next_newchar = *next_char; next_newchar++; next_char++; utf8_len++; } while (0)
110
111         while (next_char < end) {
112                 if (!(*next_char & 0b10000000)) {
113                         CHECK(*next_char != 0); // Bad Modified UTF-8 string, but we'll just cut here
114                         COPY_CHAR_FROM_JAVA;
115                 } else if ((*next_char & 0b11100000) == 0b11000000) {
116                         if (next_char + 2 > end) { CHECK(false); break; } // bad string
117                         uint16_t codepoint = 0;
118                         codepoint |= (((uint16_t)(*next_char & 0x1f)) << 6);
119                         codepoint |= *(next_char + 1) & 0x3f;
120                         if (codepoint == 0) {
121                                 // We should really never get null codepoints, but java allows them.
122                                 // Just skip it.
123                                 next_char += 2;
124                         } else {
125                                 COPY_CHAR_FROM_JAVA;
126                                 COPY_CHAR_FROM_JAVA;
127                         }
128                 } else if ((*next_char & 0b11110000) == 0b11100000) {
129                         if (next_char + 3 > end) { CHECK(false); break; } // bad string
130                         if (*next_char == 0b11101101 && (*(next_char + 1) & 0b11110000) == 0b10100000) {
131                                 // Surrogate code unit shoul indicate we have a codepoint above
132                                 // 0xFFFF, which is where Modified UTF-8 and UTF-8 diverge.
133                                 if (next_char + 6 > end) { CHECK(false); break; } // bad string
134                                 CHECK(*(next_char + 3) == 0b11101101);
135                                 CHECK((*(next_char + 4) & 0b11110000) == 0b10110000);
136                                 // Calculate the codepoint per https://docs.oracle.com/javase/1.5.0/docs/guide/jni/spec/types.html#wp16542
137                                 uint32_t codepoint = 0x10000;
138                                 codepoint += ((((uint32_t)*(next_char + 1)) & 0x0f) << 16);
139                                 codepoint += ((((uint32_t)*(next_char + 2)) & 0x3f) << 10);
140                                 codepoint += ((((uint32_t)*(next_char + 4)) & 0x0f) <<  6);
141                                 codepoint +=  (((uint32_t)*(next_char + 5)) & 0x3f);
142                                 *next_newchar = 0b11110000 | ((codepoint >> 18) &    0b111);
143                                 next_newchar++;
144                                 *next_newchar = 0b10000000 | ((codepoint >> 12) & 0b111111);
145                                 next_newchar++;
146                                 *next_newchar = 0b10000000 | ((codepoint >>  6) & 0b111111);
147                                 next_newchar++;
148                                 *next_newchar = 0b10000000 | ( codepoint        & 0b111111);
149                                 next_newchar++;
150                                 next_char += 6;
151                                 utf8_len += 4;
152                         } else {
153                                 COPY_CHAR_FROM_JAVA;
154                                 COPY_CHAR_FROM_JAVA;
155                                 COPY_CHAR_FROM_JAVA;
156                         }
157                 } else {
158                         // Bad string
159                         CHECK(false);
160                         break;
161                 }
162         }
163         (*env)->ReleaseStringUTFChars(env, str, jchars);
164         LDKStr res = {
165                 .chars = newchars,
166                 .len = utf8_len,
167                 .chars_is_owned = true
168         };
169         return res;
170 }
171
172 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
173         return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
174 }
175 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) {
176         return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version()));
177 }
178 #include "version.c"
179 static jclass arr_of_B_clz = NULL;
180 static jclass String_clz = NULL;
181 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
182         arr_of_B_clz = (*env)->FindClass(env, "[B");
183         CHECK(arr_of_B_clz != NULL);
184         arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
185         String_clz = (*env)->FindClass(env, "java/lang/String");
186         CHECK(String_clz != NULL);
187         String_clz = (*env)->NewGlobalRef(env, String_clz);
188 }
189 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
190
191 static inline void* untag_ptr(uint64_t ptr) {
192         if (ptr < 4096) return (void*)ptr;
193         if (sizeof(void*) == 4) {
194                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
195                 return (void*)(uintptr_t)ptr;
196         } else {
197                 // For 64-bit systems, assume the top byte is used for tagging, then
198                 // use bit 9 ^ bit 10.
199                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
200                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
201 #ifdef LDK_DEBUG_BUILD
202                 // On debug builds we also use the 11th bit as a debug flag
203                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
204                 CHECK(tenth_bit != eleventh_bit);
205                 p ^= 1ULL << 53;
206 #endif
207                 return (void*)p;
208         }
209 }
210 static inline bool ptr_is_owned(uint64_t ptr) {
211         if(ptr < 4096) return true;
212         if (sizeof(void*) == 4) {
213                 return ptr & (1ULL << 32);
214         } else {
215                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
216                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
217 #ifdef LDK_DEBUG_BUILD
218                 // On debug builds we also use the 11th bit as a debug flag
219                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
220                 CHECK(tenth_bit != eleventh_bit);
221 #endif
222                 return (ninth_bit ^ tenth_bit) ? true : false;
223         }
224 }
225 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
226         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
227         if (sizeof(void*) == 4) {
228                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
229         } else {
230                 CHECK(sizeof(uintptr_t) == 8);
231                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
232                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
233 #ifdef LDK_DEBUG_BUILD
234                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
235                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
236                 CHECK(ninth_bit == tenth_bit);
237                 CHECK(ninth_bit == eleventh_bit);
238                 t ^= 1ULL << 53;
239 #endif
240                 CHECK(ptr_is_owned(t) == is_owned);
241                 CHECK(untag_ptr(t) == ptr);
242                 return t;
243         }
244 }
245
246 static inline LDKBlindedFailure LDKBlindedFailure_from_java(JNIEnv *env, jclass clz) {
247         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
248         if (UNLIKELY((*env)->ExceptionCheck(env))) {
249                 (*env)->ExceptionDescribe(env);
250                 (*env)->FatalError(env, "A call to BlindedFailure.ordinal() from rust threw an exception.");
251         }
252         switch (ord) {
253                 case 0: return LDKBlindedFailure_FromIntroductionNode;
254                 case 1: return LDKBlindedFailure_FromBlindedNode;
255         }
256         (*env)->FatalError(env, "A call to BlindedFailure.ordinal() from rust returned an invalid value.");
257         abort(); // Unreachable, but will let the compiler know we don't return here
258 }
259 static jclass BlindedFailure_class = NULL;
260 static jfieldID BlindedFailure_LDKBlindedFailure_FromIntroductionNode = NULL;
261 static jfieldID BlindedFailure_LDKBlindedFailure_FromBlindedNode = NULL;
262 JNIEXPORT void JNICALL Java_org_ldk_enums_BlindedFailure_init (JNIEnv *env, jclass clz) {
263         BlindedFailure_class = (*env)->NewGlobalRef(env, clz);
264         CHECK(BlindedFailure_class != NULL);
265         BlindedFailure_LDKBlindedFailure_FromIntroductionNode = (*env)->GetStaticFieldID(env, BlindedFailure_class, "LDKBlindedFailure_FromIntroductionNode", "Lorg/ldk/enums/BlindedFailure;");
266         CHECK(BlindedFailure_LDKBlindedFailure_FromIntroductionNode != NULL);
267         BlindedFailure_LDKBlindedFailure_FromBlindedNode = (*env)->GetStaticFieldID(env, BlindedFailure_class, "LDKBlindedFailure_FromBlindedNode", "Lorg/ldk/enums/BlindedFailure;");
268         CHECK(BlindedFailure_LDKBlindedFailure_FromBlindedNode != NULL);
269 }
270 static inline jclass LDKBlindedFailure_to_java(JNIEnv *env, LDKBlindedFailure val) {
271         switch (val) {
272                 case LDKBlindedFailure_FromIntroductionNode:
273                         return (*env)->GetStaticObjectField(env, BlindedFailure_class, BlindedFailure_LDKBlindedFailure_FromIntroductionNode);
274                 case LDKBlindedFailure_FromBlindedNode:
275                         return (*env)->GetStaticObjectField(env, BlindedFailure_class, BlindedFailure_LDKBlindedFailure_FromBlindedNode);
276                 default: abort();
277         }
278 }
279
280 static inline LDKBolt11SemanticError LDKBolt11SemanticError_from_java(JNIEnv *env, jclass clz) {
281         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
282         if (UNLIKELY((*env)->ExceptionCheck(env))) {
283                 (*env)->ExceptionDescribe(env);
284                 (*env)->FatalError(env, "A call to Bolt11SemanticError.ordinal() from rust threw an exception.");
285         }
286         switch (ord) {
287                 case 0: return LDKBolt11SemanticError_NoPaymentHash;
288                 case 1: return LDKBolt11SemanticError_MultiplePaymentHashes;
289                 case 2: return LDKBolt11SemanticError_NoDescription;
290                 case 3: return LDKBolt11SemanticError_MultipleDescriptions;
291                 case 4: return LDKBolt11SemanticError_NoPaymentSecret;
292                 case 5: return LDKBolt11SemanticError_MultiplePaymentSecrets;
293                 case 6: return LDKBolt11SemanticError_InvalidFeatures;
294                 case 7: return LDKBolt11SemanticError_InvalidRecoveryId;
295                 case 8: return LDKBolt11SemanticError_InvalidSignature;
296                 case 9: return LDKBolt11SemanticError_ImpreciseAmount;
297         }
298         (*env)->FatalError(env, "A call to Bolt11SemanticError.ordinal() from rust returned an invalid value.");
299         abort(); // Unreachable, but will let the compiler know we don't return here
300 }
301 static jclass Bolt11SemanticError_class = NULL;
302 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash = NULL;
303 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes = NULL;
304 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoDescription = NULL;
305 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions = NULL;
306 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret = NULL;
307 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets = NULL;
308 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures = NULL;
309 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId = NULL;
310 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature = NULL;
311 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount = NULL;
312 JNIEXPORT void JNICALL Java_org_ldk_enums_Bolt11SemanticError_init (JNIEnv *env, jclass clz) {
313         Bolt11SemanticError_class = (*env)->NewGlobalRef(env, clz);
314         CHECK(Bolt11SemanticError_class != NULL);
315         Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoPaymentHash", "Lorg/ldk/enums/Bolt11SemanticError;");
316         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash != NULL);
317         Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/Bolt11SemanticError;");
318         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes != NULL);
319         Bolt11SemanticError_LDKBolt11SemanticError_NoDescription = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoDescription", "Lorg/ldk/enums/Bolt11SemanticError;");
320         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoDescription != NULL);
321         Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultipleDescriptions", "Lorg/ldk/enums/Bolt11SemanticError;");
322         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions != NULL);
323         Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoPaymentSecret", "Lorg/ldk/enums/Bolt11SemanticError;");
324         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret != NULL);
325         Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/Bolt11SemanticError;");
326         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets != NULL);
327         Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidFeatures", "Lorg/ldk/enums/Bolt11SemanticError;");
328         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures != NULL);
329         Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidRecoveryId", "Lorg/ldk/enums/Bolt11SemanticError;");
330         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId != NULL);
331         Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidSignature", "Lorg/ldk/enums/Bolt11SemanticError;");
332         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature != NULL);
333         Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_ImpreciseAmount", "Lorg/ldk/enums/Bolt11SemanticError;");
334         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount != NULL);
335 }
336 static inline jclass LDKBolt11SemanticError_to_java(JNIEnv *env, LDKBolt11SemanticError val) {
337         switch (val) {
338                 case LDKBolt11SemanticError_NoPaymentHash:
339                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash);
340                 case LDKBolt11SemanticError_MultiplePaymentHashes:
341                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes);
342                 case LDKBolt11SemanticError_NoDescription:
343                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoDescription);
344                 case LDKBolt11SemanticError_MultipleDescriptions:
345                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions);
346                 case LDKBolt11SemanticError_NoPaymentSecret:
347                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret);
348                 case LDKBolt11SemanticError_MultiplePaymentSecrets:
349                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets);
350                 case LDKBolt11SemanticError_InvalidFeatures:
351                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures);
352                 case LDKBolt11SemanticError_InvalidRecoveryId:
353                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId);
354                 case LDKBolt11SemanticError_InvalidSignature:
355                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature);
356                 case LDKBolt11SemanticError_ImpreciseAmount:
357                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount);
358                 default: abort();
359         }
360 }
361
362 static inline LDKBolt12SemanticError LDKBolt12SemanticError_from_java(JNIEnv *env, jclass clz) {
363         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
364         if (UNLIKELY((*env)->ExceptionCheck(env))) {
365                 (*env)->ExceptionDescribe(env);
366                 (*env)->FatalError(env, "A call to Bolt12SemanticError.ordinal() from rust threw an exception.");
367         }
368         switch (ord) {
369                 case 0: return LDKBolt12SemanticError_AlreadyExpired;
370                 case 1: return LDKBolt12SemanticError_UnsupportedChain;
371                 case 2: return LDKBolt12SemanticError_UnexpectedChain;
372                 case 3: return LDKBolt12SemanticError_MissingAmount;
373                 case 4: return LDKBolt12SemanticError_InvalidAmount;
374                 case 5: return LDKBolt12SemanticError_InsufficientAmount;
375                 case 6: return LDKBolt12SemanticError_UnexpectedAmount;
376                 case 7: return LDKBolt12SemanticError_UnsupportedCurrency;
377                 case 8: return LDKBolt12SemanticError_UnknownRequiredFeatures;
378                 case 9: return LDKBolt12SemanticError_UnexpectedFeatures;
379                 case 10: return LDKBolt12SemanticError_MissingDescription;
380                 case 11: return LDKBolt12SemanticError_MissingSigningPubkey;
381                 case 12: return LDKBolt12SemanticError_InvalidSigningPubkey;
382                 case 13: return LDKBolt12SemanticError_UnexpectedSigningPubkey;
383                 case 14: return LDKBolt12SemanticError_MissingQuantity;
384                 case 15: return LDKBolt12SemanticError_InvalidQuantity;
385                 case 16: return LDKBolt12SemanticError_UnexpectedQuantity;
386                 case 17: return LDKBolt12SemanticError_InvalidMetadata;
387                 case 18: return LDKBolt12SemanticError_UnexpectedMetadata;
388                 case 19: return LDKBolt12SemanticError_MissingPayerMetadata;
389                 case 20: return LDKBolt12SemanticError_MissingPayerId;
390                 case 21: return LDKBolt12SemanticError_DuplicatePaymentId;
391                 case 22: return LDKBolt12SemanticError_MissingPaths;
392                 case 23: return LDKBolt12SemanticError_InvalidPayInfo;
393                 case 24: return LDKBolt12SemanticError_MissingCreationTime;
394                 case 25: return LDKBolt12SemanticError_MissingPaymentHash;
395                 case 26: return LDKBolt12SemanticError_MissingSignature;
396         }
397         (*env)->FatalError(env, "A call to Bolt12SemanticError.ordinal() from rust returned an invalid value.");
398         abort(); // Unreachable, but will let the compiler know we don't return here
399 }
400 static jclass Bolt12SemanticError_class = NULL;
401 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired = NULL;
402 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain = NULL;
403 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain = NULL;
404 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount = NULL;
405 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount = NULL;
406 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount = NULL;
407 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount = NULL;
408 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency = NULL;
409 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures = NULL;
410 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures = NULL;
411 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription = NULL;
412 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey = NULL;
413 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey = NULL;
414 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey = NULL;
415 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity = NULL;
416 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity = NULL;
417 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity = NULL;
418 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata = NULL;
419 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata = NULL;
420 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata = NULL;
421 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = NULL;
422 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId = NULL;
423 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = NULL;
424 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo = NULL;
425 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime = NULL;
426 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash = NULL;
427 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature = NULL;
428 JNIEXPORT void JNICALL Java_org_ldk_enums_Bolt12SemanticError_init (JNIEnv *env, jclass clz) {
429         Bolt12SemanticError_class = (*env)->NewGlobalRef(env, clz);
430         CHECK(Bolt12SemanticError_class != NULL);
431         Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_AlreadyExpired", "Lorg/ldk/enums/Bolt12SemanticError;");
432         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired != NULL);
433         Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnsupportedChain", "Lorg/ldk/enums/Bolt12SemanticError;");
434         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain != NULL);
435         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedChain", "Lorg/ldk/enums/Bolt12SemanticError;");
436         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain != NULL);
437         Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
438         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount != NULL);
439         Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
440         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount != NULL);
441         Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InsufficientAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
442         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount != NULL);
443         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
444         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount != NULL);
445         Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnsupportedCurrency", "Lorg/ldk/enums/Bolt12SemanticError;");
446         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency != NULL);
447         Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnknownRequiredFeatures", "Lorg/ldk/enums/Bolt12SemanticError;");
448         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures != NULL);
449         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedFeatures", "Lorg/ldk/enums/Bolt12SemanticError;");
450         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures != NULL);
451         Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingDescription", "Lorg/ldk/enums/Bolt12SemanticError;");
452         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription != NULL);
453         Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
454         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey != NULL);
455         Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
456         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey != NULL);
457         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
458         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey != NULL);
459         Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
460         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity != NULL);
461         Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
462         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity != NULL);
463         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
464         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity != NULL);
465         Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
466         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata != NULL);
467         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
468         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata != NULL);
469         Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPayerMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
470         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata != NULL);
471         Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPayerId", "Lorg/ldk/enums/Bolt12SemanticError;");
472         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId != NULL);
473         Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_DuplicatePaymentId", "Lorg/ldk/enums/Bolt12SemanticError;");
474         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId != NULL);
475         Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPaths", "Lorg/ldk/enums/Bolt12SemanticError;");
476         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths != NULL);
477         Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidPayInfo", "Lorg/ldk/enums/Bolt12SemanticError;");
478         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo != NULL);
479         Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingCreationTime", "Lorg/ldk/enums/Bolt12SemanticError;");
480         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime != NULL);
481         Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPaymentHash", "Lorg/ldk/enums/Bolt12SemanticError;");
482         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash != NULL);
483         Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingSignature", "Lorg/ldk/enums/Bolt12SemanticError;");
484         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature != NULL);
485 }
486 static inline jclass LDKBolt12SemanticError_to_java(JNIEnv *env, LDKBolt12SemanticError val) {
487         switch (val) {
488                 case LDKBolt12SemanticError_AlreadyExpired:
489                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired);
490                 case LDKBolt12SemanticError_UnsupportedChain:
491                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain);
492                 case LDKBolt12SemanticError_UnexpectedChain:
493                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain);
494                 case LDKBolt12SemanticError_MissingAmount:
495                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount);
496                 case LDKBolt12SemanticError_InvalidAmount:
497                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount);
498                 case LDKBolt12SemanticError_InsufficientAmount:
499                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount);
500                 case LDKBolt12SemanticError_UnexpectedAmount:
501                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount);
502                 case LDKBolt12SemanticError_UnsupportedCurrency:
503                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency);
504                 case LDKBolt12SemanticError_UnknownRequiredFeatures:
505                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures);
506                 case LDKBolt12SemanticError_UnexpectedFeatures:
507                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures);
508                 case LDKBolt12SemanticError_MissingDescription:
509                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription);
510                 case LDKBolt12SemanticError_MissingSigningPubkey:
511                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey);
512                 case LDKBolt12SemanticError_InvalidSigningPubkey:
513                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey);
514                 case LDKBolt12SemanticError_UnexpectedSigningPubkey:
515                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey);
516                 case LDKBolt12SemanticError_MissingQuantity:
517                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity);
518                 case LDKBolt12SemanticError_InvalidQuantity:
519                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity);
520                 case LDKBolt12SemanticError_UnexpectedQuantity:
521                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity);
522                 case LDKBolt12SemanticError_InvalidMetadata:
523                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata);
524                 case LDKBolt12SemanticError_UnexpectedMetadata:
525                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata);
526                 case LDKBolt12SemanticError_MissingPayerMetadata:
527                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata);
528                 case LDKBolt12SemanticError_MissingPayerId:
529                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId);
530                 case LDKBolt12SemanticError_DuplicatePaymentId:
531                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId);
532                 case LDKBolt12SemanticError_MissingPaths:
533                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths);
534                 case LDKBolt12SemanticError_InvalidPayInfo:
535                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo);
536                 case LDKBolt12SemanticError_MissingCreationTime:
537                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime);
538                 case LDKBolt12SemanticError_MissingPaymentHash:
539                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash);
540                 case LDKBolt12SemanticError_MissingSignature:
541                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature);
542                 default: abort();
543         }
544 }
545
546 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_java(JNIEnv *env, jclass clz) {
547         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
548         if (UNLIKELY((*env)->ExceptionCheck(env))) {
549                 (*env)->ExceptionDescribe(env);
550                 (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust threw an exception.");
551         }
552         switch (ord) {
553                 case 0: return LDKCOption_NoneZ_Some;
554                 case 1: return LDKCOption_NoneZ_None;
555         }
556         (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust returned an invalid value.");
557         abort(); // Unreachable, but will let the compiler know we don't return here
558 }
559 static jclass COption_NoneZ_class = NULL;
560 static jfieldID COption_NoneZ_LDKCOption_NoneZ_Some = NULL;
561 static jfieldID COption_NoneZ_LDKCOption_NoneZ_None = NULL;
562 JNIEXPORT void JNICALL Java_org_ldk_enums_COption_1NoneZ_init (JNIEnv *env, jclass clz) {
563         COption_NoneZ_class = (*env)->NewGlobalRef(env, clz);
564         CHECK(COption_NoneZ_class != NULL);
565         COption_NoneZ_LDKCOption_NoneZ_Some = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_Some", "Lorg/ldk/enums/COption_NoneZ;");
566         CHECK(COption_NoneZ_LDKCOption_NoneZ_Some != NULL);
567         COption_NoneZ_LDKCOption_NoneZ_None = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_None", "Lorg/ldk/enums/COption_NoneZ;");
568         CHECK(COption_NoneZ_LDKCOption_NoneZ_None != NULL);
569 }
570 static inline jclass LDKCOption_NoneZ_to_java(JNIEnv *env, LDKCOption_NoneZ val) {
571         switch (val) {
572                 case LDKCOption_NoneZ_Some:
573                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_Some);
574                 case LDKCOption_NoneZ_None:
575                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_None);
576                 default: abort();
577         }
578 }
579
580 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_java(JNIEnv *env, jclass clz) {
581         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
582         if (UNLIKELY((*env)->ExceptionCheck(env))) {
583                 (*env)->ExceptionDescribe(env);
584                 (*env)->FatalError(env, "A call to ChannelMonitorUpdateStatus.ordinal() from rust threw an exception.");
585         }
586         switch (ord) {
587                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
588                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
589                 case 2: return LDKChannelMonitorUpdateStatus_UnrecoverableError;
590         }
591         (*env)->FatalError(env, "A call to ChannelMonitorUpdateStatus.ordinal() from rust returned an invalid value.");
592         abort(); // Unreachable, but will let the compiler know we don't return here
593 }
594 static jclass ChannelMonitorUpdateStatus_class = NULL;
595 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = NULL;
596 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = NULL;
597 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError = NULL;
598 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateStatus_init (JNIEnv *env, jclass clz) {
599         ChannelMonitorUpdateStatus_class = (*env)->NewGlobalRef(env, clz);
600         CHECK(ChannelMonitorUpdateStatus_class != NULL);
601         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_Completed", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
602         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed != NULL);
603         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_InProgress", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
604         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress != NULL);
605         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_UnrecoverableError", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
606         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError != NULL);
607 }
608 static inline jclass LDKChannelMonitorUpdateStatus_to_java(JNIEnv *env, LDKChannelMonitorUpdateStatus val) {
609         switch (val) {
610                 case LDKChannelMonitorUpdateStatus_Completed:
611                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed);
612                 case LDKChannelMonitorUpdateStatus_InProgress:
613                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress);
614                 case LDKChannelMonitorUpdateStatus_UnrecoverableError:
615                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError);
616                 default: abort();
617         }
618 }
619
620 static inline LDKChannelShutdownState LDKChannelShutdownState_from_java(JNIEnv *env, jclass clz) {
621         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
622         if (UNLIKELY((*env)->ExceptionCheck(env))) {
623                 (*env)->ExceptionDescribe(env);
624                 (*env)->FatalError(env, "A call to ChannelShutdownState.ordinal() from rust threw an exception.");
625         }
626         switch (ord) {
627                 case 0: return LDKChannelShutdownState_NotShuttingDown;
628                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
629                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
630                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
631                 case 4: return LDKChannelShutdownState_ShutdownComplete;
632         }
633         (*env)->FatalError(env, "A call to ChannelShutdownState.ordinal() from rust returned an invalid value.");
634         abort(); // Unreachable, but will let the compiler know we don't return here
635 }
636 static jclass ChannelShutdownState_class = NULL;
637 static jfieldID ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown = NULL;
638 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated = NULL;
639 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs = NULL;
640 static jfieldID ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee = NULL;
641 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete = NULL;
642 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelShutdownState_init (JNIEnv *env, jclass clz) {
643         ChannelShutdownState_class = (*env)->NewGlobalRef(env, clz);
644         CHECK(ChannelShutdownState_class != NULL);
645         ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_NotShuttingDown", "Lorg/ldk/enums/ChannelShutdownState;");
646         CHECK(ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown != NULL);
647         ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ShutdownInitiated", "Lorg/ldk/enums/ChannelShutdownState;");
648         CHECK(ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated != NULL);
649         ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ResolvingHTLCs", "Lorg/ldk/enums/ChannelShutdownState;");
650         CHECK(ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs != NULL);
651         ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_NegotiatingClosingFee", "Lorg/ldk/enums/ChannelShutdownState;");
652         CHECK(ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee != NULL);
653         ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ShutdownComplete", "Lorg/ldk/enums/ChannelShutdownState;");
654         CHECK(ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete != NULL);
655 }
656 static inline jclass LDKChannelShutdownState_to_java(JNIEnv *env, LDKChannelShutdownState val) {
657         switch (val) {
658                 case LDKChannelShutdownState_NotShuttingDown:
659                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown);
660                 case LDKChannelShutdownState_ShutdownInitiated:
661                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated);
662                 case LDKChannelShutdownState_ResolvingHTLCs:
663                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs);
664                 case LDKChannelShutdownState_NegotiatingClosingFee:
665                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee);
666                 case LDKChannelShutdownState_ShutdownComplete:
667                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete);
668                 default: abort();
669         }
670 }
671
672 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
673         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
674         if (UNLIKELY((*env)->ExceptionCheck(env))) {
675                 (*env)->ExceptionDescribe(env);
676                 (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust threw an exception.");
677         }
678         switch (ord) {
679                 case 0: return LDKConfirmationTarget_OnChainSweep;
680                 case 1: return LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee;
681                 case 2: return LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee;
682                 case 3: return LDKConfirmationTarget_AnchorChannelFee;
683                 case 4: return LDKConfirmationTarget_NonAnchorChannelFee;
684                 case 5: return LDKConfirmationTarget_ChannelCloseMinimum;
685         }
686         (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust returned an invalid value.");
687         abort(); // Unreachable, but will let the compiler know we don't return here
688 }
689 static jclass ConfirmationTarget_class = NULL;
690 static jfieldID ConfirmationTarget_LDKConfirmationTarget_OnChainSweep = NULL;
691 static jfieldID ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee = NULL;
692 static jfieldID ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee = NULL;
693 static jfieldID ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee = NULL;
694 static jfieldID ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee = NULL;
695 static jfieldID ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum = NULL;
696 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
697         ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
698         CHECK(ConfirmationTarget_class != NULL);
699         ConfirmationTarget_LDKConfirmationTarget_OnChainSweep = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_OnChainSweep", "Lorg/ldk/enums/ConfirmationTarget;");
700         CHECK(ConfirmationTarget_LDKConfirmationTarget_OnChainSweep != NULL);
701         ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee", "Lorg/ldk/enums/ConfirmationTarget;");
702         CHECK(ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee != NULL);
703         ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee", "Lorg/ldk/enums/ConfirmationTarget;");
704         CHECK(ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee != NULL);
705         ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_AnchorChannelFee", "Lorg/ldk/enums/ConfirmationTarget;");
706         CHECK(ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee != NULL);
707         ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_NonAnchorChannelFee", "Lorg/ldk/enums/ConfirmationTarget;");
708         CHECK(ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee != NULL);
709         ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_ChannelCloseMinimum", "Lorg/ldk/enums/ConfirmationTarget;");
710         CHECK(ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum != NULL);
711 }
712 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
713         switch (val) {
714                 case LDKConfirmationTarget_OnChainSweep:
715                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_OnChainSweep);
716                 case LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee:
717                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee);
718                 case LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee:
719                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee);
720                 case LDKConfirmationTarget_AnchorChannelFee:
721                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee);
722                 case LDKConfirmationTarget_NonAnchorChannelFee:
723                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee);
724                 case LDKConfirmationTarget_ChannelCloseMinimum:
725                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum);
726                 default: abort();
727         }
728 }
729
730 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
731         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
732         if (UNLIKELY((*env)->ExceptionCheck(env))) {
733                 (*env)->ExceptionDescribe(env);
734                 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust threw an exception.");
735         }
736         switch (ord) {
737                 case 0: return LDKCreationError_DescriptionTooLong;
738                 case 1: return LDKCreationError_RouteTooLong;
739                 case 2: return LDKCreationError_TimestampOutOfBounds;
740                 case 3: return LDKCreationError_InvalidAmount;
741                 case 4: return LDKCreationError_MissingRouteHints;
742                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
743         }
744         (*env)->FatalError(env, "A call to CreationError.ordinal() from rust returned an invalid value.");
745         abort(); // Unreachable, but will let the compiler know we don't return here
746 }
747 static jclass CreationError_class = NULL;
748 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
749 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
750 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
751 static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL;
752 static jfieldID CreationError_LDKCreationError_MissingRouteHints = NULL;
753 static jfieldID CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = NULL;
754 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
755         CreationError_class = (*env)->NewGlobalRef(env, clz);
756         CHECK(CreationError_class != NULL);
757         CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
758         CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
759         CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
760         CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
761         CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
762         CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
763         CreationError_LDKCreationError_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;");
764         CHECK(CreationError_LDKCreationError_InvalidAmount != NULL);
765         CreationError_LDKCreationError_MissingRouteHints = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MissingRouteHints", "Lorg/ldk/enums/CreationError;");
766         CHECK(CreationError_LDKCreationError_MissingRouteHints != NULL);
767         CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MinFinalCltvExpiryDeltaTooShort", "Lorg/ldk/enums/CreationError;");
768         CHECK(CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort != NULL);
769 }
770 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
771         switch (val) {
772                 case LDKCreationError_DescriptionTooLong:
773                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
774                 case LDKCreationError_RouteTooLong:
775                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
776                 case LDKCreationError_TimestampOutOfBounds:
777                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
778                 case LDKCreationError_InvalidAmount:
779                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount);
780                 case LDKCreationError_MissingRouteHints:
781                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MissingRouteHints);
782                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort:
783                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort);
784                 default: abort();
785         }
786 }
787
788 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
789         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
790         if (UNLIKELY((*env)->ExceptionCheck(env))) {
791                 (*env)->ExceptionDescribe(env);
792                 (*env)->FatalError(env, "A call to Currency.ordinal() from rust threw an exception.");
793         }
794         switch (ord) {
795                 case 0: return LDKCurrency_Bitcoin;
796                 case 1: return LDKCurrency_BitcoinTestnet;
797                 case 2: return LDKCurrency_Regtest;
798                 case 3: return LDKCurrency_Simnet;
799                 case 4: return LDKCurrency_Signet;
800         }
801         (*env)->FatalError(env, "A call to Currency.ordinal() from rust returned an invalid value.");
802         abort(); // Unreachable, but will let the compiler know we don't return here
803 }
804 static jclass Currency_class = NULL;
805 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
806 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
807 static jfieldID Currency_LDKCurrency_Regtest = NULL;
808 static jfieldID Currency_LDKCurrency_Simnet = NULL;
809 static jfieldID Currency_LDKCurrency_Signet = NULL;
810 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
811         Currency_class = (*env)->NewGlobalRef(env, clz);
812         CHECK(Currency_class != NULL);
813         Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
814         CHECK(Currency_LDKCurrency_Bitcoin != NULL);
815         Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
816         CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
817         Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
818         CHECK(Currency_LDKCurrency_Regtest != NULL);
819         Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
820         CHECK(Currency_LDKCurrency_Simnet != NULL);
821         Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
822         CHECK(Currency_LDKCurrency_Signet != NULL);
823 }
824 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
825         switch (val) {
826                 case LDKCurrency_Bitcoin:
827                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
828                 case LDKCurrency_BitcoinTestnet:
829                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
830                 case LDKCurrency_Regtest:
831                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
832                 case LDKCurrency_Simnet:
833                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
834                 case LDKCurrency_Signet:
835                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
836                 default: abort();
837         }
838 }
839
840 static inline LDKHTLCClaim LDKHTLCClaim_from_java(JNIEnv *env, jclass clz) {
841         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
842         if (UNLIKELY((*env)->ExceptionCheck(env))) {
843                 (*env)->ExceptionDescribe(env);
844                 (*env)->FatalError(env, "A call to HTLCClaim.ordinal() from rust threw an exception.");
845         }
846         switch (ord) {
847                 case 0: return LDKHTLCClaim_OfferedTimeout;
848                 case 1: return LDKHTLCClaim_OfferedPreimage;
849                 case 2: return LDKHTLCClaim_AcceptedTimeout;
850                 case 3: return LDKHTLCClaim_AcceptedPreimage;
851                 case 4: return LDKHTLCClaim_Revocation;
852         }
853         (*env)->FatalError(env, "A call to HTLCClaim.ordinal() from rust returned an invalid value.");
854         abort(); // Unreachable, but will let the compiler know we don't return here
855 }
856 static jclass HTLCClaim_class = NULL;
857 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedTimeout = NULL;
858 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedPreimage = NULL;
859 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedTimeout = NULL;
860 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedPreimage = NULL;
861 static jfieldID HTLCClaim_LDKHTLCClaim_Revocation = NULL;
862 JNIEXPORT void JNICALL Java_org_ldk_enums_HTLCClaim_init (JNIEnv *env, jclass clz) {
863         HTLCClaim_class = (*env)->NewGlobalRef(env, clz);
864         CHECK(HTLCClaim_class != NULL);
865         HTLCClaim_LDKHTLCClaim_OfferedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedTimeout", "Lorg/ldk/enums/HTLCClaim;");
866         CHECK(HTLCClaim_LDKHTLCClaim_OfferedTimeout != NULL);
867         HTLCClaim_LDKHTLCClaim_OfferedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedPreimage", "Lorg/ldk/enums/HTLCClaim;");
868         CHECK(HTLCClaim_LDKHTLCClaim_OfferedPreimage != NULL);
869         HTLCClaim_LDKHTLCClaim_AcceptedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedTimeout", "Lorg/ldk/enums/HTLCClaim;");
870         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedTimeout != NULL);
871         HTLCClaim_LDKHTLCClaim_AcceptedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedPreimage", "Lorg/ldk/enums/HTLCClaim;");
872         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedPreimage != NULL);
873         HTLCClaim_LDKHTLCClaim_Revocation = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_Revocation", "Lorg/ldk/enums/HTLCClaim;");
874         CHECK(HTLCClaim_LDKHTLCClaim_Revocation != NULL);
875 }
876 static inline jclass LDKHTLCClaim_to_java(JNIEnv *env, LDKHTLCClaim val) {
877         switch (val) {
878                 case LDKHTLCClaim_OfferedTimeout:
879                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedTimeout);
880                 case LDKHTLCClaim_OfferedPreimage:
881                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedPreimage);
882                 case LDKHTLCClaim_AcceptedTimeout:
883                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedTimeout);
884                 case LDKHTLCClaim_AcceptedPreimage:
885                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedPreimage);
886                 case LDKHTLCClaim_Revocation:
887                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_Revocation);
888                 default: abort();
889         }
890 }
891
892 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
893         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
894         if (UNLIKELY((*env)->ExceptionCheck(env))) {
895                 (*env)->ExceptionDescribe(env);
896                 (*env)->FatalError(env, "A call to IOError.ordinal() from rust threw an exception.");
897         }
898         switch (ord) {
899                 case 0: return LDKIOError_NotFound;
900                 case 1: return LDKIOError_PermissionDenied;
901                 case 2: return LDKIOError_ConnectionRefused;
902                 case 3: return LDKIOError_ConnectionReset;
903                 case 4: return LDKIOError_ConnectionAborted;
904                 case 5: return LDKIOError_NotConnected;
905                 case 6: return LDKIOError_AddrInUse;
906                 case 7: return LDKIOError_AddrNotAvailable;
907                 case 8: return LDKIOError_BrokenPipe;
908                 case 9: return LDKIOError_AlreadyExists;
909                 case 10: return LDKIOError_WouldBlock;
910                 case 11: return LDKIOError_InvalidInput;
911                 case 12: return LDKIOError_InvalidData;
912                 case 13: return LDKIOError_TimedOut;
913                 case 14: return LDKIOError_WriteZero;
914                 case 15: return LDKIOError_Interrupted;
915                 case 16: return LDKIOError_Other;
916                 case 17: return LDKIOError_UnexpectedEof;
917         }
918         (*env)->FatalError(env, "A call to IOError.ordinal() from rust returned an invalid value.");
919         abort(); // Unreachable, but will let the compiler know we don't return here
920 }
921 static jclass IOError_class = NULL;
922 static jfieldID IOError_LDKIOError_NotFound = NULL;
923 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
924 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
925 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
926 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
927 static jfieldID IOError_LDKIOError_NotConnected = NULL;
928 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
929 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
930 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
931 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
932 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
933 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
934 static jfieldID IOError_LDKIOError_InvalidData = NULL;
935 static jfieldID IOError_LDKIOError_TimedOut = NULL;
936 static jfieldID IOError_LDKIOError_WriteZero = NULL;
937 static jfieldID IOError_LDKIOError_Interrupted = NULL;
938 static jfieldID IOError_LDKIOError_Other = NULL;
939 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
940 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
941         IOError_class = (*env)->NewGlobalRef(env, clz);
942         CHECK(IOError_class != NULL);
943         IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
944         CHECK(IOError_LDKIOError_NotFound != NULL);
945         IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
946         CHECK(IOError_LDKIOError_PermissionDenied != NULL);
947         IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
948         CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
949         IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
950         CHECK(IOError_LDKIOError_ConnectionReset != NULL);
951         IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
952         CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
953         IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
954         CHECK(IOError_LDKIOError_NotConnected != NULL);
955         IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
956         CHECK(IOError_LDKIOError_AddrInUse != NULL);
957         IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
958         CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
959         IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
960         CHECK(IOError_LDKIOError_BrokenPipe != NULL);
961         IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
962         CHECK(IOError_LDKIOError_AlreadyExists != NULL);
963         IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
964         CHECK(IOError_LDKIOError_WouldBlock != NULL);
965         IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
966         CHECK(IOError_LDKIOError_InvalidInput != NULL);
967         IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
968         CHECK(IOError_LDKIOError_InvalidData != NULL);
969         IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
970         CHECK(IOError_LDKIOError_TimedOut != NULL);
971         IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
972         CHECK(IOError_LDKIOError_WriteZero != NULL);
973         IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
974         CHECK(IOError_LDKIOError_Interrupted != NULL);
975         IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
976         CHECK(IOError_LDKIOError_Other != NULL);
977         IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
978         CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
979 }
980 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
981         switch (val) {
982                 case LDKIOError_NotFound:
983                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
984                 case LDKIOError_PermissionDenied:
985                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
986                 case LDKIOError_ConnectionRefused:
987                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
988                 case LDKIOError_ConnectionReset:
989                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
990                 case LDKIOError_ConnectionAborted:
991                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
992                 case LDKIOError_NotConnected:
993                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
994                 case LDKIOError_AddrInUse:
995                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
996                 case LDKIOError_AddrNotAvailable:
997                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
998                 case LDKIOError_BrokenPipe:
999                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
1000                 case LDKIOError_AlreadyExists:
1001                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
1002                 case LDKIOError_WouldBlock:
1003                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
1004                 case LDKIOError_InvalidInput:
1005                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
1006                 case LDKIOError_InvalidData:
1007                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
1008                 case LDKIOError_TimedOut:
1009                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
1010                 case LDKIOError_WriteZero:
1011                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
1012                 case LDKIOError_Interrupted:
1013                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
1014                 case LDKIOError_Other:
1015                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
1016                 case LDKIOError_UnexpectedEof:
1017                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
1018                 default: abort();
1019         }
1020 }
1021
1022 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
1023         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1024         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1025                 (*env)->ExceptionDescribe(env);
1026                 (*env)->FatalError(env, "A call to Level.ordinal() from rust threw an exception.");
1027         }
1028         switch (ord) {
1029                 case 0: return LDKLevel_Gossip;
1030                 case 1: return LDKLevel_Trace;
1031                 case 2: return LDKLevel_Debug;
1032                 case 3: return LDKLevel_Info;
1033                 case 4: return LDKLevel_Warn;
1034                 case 5: return LDKLevel_Error;
1035         }
1036         (*env)->FatalError(env, "A call to Level.ordinal() from rust returned an invalid value.");
1037         abort(); // Unreachable, but will let the compiler know we don't return here
1038 }
1039 static jclass Level_class = NULL;
1040 static jfieldID Level_LDKLevel_Gossip = NULL;
1041 static jfieldID Level_LDKLevel_Trace = NULL;
1042 static jfieldID Level_LDKLevel_Debug = NULL;
1043 static jfieldID Level_LDKLevel_Info = NULL;
1044 static jfieldID Level_LDKLevel_Warn = NULL;
1045 static jfieldID Level_LDKLevel_Error = NULL;
1046 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
1047         Level_class = (*env)->NewGlobalRef(env, clz);
1048         CHECK(Level_class != NULL);
1049         Level_LDKLevel_Gossip = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Gossip", "Lorg/ldk/enums/Level;");
1050         CHECK(Level_LDKLevel_Gossip != NULL);
1051         Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
1052         CHECK(Level_LDKLevel_Trace != NULL);
1053         Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
1054         CHECK(Level_LDKLevel_Debug != NULL);
1055         Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
1056         CHECK(Level_LDKLevel_Info != NULL);
1057         Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
1058         CHECK(Level_LDKLevel_Warn != NULL);
1059         Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
1060         CHECK(Level_LDKLevel_Error != NULL);
1061 }
1062 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
1063         switch (val) {
1064                 case LDKLevel_Gossip:
1065                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Gossip);
1066                 case LDKLevel_Trace:
1067                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
1068                 case LDKLevel_Debug:
1069                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
1070                 case LDKLevel_Info:
1071                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
1072                 case LDKLevel_Warn:
1073                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
1074                 case LDKLevel_Error:
1075                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
1076                 default: abort();
1077         }
1078 }
1079
1080 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
1081         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1082         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1083                 (*env)->ExceptionDescribe(env);
1084                 (*env)->FatalError(env, "A call to Network.ordinal() from rust threw an exception.");
1085         }
1086         switch (ord) {
1087                 case 0: return LDKNetwork_Bitcoin;
1088                 case 1: return LDKNetwork_Testnet;
1089                 case 2: return LDKNetwork_Regtest;
1090                 case 3: return LDKNetwork_Signet;
1091         }
1092         (*env)->FatalError(env, "A call to Network.ordinal() from rust returned an invalid value.");
1093         abort(); // Unreachable, but will let the compiler know we don't return here
1094 }
1095 static jclass Network_class = NULL;
1096 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
1097 static jfieldID Network_LDKNetwork_Testnet = NULL;
1098 static jfieldID Network_LDKNetwork_Regtest = NULL;
1099 static jfieldID Network_LDKNetwork_Signet = NULL;
1100 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
1101         Network_class = (*env)->NewGlobalRef(env, clz);
1102         CHECK(Network_class != NULL);
1103         Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
1104         CHECK(Network_LDKNetwork_Bitcoin != NULL);
1105         Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
1106         CHECK(Network_LDKNetwork_Testnet != NULL);
1107         Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
1108         CHECK(Network_LDKNetwork_Regtest != NULL);
1109         Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
1110         CHECK(Network_LDKNetwork_Signet != NULL);
1111 }
1112 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
1113         switch (val) {
1114                 case LDKNetwork_Bitcoin:
1115                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
1116                 case LDKNetwork_Testnet:
1117                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
1118                 case LDKNetwork_Regtest:
1119                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
1120                 case LDKNetwork_Signet:
1121                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
1122                 default: abort();
1123         }
1124 }
1125
1126 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_java(JNIEnv *env, jclass clz) {
1127         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1128         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1129                 (*env)->ExceptionDescribe(env);
1130                 (*env)->FatalError(env, "A call to PaymentFailureReason.ordinal() from rust threw an exception.");
1131         }
1132         switch (ord) {
1133                 case 0: return LDKPaymentFailureReason_RecipientRejected;
1134                 case 1: return LDKPaymentFailureReason_UserAbandoned;
1135                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
1136                 case 3: return LDKPaymentFailureReason_PaymentExpired;
1137                 case 4: return LDKPaymentFailureReason_RouteNotFound;
1138                 case 5: return LDKPaymentFailureReason_UnexpectedError;
1139         }
1140         (*env)->FatalError(env, "A call to PaymentFailureReason.ordinal() from rust returned an invalid value.");
1141         abort(); // Unreachable, but will let the compiler know we don't return here
1142 }
1143 static jclass PaymentFailureReason_class = NULL;
1144 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected = NULL;
1145 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned = NULL;
1146 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted = NULL;
1147 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired = NULL;
1148 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound = NULL;
1149 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError = NULL;
1150 JNIEXPORT void JNICALL Java_org_ldk_enums_PaymentFailureReason_init (JNIEnv *env, jclass clz) {
1151         PaymentFailureReason_class = (*env)->NewGlobalRef(env, clz);
1152         CHECK(PaymentFailureReason_class != NULL);
1153         PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RecipientRejected", "Lorg/ldk/enums/PaymentFailureReason;");
1154         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected != NULL);
1155         PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_UserAbandoned", "Lorg/ldk/enums/PaymentFailureReason;");
1156         CHECK(PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned != NULL);
1157         PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RetriesExhausted", "Lorg/ldk/enums/PaymentFailureReason;");
1158         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted != NULL);
1159         PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_PaymentExpired", "Lorg/ldk/enums/PaymentFailureReason;");
1160         CHECK(PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired != NULL);
1161         PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RouteNotFound", "Lorg/ldk/enums/PaymentFailureReason;");
1162         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound != NULL);
1163         PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_UnexpectedError", "Lorg/ldk/enums/PaymentFailureReason;");
1164         CHECK(PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError != NULL);
1165 }
1166 static inline jclass LDKPaymentFailureReason_to_java(JNIEnv *env, LDKPaymentFailureReason val) {
1167         switch (val) {
1168                 case LDKPaymentFailureReason_RecipientRejected:
1169                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected);
1170                 case LDKPaymentFailureReason_UserAbandoned:
1171                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned);
1172                 case LDKPaymentFailureReason_RetriesExhausted:
1173                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted);
1174                 case LDKPaymentFailureReason_PaymentExpired:
1175                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired);
1176                 case LDKPaymentFailureReason_RouteNotFound:
1177                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound);
1178                 case LDKPaymentFailureReason_UnexpectedError:
1179                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError);
1180                 default: abort();
1181         }
1182 }
1183
1184 static inline LDKRecipient LDKRecipient_from_java(JNIEnv *env, jclass clz) {
1185         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1186         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1187                 (*env)->ExceptionDescribe(env);
1188                 (*env)->FatalError(env, "A call to Recipient.ordinal() from rust threw an exception.");
1189         }
1190         switch (ord) {
1191                 case 0: return LDKRecipient_Node;
1192                 case 1: return LDKRecipient_PhantomNode;
1193         }
1194         (*env)->FatalError(env, "A call to Recipient.ordinal() from rust returned an invalid value.");
1195         abort(); // Unreachable, but will let the compiler know we don't return here
1196 }
1197 static jclass Recipient_class = NULL;
1198 static jfieldID Recipient_LDKRecipient_Node = NULL;
1199 static jfieldID Recipient_LDKRecipient_PhantomNode = NULL;
1200 JNIEXPORT void JNICALL Java_org_ldk_enums_Recipient_init (JNIEnv *env, jclass clz) {
1201         Recipient_class = (*env)->NewGlobalRef(env, clz);
1202         CHECK(Recipient_class != NULL);
1203         Recipient_LDKRecipient_Node = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_Node", "Lorg/ldk/enums/Recipient;");
1204         CHECK(Recipient_LDKRecipient_Node != NULL);
1205         Recipient_LDKRecipient_PhantomNode = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_PhantomNode", "Lorg/ldk/enums/Recipient;");
1206         CHECK(Recipient_LDKRecipient_PhantomNode != NULL);
1207 }
1208 static inline jclass LDKRecipient_to_java(JNIEnv *env, LDKRecipient val) {
1209         switch (val) {
1210                 case LDKRecipient_Node:
1211                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_Node);
1212                 case LDKRecipient_PhantomNode:
1213                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_PhantomNode);
1214                 default: abort();
1215         }
1216 }
1217
1218 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_java(JNIEnv *env, jclass clz) {
1219         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1220         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1221                 (*env)->ExceptionDescribe(env);
1222                 (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust threw an exception.");
1223         }
1224         switch (ord) {
1225                 case 0: return LDKRetryableSendFailure_PaymentExpired;
1226                 case 1: return LDKRetryableSendFailure_RouteNotFound;
1227                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
1228         }
1229         (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust returned an invalid value.");
1230         abort(); // Unreachable, but will let the compiler know we don't return here
1231 }
1232 static jclass RetryableSendFailure_class = NULL;
1233 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = NULL;
1234 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = NULL;
1235 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = NULL;
1236 JNIEXPORT void JNICALL Java_org_ldk_enums_RetryableSendFailure_init (JNIEnv *env, jclass clz) {
1237         RetryableSendFailure_class = (*env)->NewGlobalRef(env, clz);
1238         CHECK(RetryableSendFailure_class != NULL);
1239         RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_PaymentExpired", "Lorg/ldk/enums/RetryableSendFailure;");
1240         CHECK(RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired != NULL);
1241         RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_RouteNotFound", "Lorg/ldk/enums/RetryableSendFailure;");
1242         CHECK(RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound != NULL);
1243         RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_DuplicatePayment", "Lorg/ldk/enums/RetryableSendFailure;");
1244         CHECK(RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment != NULL);
1245 }
1246 static inline jclass LDKRetryableSendFailure_to_java(JNIEnv *env, LDKRetryableSendFailure val) {
1247         switch (val) {
1248                 case LDKRetryableSendFailure_PaymentExpired:
1249                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired);
1250                 case LDKRetryableSendFailure_RouteNotFound:
1251                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound);
1252                 case LDKRetryableSendFailure_DuplicatePayment:
1253                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment);
1254                 default: abort();
1255         }
1256 }
1257
1258 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
1259         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1260         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1261                 (*env)->ExceptionDescribe(env);
1262                 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust threw an exception.");
1263         }
1264         switch (ord) {
1265                 case 0: return LDKSecp256k1Error_IncorrectSignature;
1266                 case 1: return LDKSecp256k1Error_InvalidMessage;
1267                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
1268                 case 3: return LDKSecp256k1Error_InvalidSignature;
1269                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
1270                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
1271                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
1272                 case 7: return LDKSecp256k1Error_InvalidTweak;
1273                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
1274                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
1275                 case 10: return LDKSecp256k1Error_InvalidParityValue;
1276         }
1277         (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust returned an invalid value.");
1278         abort(); // Unreachable, but will let the compiler know we don't return here
1279 }
1280 static jclass Secp256k1Error_class = NULL;
1281 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
1282 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
1283 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
1284 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
1285 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
1286 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = NULL;
1287 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
1288 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
1289 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
1290 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = NULL;
1291 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = NULL;
1292 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
1293         Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
1294         CHECK(Secp256k1Error_class != NULL);
1295         Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
1296         CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
1297         Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
1298         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
1299         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
1300         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
1301         Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
1302         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
1303         Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
1304         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
1305         Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSharedSecret", "Lorg/ldk/enums/Secp256k1Error;");
1306         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret != NULL);
1307         Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
1308         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
1309         Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
1310         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
1311         Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
1312         CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
1313         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKeySum", "Lorg/ldk/enums/Secp256k1Error;");
1314         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum != NULL);
1315         Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidParityValue", "Lorg/ldk/enums/Secp256k1Error;");
1316         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidParityValue != NULL);
1317 }
1318 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
1319         switch (val) {
1320                 case LDKSecp256k1Error_IncorrectSignature:
1321                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
1322                 case LDKSecp256k1Error_InvalidMessage:
1323                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
1324                 case LDKSecp256k1Error_InvalidPublicKey:
1325                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
1326                 case LDKSecp256k1Error_InvalidSignature:
1327                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
1328                 case LDKSecp256k1Error_InvalidSecretKey:
1329                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
1330                 case LDKSecp256k1Error_InvalidSharedSecret:
1331                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret);
1332                 case LDKSecp256k1Error_InvalidRecoveryId:
1333                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
1334                 case LDKSecp256k1Error_InvalidTweak:
1335                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
1336                 case LDKSecp256k1Error_NotEnoughMemory:
1337                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
1338                 case LDKSecp256k1Error_InvalidPublicKeySum:
1339                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum);
1340                 case LDKSecp256k1Error_InvalidParityValue:
1341                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidParityValue);
1342                 default: abort();
1343         }
1344 }
1345
1346 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
1347         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1348         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1349                 (*env)->ExceptionDescribe(env);
1350                 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust threw an exception.");
1351         }
1352         switch (ord) {
1353                 case 0: return LDKSiPrefix_Milli;
1354                 case 1: return LDKSiPrefix_Micro;
1355                 case 2: return LDKSiPrefix_Nano;
1356                 case 3: return LDKSiPrefix_Pico;
1357         }
1358         (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust returned an invalid value.");
1359         abort(); // Unreachable, but will let the compiler know we don't return here
1360 }
1361 static jclass SiPrefix_class = NULL;
1362 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
1363 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
1364 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
1365 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
1366 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
1367         SiPrefix_class = (*env)->NewGlobalRef(env, clz);
1368         CHECK(SiPrefix_class != NULL);
1369         SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
1370         CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
1371         SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
1372         CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
1373         SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
1374         CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
1375         SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
1376         CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
1377 }
1378 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
1379         switch (val) {
1380                 case LDKSiPrefix_Milli:
1381                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
1382                 case LDKSiPrefix_Micro:
1383                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
1384                 case LDKSiPrefix_Nano:
1385                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
1386                 case LDKSiPrefix_Pico:
1387                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
1388                 default: abort();
1389         }
1390 }
1391
1392 static inline LDKSocketAddressParseError LDKSocketAddressParseError_from_java(JNIEnv *env, jclass clz) {
1393         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1394         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1395                 (*env)->ExceptionDescribe(env);
1396                 (*env)->FatalError(env, "A call to SocketAddressParseError.ordinal() from rust threw an exception.");
1397         }
1398         switch (ord) {
1399                 case 0: return LDKSocketAddressParseError_SocketAddrParse;
1400                 case 1: return LDKSocketAddressParseError_InvalidInput;
1401                 case 2: return LDKSocketAddressParseError_InvalidPort;
1402                 case 3: return LDKSocketAddressParseError_InvalidOnionV3;
1403         }
1404         (*env)->FatalError(env, "A call to SocketAddressParseError.ordinal() from rust returned an invalid value.");
1405         abort(); // Unreachable, but will let the compiler know we don't return here
1406 }
1407 static jclass SocketAddressParseError_class = NULL;
1408 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse = NULL;
1409 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidInput = NULL;
1410 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidPort = NULL;
1411 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 = NULL;
1412 JNIEXPORT void JNICALL Java_org_ldk_enums_SocketAddressParseError_init (JNIEnv *env, jclass clz) {
1413         SocketAddressParseError_class = (*env)->NewGlobalRef(env, clz);
1414         CHECK(SocketAddressParseError_class != NULL);
1415         SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_SocketAddrParse", "Lorg/ldk/enums/SocketAddressParseError;");
1416         CHECK(SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse != NULL);
1417         SocketAddressParseError_LDKSocketAddressParseError_InvalidInput = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidInput", "Lorg/ldk/enums/SocketAddressParseError;");
1418         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidInput != NULL);
1419         SocketAddressParseError_LDKSocketAddressParseError_InvalidPort = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidPort", "Lorg/ldk/enums/SocketAddressParseError;");
1420         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidPort != NULL);
1421         SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidOnionV3", "Lorg/ldk/enums/SocketAddressParseError;");
1422         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 != NULL);
1423 }
1424 static inline jclass LDKSocketAddressParseError_to_java(JNIEnv *env, LDKSocketAddressParseError val) {
1425         switch (val) {
1426                 case LDKSocketAddressParseError_SocketAddrParse:
1427                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse);
1428                 case LDKSocketAddressParseError_InvalidInput:
1429                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidInput);
1430                 case LDKSocketAddressParseError_InvalidPort:
1431                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidPort);
1432                 case LDKSocketAddressParseError_InvalidOnionV3:
1433                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3);
1434                 default: abort();
1435         }
1436 }
1437
1438 static inline LDKUtxoLookupError LDKUtxoLookupError_from_java(JNIEnv *env, jclass clz) {
1439         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1440         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1441                 (*env)->ExceptionDescribe(env);
1442                 (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust threw an exception.");
1443         }
1444         switch (ord) {
1445                 case 0: return LDKUtxoLookupError_UnknownChain;
1446                 case 1: return LDKUtxoLookupError_UnknownTx;
1447         }
1448         (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust returned an invalid value.");
1449         abort(); // Unreachable, but will let the compiler know we don't return here
1450 }
1451 static jclass UtxoLookupError_class = NULL;
1452 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownChain = NULL;
1453 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownTx = NULL;
1454 JNIEXPORT void JNICALL Java_org_ldk_enums_UtxoLookupError_init (JNIEnv *env, jclass clz) {
1455         UtxoLookupError_class = (*env)->NewGlobalRef(env, clz);
1456         CHECK(UtxoLookupError_class != NULL);
1457         UtxoLookupError_LDKUtxoLookupError_UnknownChain = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownChain", "Lorg/ldk/enums/UtxoLookupError;");
1458         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownChain != NULL);
1459         UtxoLookupError_LDKUtxoLookupError_UnknownTx = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownTx", "Lorg/ldk/enums/UtxoLookupError;");
1460         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownTx != NULL);
1461 }
1462 static inline jclass LDKUtxoLookupError_to_java(JNIEnv *env, LDKUtxoLookupError val) {
1463         switch (val) {
1464                 case LDKUtxoLookupError_UnknownChain:
1465                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownChain);
1466                 case LDKUtxoLookupError_UnknownTx:
1467                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownTx);
1468                 default: abort();
1469         }
1470 }
1471
1472 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
1473         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
1474         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
1475         return ret;
1476 }
1477 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
1478         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
1479         return ret;
1480 }
1481 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1get_1bytes(JNIEnv *env, jclass clz, int64_t thing) {
1482         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
1483         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1484         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BigEndianScalar_get_bytes(thing_conv).data);
1485         return ret_arr;
1486 }
1487
1488 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
1489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1free(JNIEnv *env, jclass clz, int64_t thing) {
1490         if (!ptr_is_owned(thing)) return;
1491         void* thing_ptr = untag_ptr(thing);
1492         CHECK_ACCESS(thing_ptr);
1493         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
1494         FREE(untag_ptr(thing));
1495         BigEndianScalar_free(thing_conv);
1496 }
1497
1498 static jclass LDKBech32Error_MissingSeparator_class = NULL;
1499 static jmethodID LDKBech32Error_MissingSeparator_meth = NULL;
1500 static jclass LDKBech32Error_InvalidChecksum_class = NULL;
1501 static jmethodID LDKBech32Error_InvalidChecksum_meth = NULL;
1502 static jclass LDKBech32Error_InvalidLength_class = NULL;
1503 static jmethodID LDKBech32Error_InvalidLength_meth = NULL;
1504 static jclass LDKBech32Error_InvalidChar_class = NULL;
1505 static jmethodID LDKBech32Error_InvalidChar_meth = NULL;
1506 static jclass LDKBech32Error_InvalidData_class = NULL;
1507 static jmethodID LDKBech32Error_InvalidData_meth = NULL;
1508 static jclass LDKBech32Error_InvalidPadding_class = NULL;
1509 static jmethodID LDKBech32Error_InvalidPadding_meth = NULL;
1510 static jclass LDKBech32Error_MixedCase_class = NULL;
1511 static jmethodID LDKBech32Error_MixedCase_meth = NULL;
1512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBech32Error_init (JNIEnv *env, jclass clz) {
1513         LDKBech32Error_MissingSeparator_class =
1514                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MissingSeparator"));
1515         CHECK(LDKBech32Error_MissingSeparator_class != NULL);
1516         LDKBech32Error_MissingSeparator_meth = (*env)->GetMethodID(env, LDKBech32Error_MissingSeparator_class, "<init>", "()V");
1517         CHECK(LDKBech32Error_MissingSeparator_meth != NULL);
1518         LDKBech32Error_InvalidChecksum_class =
1519                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChecksum"));
1520         CHECK(LDKBech32Error_InvalidChecksum_class != NULL);
1521         LDKBech32Error_InvalidChecksum_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChecksum_class, "<init>", "()V");
1522         CHECK(LDKBech32Error_InvalidChecksum_meth != NULL);
1523         LDKBech32Error_InvalidLength_class =
1524                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidLength"));
1525         CHECK(LDKBech32Error_InvalidLength_class != NULL);
1526         LDKBech32Error_InvalidLength_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidLength_class, "<init>", "()V");
1527         CHECK(LDKBech32Error_InvalidLength_meth != NULL);
1528         LDKBech32Error_InvalidChar_class =
1529                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChar"));
1530         CHECK(LDKBech32Error_InvalidChar_class != NULL);
1531         LDKBech32Error_InvalidChar_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChar_class, "<init>", "(I)V");
1532         CHECK(LDKBech32Error_InvalidChar_meth != NULL);
1533         LDKBech32Error_InvalidData_class =
1534                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidData"));
1535         CHECK(LDKBech32Error_InvalidData_class != NULL);
1536         LDKBech32Error_InvalidData_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidData_class, "<init>", "(B)V");
1537         CHECK(LDKBech32Error_InvalidData_meth != NULL);
1538         LDKBech32Error_InvalidPadding_class =
1539                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidPadding"));
1540         CHECK(LDKBech32Error_InvalidPadding_class != NULL);
1541         LDKBech32Error_InvalidPadding_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidPadding_class, "<init>", "()V");
1542         CHECK(LDKBech32Error_InvalidPadding_meth != NULL);
1543         LDKBech32Error_MixedCase_class =
1544                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MixedCase"));
1545         CHECK(LDKBech32Error_MixedCase_class != NULL);
1546         LDKBech32Error_MixedCase_meth = (*env)->GetMethodID(env, LDKBech32Error_MixedCase_class, "<init>", "()V");
1547         CHECK(LDKBech32Error_MixedCase_meth != NULL);
1548 }
1549 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBech32Error_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1550         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
1551         switch(obj->tag) {
1552                 case LDKBech32Error_MissingSeparator: {
1553                         return (*env)->NewObject(env, LDKBech32Error_MissingSeparator_class, LDKBech32Error_MissingSeparator_meth);
1554                 }
1555                 case LDKBech32Error_InvalidChecksum: {
1556                         return (*env)->NewObject(env, LDKBech32Error_InvalidChecksum_class, LDKBech32Error_InvalidChecksum_meth);
1557                 }
1558                 case LDKBech32Error_InvalidLength: {
1559                         return (*env)->NewObject(env, LDKBech32Error_InvalidLength_class, LDKBech32Error_InvalidLength_meth);
1560                 }
1561                 case LDKBech32Error_InvalidChar: {
1562                         int32_t invalid_char_conv = obj->invalid_char;
1563                         return (*env)->NewObject(env, LDKBech32Error_InvalidChar_class, LDKBech32Error_InvalidChar_meth, invalid_char_conv);
1564                 }
1565                 case LDKBech32Error_InvalidData: {
1566                         int8_t invalid_data_conv = obj->invalid_data;
1567                         return (*env)->NewObject(env, LDKBech32Error_InvalidData_class, LDKBech32Error_InvalidData_meth, invalid_data_conv);
1568                 }
1569                 case LDKBech32Error_InvalidPadding: {
1570                         return (*env)->NewObject(env, LDKBech32Error_InvalidPadding_class, LDKBech32Error_InvalidPadding_meth);
1571                 }
1572                 case LDKBech32Error_MixedCase: {
1573                         return (*env)->NewObject(env, LDKBech32Error_MixedCase_class, LDKBech32Error_MixedCase_meth);
1574                 }
1575                 default: abort();
1576         }
1577 }
1578 static jclass LDKCOption_u64Z_Some_class = NULL;
1579 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1580 static jclass LDKCOption_u64Z_None_class = NULL;
1581 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1583         LDKCOption_u64Z_Some_class =
1584                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some"));
1585         CHECK(LDKCOption_u64Z_Some_class != NULL);
1586         LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1587         CHECK(LDKCOption_u64Z_Some_meth != NULL);
1588         LDKCOption_u64Z_None_class =
1589                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None"));
1590         CHECK(LDKCOption_u64Z_None_class != NULL);
1591         LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1592         CHECK(LDKCOption_u64Z_None_meth != NULL);
1593 }
1594 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1595         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1596         switch(obj->tag) {
1597                 case LDKCOption_u64Z_Some: {
1598                         int64_t some_conv = obj->some;
1599                         return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, some_conv);
1600                 }
1601                 case LDKCOption_u64Z_None: {
1602                         return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1603                 }
1604                 default: abort();
1605         }
1606 }
1607 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
1608         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
1609         for (size_t i = 0; i < ret.datalen; i++) {
1610                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
1611         }
1612         return ret;
1613 }
1614 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
1615         LDKRefund ret = *owner->contents.result;
1616         ret.is_owned = false;
1617         return ret;
1618 }
1619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1620         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
1621         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
1622         int64_t ret_ref = 0;
1623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1625         return ret_ref;
1626 }
1627
1628 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
1629         LDKBolt12ParseError ret = *owner->contents.err;
1630         ret.is_owned = false;
1631         return ret;
1632 }
1633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1634         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
1635         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
1636         int64_t ret_ref = 0;
1637         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1638         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1639         return ret_ref;
1640 }
1641
1642 static jclass LDKRetry_Attempts_class = NULL;
1643 static jmethodID LDKRetry_Attempts_meth = NULL;
1644 static jclass LDKRetry_Timeout_class = NULL;
1645 static jmethodID LDKRetry_Timeout_meth = NULL;
1646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRetry_init (JNIEnv *env, jclass clz) {
1647         LDKRetry_Attempts_class =
1648                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Attempts"));
1649         CHECK(LDKRetry_Attempts_class != NULL);
1650         LDKRetry_Attempts_meth = (*env)->GetMethodID(env, LDKRetry_Attempts_class, "<init>", "(I)V");
1651         CHECK(LDKRetry_Attempts_meth != NULL);
1652         LDKRetry_Timeout_class =
1653                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Timeout"));
1654         CHECK(LDKRetry_Timeout_class != NULL);
1655         LDKRetry_Timeout_meth = (*env)->GetMethodID(env, LDKRetry_Timeout_class, "<init>", "(J)V");
1656         CHECK(LDKRetry_Timeout_meth != NULL);
1657 }
1658 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1659         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
1660         switch(obj->tag) {
1661                 case LDKRetry_Attempts: {
1662                         int32_t attempts_conv = obj->attempts;
1663                         return (*env)->NewObject(env, LDKRetry_Attempts_class, LDKRetry_Attempts_meth, attempts_conv);
1664                 }
1665                 case LDKRetry_Timeout: {
1666                         int64_t timeout_conv = obj->timeout;
1667                         return (*env)->NewObject(env, LDKRetry_Timeout_class, LDKRetry_Timeout_meth, timeout_conv);
1668                 }
1669                 default: abort();
1670         }
1671 }
1672 static jclass LDKDecodeError_UnknownVersion_class = NULL;
1673 static jmethodID LDKDecodeError_UnknownVersion_meth = NULL;
1674 static jclass LDKDecodeError_UnknownRequiredFeature_class = NULL;
1675 static jmethodID LDKDecodeError_UnknownRequiredFeature_meth = NULL;
1676 static jclass LDKDecodeError_InvalidValue_class = NULL;
1677 static jmethodID LDKDecodeError_InvalidValue_meth = NULL;
1678 static jclass LDKDecodeError_ShortRead_class = NULL;
1679 static jmethodID LDKDecodeError_ShortRead_meth = NULL;
1680 static jclass LDKDecodeError_BadLengthDescriptor_class = NULL;
1681 static jmethodID LDKDecodeError_BadLengthDescriptor_meth = NULL;
1682 static jclass LDKDecodeError_Io_class = NULL;
1683 static jmethodID LDKDecodeError_Io_meth = NULL;
1684 static jclass LDKDecodeError_UnsupportedCompression_class = NULL;
1685 static jmethodID LDKDecodeError_UnsupportedCompression_meth = NULL;
1686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDecodeError_init (JNIEnv *env, jclass clz) {
1687         LDKDecodeError_UnknownVersion_class =
1688                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnknownVersion"));
1689         CHECK(LDKDecodeError_UnknownVersion_class != NULL);
1690         LDKDecodeError_UnknownVersion_meth = (*env)->GetMethodID(env, LDKDecodeError_UnknownVersion_class, "<init>", "()V");
1691         CHECK(LDKDecodeError_UnknownVersion_meth != NULL);
1692         LDKDecodeError_UnknownRequiredFeature_class =
1693                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnknownRequiredFeature"));
1694         CHECK(LDKDecodeError_UnknownRequiredFeature_class != NULL);
1695         LDKDecodeError_UnknownRequiredFeature_meth = (*env)->GetMethodID(env, LDKDecodeError_UnknownRequiredFeature_class, "<init>", "()V");
1696         CHECK(LDKDecodeError_UnknownRequiredFeature_meth != NULL);
1697         LDKDecodeError_InvalidValue_class =
1698                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$InvalidValue"));
1699         CHECK(LDKDecodeError_InvalidValue_class != NULL);
1700         LDKDecodeError_InvalidValue_meth = (*env)->GetMethodID(env, LDKDecodeError_InvalidValue_class, "<init>", "()V");
1701         CHECK(LDKDecodeError_InvalidValue_meth != NULL);
1702         LDKDecodeError_ShortRead_class =
1703                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$ShortRead"));
1704         CHECK(LDKDecodeError_ShortRead_class != NULL);
1705         LDKDecodeError_ShortRead_meth = (*env)->GetMethodID(env, LDKDecodeError_ShortRead_class, "<init>", "()V");
1706         CHECK(LDKDecodeError_ShortRead_meth != NULL);
1707         LDKDecodeError_BadLengthDescriptor_class =
1708                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$BadLengthDescriptor"));
1709         CHECK(LDKDecodeError_BadLengthDescriptor_class != NULL);
1710         LDKDecodeError_BadLengthDescriptor_meth = (*env)->GetMethodID(env, LDKDecodeError_BadLengthDescriptor_class, "<init>", "()V");
1711         CHECK(LDKDecodeError_BadLengthDescriptor_meth != NULL);
1712         LDKDecodeError_Io_class =
1713                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$Io"));
1714         CHECK(LDKDecodeError_Io_class != NULL);
1715         LDKDecodeError_Io_meth = (*env)->GetMethodID(env, LDKDecodeError_Io_class, "<init>", "(Lorg/ldk/enums/IOError;)V");
1716         CHECK(LDKDecodeError_Io_meth != NULL);
1717         LDKDecodeError_UnsupportedCompression_class =
1718                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnsupportedCompression"));
1719         CHECK(LDKDecodeError_UnsupportedCompression_class != NULL);
1720         LDKDecodeError_UnsupportedCompression_meth = (*env)->GetMethodID(env, LDKDecodeError_UnsupportedCompression_class, "<init>", "()V");
1721         CHECK(LDKDecodeError_UnsupportedCompression_meth != NULL);
1722 }
1723 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDecodeError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1724         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
1725         switch(obj->tag) {
1726                 case LDKDecodeError_UnknownVersion: {
1727                         return (*env)->NewObject(env, LDKDecodeError_UnknownVersion_class, LDKDecodeError_UnknownVersion_meth);
1728                 }
1729                 case LDKDecodeError_UnknownRequiredFeature: {
1730                         return (*env)->NewObject(env, LDKDecodeError_UnknownRequiredFeature_class, LDKDecodeError_UnknownRequiredFeature_meth);
1731                 }
1732                 case LDKDecodeError_InvalidValue: {
1733                         return (*env)->NewObject(env, LDKDecodeError_InvalidValue_class, LDKDecodeError_InvalidValue_meth);
1734                 }
1735                 case LDKDecodeError_ShortRead: {
1736                         return (*env)->NewObject(env, LDKDecodeError_ShortRead_class, LDKDecodeError_ShortRead_meth);
1737                 }
1738                 case LDKDecodeError_BadLengthDescriptor: {
1739                         return (*env)->NewObject(env, LDKDecodeError_BadLengthDescriptor_class, LDKDecodeError_BadLengthDescriptor_meth);
1740                 }
1741                 case LDKDecodeError_Io: {
1742                         jclass io_conv = LDKIOError_to_java(env, obj->io);
1743                         return (*env)->NewObject(env, LDKDecodeError_Io_class, LDKDecodeError_Io_meth, io_conv);
1744                 }
1745                 case LDKDecodeError_UnsupportedCompression: {
1746                         return (*env)->NewObject(env, LDKDecodeError_UnsupportedCompression_class, LDKDecodeError_UnsupportedCompression_meth);
1747                 }
1748                 default: abort();
1749         }
1750 }
1751 static inline struct LDKRetry CResult_RetryDecodeErrorZ_get_ok(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
1752 CHECK(owner->result_ok);
1753         return Retry_clone(&*owner->contents.result);
1754 }
1755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1756         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
1757         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
1758         *ret_copy = CResult_RetryDecodeErrorZ_get_ok(owner_conv);
1759         int64_t ret_ref = tag_ptr(ret_copy, true);
1760         return ret_ref;
1761 }
1762
1763 static inline struct LDKDecodeError CResult_RetryDecodeErrorZ_get_err(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
1764 CHECK(!owner->result_ok);
1765         return DecodeError_clone(&*owner->contents.err);
1766 }
1767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1768         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
1769         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1770         *ret_copy = CResult_RetryDecodeErrorZ_get_err(owner_conv);
1771         int64_t ret_ref = tag_ptr(ret_copy, true);
1772         return ret_ref;
1773 }
1774
1775 static jclass LDKAPIError_APIMisuseError_class = NULL;
1776 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
1777 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
1778 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
1779 static jclass LDKAPIError_InvalidRoute_class = NULL;
1780 static jmethodID LDKAPIError_InvalidRoute_meth = NULL;
1781 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
1782 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
1783 static jclass LDKAPIError_MonitorUpdateInProgress_class = NULL;
1784 static jmethodID LDKAPIError_MonitorUpdateInProgress_meth = NULL;
1785 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
1786 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
1787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
1788         LDKAPIError_APIMisuseError_class =
1789                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
1790         CHECK(LDKAPIError_APIMisuseError_class != NULL);
1791         LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
1792         CHECK(LDKAPIError_APIMisuseError_meth != NULL);
1793         LDKAPIError_FeeRateTooHigh_class =
1794                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
1795         CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
1796         LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
1797         CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
1798         LDKAPIError_InvalidRoute_class =
1799                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$InvalidRoute"));
1800         CHECK(LDKAPIError_InvalidRoute_class != NULL);
1801         LDKAPIError_InvalidRoute_meth = (*env)->GetMethodID(env, LDKAPIError_InvalidRoute_class, "<init>", "(Ljava/lang/String;)V");
1802         CHECK(LDKAPIError_InvalidRoute_meth != NULL);
1803         LDKAPIError_ChannelUnavailable_class =
1804                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
1805         CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
1806         LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
1807         CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
1808         LDKAPIError_MonitorUpdateInProgress_class =
1809                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateInProgress"));
1810         CHECK(LDKAPIError_MonitorUpdateInProgress_class != NULL);
1811         LDKAPIError_MonitorUpdateInProgress_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateInProgress_class, "<init>", "()V");
1812         CHECK(LDKAPIError_MonitorUpdateInProgress_meth != NULL);
1813         LDKAPIError_IncompatibleShutdownScript_class =
1814                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
1815         CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
1816         LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
1817         CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
1818 }
1819 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1820         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1821         switch(obj->tag) {
1822                 case LDKAPIError_APIMisuseError: {
1823                         LDKStr err_str = obj->api_misuse_error.err;
1824                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1825                         return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
1826                 }
1827                 case LDKAPIError_FeeRateTooHigh: {
1828                         LDKStr err_str = obj->fee_rate_too_high.err;
1829                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1830                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
1831                         return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv);
1832                 }
1833                 case LDKAPIError_InvalidRoute: {
1834                         LDKStr err_str = obj->invalid_route.err;
1835                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1836                         return (*env)->NewObject(env, LDKAPIError_InvalidRoute_class, LDKAPIError_InvalidRoute_meth, err_conv);
1837                 }
1838                 case LDKAPIError_ChannelUnavailable: {
1839                         LDKStr err_str = obj->channel_unavailable.err;
1840                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1841                         return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
1842                 }
1843                 case LDKAPIError_MonitorUpdateInProgress: {
1844                         return (*env)->NewObject(env, LDKAPIError_MonitorUpdateInProgress_class, LDKAPIError_MonitorUpdateInProgress_meth);
1845                 }
1846                 case LDKAPIError_IncompatibleShutdownScript: {
1847                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
1848                         int64_t script_ref = 0;
1849                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
1850                         script_ref = tag_ptr(script_var.inner, false);
1851                         return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
1852                 }
1853                 default: abort();
1854         }
1855 }
1856 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1857 CHECK(owner->result_ok);
1858         return *owner->contents.result;
1859 }
1860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1861         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1862         CResult_NoneAPIErrorZ_get_ok(owner_conv);
1863 }
1864
1865 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1866 CHECK(!owner->result_ok);
1867         return APIError_clone(&*owner->contents.err);
1868 }
1869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1870         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1871         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
1872         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
1873         int64_t ret_ref = tag_ptr(ret_copy, true);
1874         return ret_ref;
1875 }
1876
1877 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
1878         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
1879         for (size_t i = 0; i < ret.datalen; i++) {
1880                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
1881         }
1882         return ret;
1883 }
1884 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
1885         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
1886         for (size_t i = 0; i < ret.datalen; i++) {
1887                 ret.data[i] = APIError_clone(&orig->data[i]);
1888         }
1889         return ret;
1890 }
1891 static jclass LDKCOption_ThirtyTwoBytesZ_Some_class = NULL;
1892 static jmethodID LDKCOption_ThirtyTwoBytesZ_Some_meth = NULL;
1893 static jclass LDKCOption_ThirtyTwoBytesZ_None_class = NULL;
1894 static jmethodID LDKCOption_ThirtyTwoBytesZ_None_meth = NULL;
1895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ThirtyTwoBytesZ_init (JNIEnv *env, jclass clz) {
1896         LDKCOption_ThirtyTwoBytesZ_Some_class =
1897                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ThirtyTwoBytesZ$Some"));
1898         CHECK(LDKCOption_ThirtyTwoBytesZ_Some_class != NULL);
1899         LDKCOption_ThirtyTwoBytesZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ThirtyTwoBytesZ_Some_class, "<init>", "([B)V");
1900         CHECK(LDKCOption_ThirtyTwoBytesZ_Some_meth != NULL);
1901         LDKCOption_ThirtyTwoBytesZ_None_class =
1902                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ThirtyTwoBytesZ$None"));
1903         CHECK(LDKCOption_ThirtyTwoBytesZ_None_class != NULL);
1904         LDKCOption_ThirtyTwoBytesZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ThirtyTwoBytesZ_None_class, "<init>", "()V");
1905         CHECK(LDKCOption_ThirtyTwoBytesZ_None_meth != NULL);
1906 }
1907 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ThirtyTwoBytesZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1908         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
1909         switch(obj->tag) {
1910                 case LDKCOption_ThirtyTwoBytesZ_Some: {
1911                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
1912                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.data);
1913                         return (*env)->NewObject(env, LDKCOption_ThirtyTwoBytesZ_Some_class, LDKCOption_ThirtyTwoBytesZ_Some_meth, some_arr);
1914                 }
1915                 case LDKCOption_ThirtyTwoBytesZ_None: {
1916                         return (*env)->NewObject(env, LDKCOption_ThirtyTwoBytesZ_None_class, LDKCOption_ThirtyTwoBytesZ_None_meth);
1917                 }
1918                 default: abort();
1919         }
1920 }
1921 static jclass LDKCOption_CVec_u8ZZ_Some_class = NULL;
1922 static jmethodID LDKCOption_CVec_u8ZZ_Some_meth = NULL;
1923 static jclass LDKCOption_CVec_u8ZZ_None_class = NULL;
1924 static jmethodID LDKCOption_CVec_u8ZZ_None_meth = NULL;
1925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1u8ZZ_init (JNIEnv *env, jclass clz) {
1926         LDKCOption_CVec_u8ZZ_Some_class =
1927                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_u8ZZ$Some"));
1928         CHECK(LDKCOption_CVec_u8ZZ_Some_class != NULL);
1929         LDKCOption_CVec_u8ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_u8ZZ_Some_class, "<init>", "([B)V");
1930         CHECK(LDKCOption_CVec_u8ZZ_Some_meth != NULL);
1931         LDKCOption_CVec_u8ZZ_None_class =
1932                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_u8ZZ$None"));
1933         CHECK(LDKCOption_CVec_u8ZZ_None_class != NULL);
1934         LDKCOption_CVec_u8ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_u8ZZ_None_class, "<init>", "()V");
1935         CHECK(LDKCOption_CVec_u8ZZ_None_meth != NULL);
1936 }
1937 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1u8ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1938         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
1939         switch(obj->tag) {
1940                 case LDKCOption_CVec_u8ZZ_Some: {
1941                         LDKCVec_u8Z some_var = obj->some;
1942                         int8_tArray some_arr = (*env)->NewByteArray(env, some_var.datalen);
1943                         (*env)->SetByteArrayRegion(env, some_arr, 0, some_var.datalen, some_var.data);
1944                         return (*env)->NewObject(env, LDKCOption_CVec_u8ZZ_Some_class, LDKCOption_CVec_u8ZZ_Some_meth, some_arr);
1945                 }
1946                 case LDKCOption_CVec_u8ZZ_None: {
1947                         return (*env)->NewObject(env, LDKCOption_CVec_u8ZZ_None_class, LDKCOption_CVec_u8ZZ_None_meth);
1948                 }
1949                 default: abort();
1950         }
1951 }
1952 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1953         LDKRecipientOnionFields ret = *owner->contents.result;
1954         ret.is_owned = false;
1955         return ret;
1956 }
1957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1958         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
1959         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
1960         int64_t ret_ref = 0;
1961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1963         return ret_ref;
1964 }
1965
1966 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1967 CHECK(!owner->result_ok);
1968         return DecodeError_clone(&*owner->contents.err);
1969 }
1970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1971         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
1972         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1973         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
1974         int64_t ret_ref = tag_ptr(ret_copy, true);
1975         return ret_ref;
1976 }
1977
1978 static inline uint64_t C2Tuple_u64CVec_u8ZZ_get_a(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
1979         return owner->a;
1980 }
1981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
1982         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
1983         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_get_a(owner_conv);
1984         return ret_conv;
1985 }
1986
1987 static inline struct LDKCVec_u8Z C2Tuple_u64CVec_u8ZZ_get_b(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
1988         return CVec_u8Z_clone(&owner->b);
1989 }
1990 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
1991         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
1992         LDKCVec_u8Z ret_var = C2Tuple_u64CVec_u8ZZ_get_b(owner_conv);
1993         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1994         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1995         CVec_u8Z_free(ret_var);
1996         return ret_arr;
1997 }
1998
1999 static inline LDKCVec_C2Tuple_u64CVec_u8ZZZ CVec_C2Tuple_u64CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u64CVec_u8ZZZ *orig) {
2000         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u64CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
2001         for (size_t i = 0; i < ret.datalen; i++) {
2002                 ret.data[i] = C2Tuple_u64CVec_u8ZZ_clone(&orig->data[i]);
2003         }
2004         return ret;
2005 }
2006 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsNoneZ_get_ok(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
2007         LDKRecipientOnionFields ret = *owner->contents.result;
2008         ret.is_owned = false;
2009         return ret;
2010 }
2011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2012         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
2013         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsNoneZ_get_ok(owner_conv);
2014         int64_t ret_ref = 0;
2015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2017         return ret_ref;
2018 }
2019
2020 static inline void CResult_RecipientOnionFieldsNoneZ_get_err(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
2021 CHECK(!owner->result_ok);
2022         return *owner->contents.err;
2023 }
2024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2025         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
2026         CResult_RecipientOnionFieldsNoneZ_get_err(owner_conv);
2027 }
2028
2029 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
2030         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
2031         for (size_t i = 0; i < ret.datalen; i++) {
2032                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
2033         }
2034         return ret;
2035 }
2036 static jclass LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class = NULL;
2037 static jmethodID LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth = NULL;
2038 static jclass LDKCOption_CVec_ThirtyTwoBytesZZ_None_class = NULL;
2039 static jmethodID LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth = NULL;
2040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1ThirtyTwoBytesZZ_init (JNIEnv *env, jclass clz) {
2041         LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class =
2042                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_ThirtyTwoBytesZZ$Some"));
2043         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class != NULL);
2044         LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class, "<init>", "([[B)V");
2045         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth != NULL);
2046         LDKCOption_CVec_ThirtyTwoBytesZZ_None_class =
2047                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_ThirtyTwoBytesZZ$None"));
2048         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_None_class != NULL);
2049         LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_ThirtyTwoBytesZZ_None_class, "<init>", "()V");
2050         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth != NULL);
2051 }
2052 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1ThirtyTwoBytesZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2053         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
2054         switch(obj->tag) {
2055                 case LDKCOption_CVec_ThirtyTwoBytesZZ_Some: {
2056                         LDKCVec_ThirtyTwoBytesZ some_var = obj->some;
2057                         jobjectArray some_arr = NULL;
2058                         some_arr = (*env)->NewObjectArray(env, some_var.datalen, arr_of_B_clz, NULL);
2059                         ;
2060                         for (size_t i = 0; i < some_var.datalen; i++) {
2061                                 int8_tArray some_conv_8_arr = (*env)->NewByteArray(env, 32);
2062                                 (*env)->SetByteArrayRegion(env, some_conv_8_arr, 0, 32, some_var.data[i].data);
2063                                 (*env)->SetObjectArrayElement(env, some_arr, i, some_conv_8_arr);
2064                         }
2065                         
2066                         return (*env)->NewObject(env, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth, some_arr);
2067                 }
2068                 case LDKCOption_CVec_ThirtyTwoBytesZZ_None: {
2069                         return (*env)->NewObject(env, LDKCOption_CVec_ThirtyTwoBytesZZ_None_class, LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth);
2070                 }
2071                 default: abort();
2072         }
2073 }
2074 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesNoneZ_get_ok(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
2075 CHECK(owner->result_ok);
2076         return ThirtyTwoBytes_clone(&*owner->contents.result);
2077 }
2078 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2079         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
2080         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2081         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesNoneZ_get_ok(owner_conv).data);
2082         return ret_arr;
2083 }
2084
2085 static inline void CResult_ThirtyTwoBytesNoneZ_get_err(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
2086 CHECK(!owner->result_ok);
2087         return *owner->contents.err;
2088 }
2089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2090         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
2091         CResult_ThirtyTwoBytesNoneZ_get_err(owner_conv);
2092 }
2093
2094 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
2095         LDKBlindedPayInfo ret = *owner->contents.result;
2096         ret.is_owned = false;
2097         return ret;
2098 }
2099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2100         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
2101         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
2102         int64_t ret_ref = 0;
2103         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2104         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2105         return ret_ref;
2106 }
2107
2108 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
2109 CHECK(!owner->result_ok);
2110         return DecodeError_clone(&*owner->contents.err);
2111 }
2112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2113         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
2114         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2115         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
2116         int64_t ret_ref = tag_ptr(ret_copy, true);
2117         return ret_ref;
2118 }
2119
2120 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2121         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
2122         ret.is_owned = false;
2123         return ret;
2124 }
2125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2126         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2127         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2128         int64_t ret_ref = 0;
2129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2131         return ret_ref;
2132 }
2133
2134 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2135 CHECK(!owner->result_ok);
2136         return DecodeError_clone(&*owner->contents.err);
2137 }
2138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2139         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2140         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2141         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2142         int64_t ret_ref = tag_ptr(ret_copy, true);
2143         return ret_ref;
2144 }
2145
2146 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2147         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
2148         ret.is_owned = false;
2149         return ret;
2150 }
2151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2152         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2153         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2154         int64_t ret_ref = 0;
2155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2157         return ret_ref;
2158 }
2159
2160 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2161 CHECK(!owner->result_ok);
2162         return DecodeError_clone(&*owner->contents.err);
2163 }
2164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2165         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2166         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2167         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2168         int64_t ret_ref = tag_ptr(ret_copy, true);
2169         return ret_ref;
2170 }
2171
2172 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
2173 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
2174 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
2175 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
2176 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
2177 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
2178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
2179         LDKSpendableOutputDescriptor_StaticOutput_class =
2180                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
2181         CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
2182         LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ[B)V");
2183         CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
2184         LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
2185                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
2186         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
2187         LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
2188         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
2189         LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
2190                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
2191         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
2192         LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
2193         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
2194 }
2195 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2196         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
2197         switch(obj->tag) {
2198                 case LDKSpendableOutputDescriptor_StaticOutput: {
2199                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
2200                         int64_t outpoint_ref = 0;
2201                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
2202                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
2203                         LDKTxOut* output_ref = &obj->static_output.output;
2204                         int8_tArray channel_keys_id_arr = (*env)->NewByteArray(env, 32);
2205                         (*env)->SetByteArrayRegion(env, channel_keys_id_arr, 0, 32, obj->static_output.channel_keys_id.data);
2206                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, tag_ptr(output_ref, false), channel_keys_id_arr);
2207                 }
2208                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
2209                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
2210                         int64_t delayed_payment_output_ref = 0;
2211                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
2212                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
2213                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
2214                 }
2215                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
2216                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
2217                         int64_t static_payment_output_ref = 0;
2218                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
2219                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
2220                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
2221                 }
2222                 default: abort();
2223         }
2224 }
2225 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2226 CHECK(owner->result_ok);
2227         return SpendableOutputDescriptor_clone(&*owner->contents.result);
2228 }
2229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2230         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2231         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
2232         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2233         int64_t ret_ref = tag_ptr(ret_copy, true);
2234         return ret_ref;
2235 }
2236
2237 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2238 CHECK(!owner->result_ok);
2239         return DecodeError_clone(&*owner->contents.err);
2240 }
2241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2242         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2243         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2244         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2245         int64_t ret_ref = tag_ptr(ret_copy, true);
2246         return ret_ref;
2247 }
2248
2249 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
2250         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
2251         for (size_t i = 0; i < ret.datalen; i++) {
2252                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
2253         }
2254         return ret;
2255 }
2256 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2257         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2258         for (size_t i = 0; i < ret.datalen; i++) {
2259                 ret.data[i] = TxOut_clone(&orig->data[i]);
2260         }
2261         return ret;
2262 }
2263 static jclass LDKCOption_u32Z_Some_class = NULL;
2264 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
2265 static jclass LDKCOption_u32Z_None_class = NULL;
2266 static jmethodID LDKCOption_u32Z_None_meth = NULL;
2267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
2268         LDKCOption_u32Z_Some_class =
2269                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
2270         CHECK(LDKCOption_u32Z_Some_class != NULL);
2271         LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
2272         CHECK(LDKCOption_u32Z_Some_meth != NULL);
2273         LDKCOption_u32Z_None_class =
2274                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
2275         CHECK(LDKCOption_u32Z_None_class != NULL);
2276         LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
2277         CHECK(LDKCOption_u32Z_None_meth != NULL);
2278 }
2279 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2280         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
2281         switch(obj->tag) {
2282                 case LDKCOption_u32Z_Some: {
2283                         int32_t some_conv = obj->some;
2284                         return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, some_conv);
2285                 }
2286                 case LDKCOption_u32Z_None: {
2287                         return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
2288                 }
2289                 default: abort();
2290         }
2291 }
2292 static inline struct LDKCVec_u8Z C2Tuple_CVec_u8Zu64Z_get_a(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
2293         return CVec_u8Z_clone(&owner->a);
2294 }
2295 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2296         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
2297         LDKCVec_u8Z ret_var = C2Tuple_CVec_u8Zu64Z_get_a(owner_conv);
2298         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2299         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2300         CVec_u8Z_free(ret_var);
2301         return ret_arr;
2302 }
2303
2304 static inline uint64_t C2Tuple_CVec_u8Zu64Z_get_b(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
2305         return owner->b;
2306 }
2307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2308         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
2309         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_get_b(owner_conv);
2310         return ret_conv;
2311 }
2312
2313 static inline struct LDKC2Tuple_CVec_u8Zu64Z CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
2314 CHECK(owner->result_ok);
2315         return C2Tuple_CVec_u8Zu64Z_clone(&*owner->contents.result);
2316 }
2317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2318         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
2319         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
2320         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(owner_conv);
2321         return tag_ptr(ret_conv, true);
2322 }
2323
2324 static inline void CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
2325 CHECK(!owner->result_ok);
2326         return *owner->contents.err;
2327 }
2328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2329         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
2330         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(owner_conv);
2331 }
2332
2333 static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
2334         LDKChannelDerivationParameters ret = *owner->contents.result;
2335         ret.is_owned = false;
2336         return ret;
2337 }
2338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2339         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
2340         LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv);
2341         int64_t ret_ref = 0;
2342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2344         return ret_ref;
2345 }
2346
2347 static inline struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
2348 CHECK(!owner->result_ok);
2349         return DecodeError_clone(&*owner->contents.err);
2350 }
2351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2352         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
2353         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2354         *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv);
2355         int64_t ret_ref = tag_ptr(ret_copy, true);
2356         return ret_ref;
2357 }
2358
2359 static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
2360         LDKHTLCDescriptor ret = *owner->contents.result;
2361         ret.is_owned = false;
2362         return ret;
2363 }
2364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2365         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
2366         LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv);
2367         int64_t ret_ref = 0;
2368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2370         return ret_ref;
2371 }
2372
2373 static inline struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
2374 CHECK(!owner->result_ok);
2375         return DecodeError_clone(&*owner->contents.err);
2376 }
2377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2378         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
2379         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2380         *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv);
2381         int64_t ret_ref = tag_ptr(ret_copy, true);
2382         return ret_ref;
2383 }
2384
2385 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
2386 CHECK(owner->result_ok);
2387         return *owner->contents.result;
2388 }
2389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2390         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
2391         CResult_NoneNoneZ_get_ok(owner_conv);
2392 }
2393
2394 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
2395 CHECK(!owner->result_ok);
2396         return *owner->contents.err;
2397 }
2398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2399         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
2400         CResult_NoneNoneZ_get_err(owner_conv);
2401 }
2402
2403 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
2404 CHECK(owner->result_ok);
2405         return *owner->contents.result;
2406 }
2407 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2408         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
2409         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2410         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form);
2411         return ret_arr;
2412 }
2413
2414 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
2415 CHECK(!owner->result_ok);
2416         return *owner->contents.err;
2417 }
2418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2419         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
2420         CResult_PublicKeyNoneZ_get_err(owner_conv);
2421 }
2422
2423 static jclass LDKCOption_BigEndianScalarZ_Some_class = NULL;
2424 static jmethodID LDKCOption_BigEndianScalarZ_Some_meth = NULL;
2425 static jclass LDKCOption_BigEndianScalarZ_None_class = NULL;
2426 static jmethodID LDKCOption_BigEndianScalarZ_None_meth = NULL;
2427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1BigEndianScalarZ_init (JNIEnv *env, jclass clz) {
2428         LDKCOption_BigEndianScalarZ_Some_class =
2429                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_BigEndianScalarZ$Some"));
2430         CHECK(LDKCOption_BigEndianScalarZ_Some_class != NULL);
2431         LDKCOption_BigEndianScalarZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_BigEndianScalarZ_Some_class, "<init>", "(J)V");
2432         CHECK(LDKCOption_BigEndianScalarZ_Some_meth != NULL);
2433         LDKCOption_BigEndianScalarZ_None_class =
2434                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_BigEndianScalarZ$None"));
2435         CHECK(LDKCOption_BigEndianScalarZ_None_class != NULL);
2436         LDKCOption_BigEndianScalarZ_None_meth = (*env)->GetMethodID(env, LDKCOption_BigEndianScalarZ_None_class, "<init>", "()V");
2437         CHECK(LDKCOption_BigEndianScalarZ_None_meth != NULL);
2438 }
2439 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1BigEndianScalarZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2440         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
2441         switch(obj->tag) {
2442                 case LDKCOption_BigEndianScalarZ_Some: {
2443                         LDKBigEndianScalar* some_ref = &obj->some;
2444                         return (*env)->NewObject(env, LDKCOption_BigEndianScalarZ_Some_class, LDKCOption_BigEndianScalarZ_Some_meth, tag_ptr(some_ref, false));
2445                 }
2446                 case LDKCOption_BigEndianScalarZ_None: {
2447                         return (*env)->NewObject(env, LDKCOption_BigEndianScalarZ_None_class, LDKCOption_BigEndianScalarZ_None_meth);
2448                 }
2449                 default: abort();
2450         }
2451 }
2452 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
2453 CHECK(owner->result_ok);
2454         return *owner->contents.result;
2455 }
2456 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2457         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
2458         int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
2459         (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
2460         return ret_arr;
2461 }
2462
2463 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
2464 CHECK(!owner->result_ok);
2465         return *owner->contents.err;
2466 }
2467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2468         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
2469         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
2470 }
2471
2472 static inline struct LDKSchnorrSignature CResult_SchnorrSignatureNoneZ_get_ok(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
2473 CHECK(owner->result_ok);
2474         return *owner->contents.result;
2475 }
2476 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2477         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
2478         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2479         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SchnorrSignatureNoneZ_get_ok(owner_conv).compact_form);
2480         return ret_arr;
2481 }
2482
2483 static inline void CResult_SchnorrSignatureNoneZ_get_err(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
2484 CHECK(!owner->result_ok);
2485         return *owner->contents.err;
2486 }
2487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2488         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
2489         CResult_SchnorrSignatureNoneZ_get_err(owner_conv);
2490 }
2491
2492 static inline struct LDKECDSASignature CResult_ECDSASignatureNoneZ_get_ok(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
2493 CHECK(owner->result_ok);
2494         return *owner->contents.result;
2495 }
2496 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2497         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
2498         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2499         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_ECDSASignatureNoneZ_get_ok(owner_conv).compact_form);
2500         return ret_arr;
2501 }
2502
2503 static inline void CResult_ECDSASignatureNoneZ_get_err(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
2504 CHECK(!owner->result_ok);
2505         return *owner->contents.err;
2506 }
2507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2508         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
2509         CResult_ECDSASignatureNoneZ_get_err(owner_conv);
2510 }
2511
2512 static inline struct LDKECDSASignature C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
2513         return owner->a;
2514 }
2515 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2516         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
2517         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2518         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(owner_conv).compact_form);
2519         return ret_arr;
2520 }
2521
2522 static inline struct LDKCVec_ECDSASignatureZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
2523         return owner->b;
2524 }
2525 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2526         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
2527         LDKCVec_ECDSASignatureZ ret_var = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(owner_conv);
2528         jobjectArray ret_arr = NULL;
2529         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
2530         ;
2531         for (size_t i = 0; i < ret_var.datalen; i++) {
2532                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
2533                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
2534                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
2535         }
2536         
2537         return ret_arr;
2538 }
2539
2540 static inline struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
2541 CHECK(owner->result_ok);
2542         return C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(&*owner->contents.result);
2543 }
2544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2545         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
2546         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
2547         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(owner_conv);
2548         return tag_ptr(ret_conv, true);
2549 }
2550
2551 static inline void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
2552 CHECK(!owner->result_ok);
2553         return *owner->contents.err;
2554 }
2555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2556         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
2557         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(owner_conv);
2558 }
2559
2560 typedef struct LDKChannelSigner_JCalls {
2561         atomic_size_t refcnt;
2562         JavaVM *vm;
2563         jweak o;
2564         jmethodID get_per_commitment_point_meth;
2565         jmethodID release_commitment_secret_meth;
2566         jmethodID validate_holder_commitment_meth;
2567         jmethodID validate_counterparty_revocation_meth;
2568         jmethodID channel_keys_id_meth;
2569         jmethodID provide_channel_parameters_meth;
2570 } LDKChannelSigner_JCalls;
2571 static void LDKChannelSigner_JCalls_free(void* this_arg) {
2572         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2573         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2574                 JNIEnv *env;
2575                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2576                 if (get_jenv_res == JNI_EDETACHED) {
2577                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2578                 } else {
2579                         DO_ASSERT(get_jenv_res == JNI_OK);
2580                 }
2581                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2582                 if (get_jenv_res == JNI_EDETACHED) {
2583                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2584                 }
2585                 FREE(j_calls);
2586         }
2587 }
2588 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
2589         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2590         JNIEnv *env;
2591         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2592         if (get_jenv_res == JNI_EDETACHED) {
2593                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2594         } else {
2595                 DO_ASSERT(get_jenv_res == JNI_OK);
2596         }
2597         int64_t idx_conv = idx;
2598         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2599         CHECK(obj != NULL);
2600         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx_conv);
2601         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2602                 (*env)->ExceptionDescribe(env);
2603                 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKChannelSigner from rust threw an exception.");
2604         }
2605         LDKPublicKey ret_ref;
2606         CHECK((*env)->GetArrayLength(env, ret) == 33);
2607         (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2608         if (get_jenv_res == JNI_EDETACHED) {
2609                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2610         }
2611         return ret_ref;
2612 }
2613 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
2614         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2615         JNIEnv *env;
2616         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2617         if (get_jenv_res == JNI_EDETACHED) {
2618                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2619         } else {
2620                 DO_ASSERT(get_jenv_res == JNI_OK);
2621         }
2622         int64_t idx_conv = idx;
2623         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2624         CHECK(obj != NULL);
2625         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx_conv);
2626         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2627                 (*env)->ExceptionDescribe(env);
2628                 (*env)->FatalError(env, "A call to release_commitment_secret in LDKChannelSigner from rust threw an exception.");
2629         }
2630         LDKThirtyTwoBytes ret_ref;
2631         CHECK((*env)->GetArrayLength(env, ret) == 32);
2632         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2633         if (get_jenv_res == JNI_EDETACHED) {
2634                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2635         }
2636         return ret_ref;
2637 }
2638 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages) {
2639         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2640         JNIEnv *env;
2641         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2642         if (get_jenv_res == JNI_EDETACHED) {
2643                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2644         } else {
2645                 DO_ASSERT(get_jenv_res == JNI_OK);
2646         }
2647         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
2648         int64_t holder_tx_ref = 0;
2649         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
2650         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
2651         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
2652         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
2653         jobjectArray outbound_htlc_preimages_arr = NULL;
2654         outbound_htlc_preimages_arr = (*env)->NewObjectArray(env, outbound_htlc_preimages_var.datalen, arr_of_B_clz, NULL);
2655         ;
2656         for (size_t i = 0; i < outbound_htlc_preimages_var.datalen; i++) {
2657                 int8_tArray outbound_htlc_preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
2658                 (*env)->SetByteArrayRegion(env, outbound_htlc_preimages_conv_8_arr, 0, 32, outbound_htlc_preimages_var.data[i].data);
2659                 (*env)->SetObjectArrayElement(env, outbound_htlc_preimages_arr, i, outbound_htlc_preimages_conv_8_arr);
2660         }
2661         
2662         FREE(outbound_htlc_preimages_var.data);
2663         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2664         CHECK(obj != NULL);
2665         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, outbound_htlc_preimages_arr);
2666         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2667                 (*env)->ExceptionDescribe(env);
2668                 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKChannelSigner from rust threw an exception.");
2669         }
2670         void* ret_ptr = untag_ptr(ret);
2671         CHECK_ACCESS(ret_ptr);
2672         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2673         FREE(untag_ptr(ret));
2674         if (get_jenv_res == JNI_EDETACHED) {
2675                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2676         }
2677         return ret_conv;
2678 }
2679 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
2680         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2681         JNIEnv *env;
2682         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2683         if (get_jenv_res == JNI_EDETACHED) {
2684                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2685         } else {
2686                 DO_ASSERT(get_jenv_res == JNI_OK);
2687         }
2688         int64_t idx_conv = idx;
2689         int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
2690         (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
2691         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2692         CHECK(obj != NULL);
2693         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx_conv, secret_arr);
2694         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2695                 (*env)->ExceptionDescribe(env);
2696                 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKChannelSigner from rust threw an exception.");
2697         }
2698         void* ret_ptr = untag_ptr(ret);
2699         CHECK_ACCESS(ret_ptr);
2700         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2701         FREE(untag_ptr(ret));
2702         if (get_jenv_res == JNI_EDETACHED) {
2703                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2704         }
2705         return ret_conv;
2706 }
2707 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
2708         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2709         JNIEnv *env;
2710         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2711         if (get_jenv_res == JNI_EDETACHED) {
2712                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2713         } else {
2714                 DO_ASSERT(get_jenv_res == JNI_OK);
2715         }
2716         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2717         CHECK(obj != NULL);
2718         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2719         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2720                 (*env)->ExceptionDescribe(env);
2721                 (*env)->FatalError(env, "A call to channel_keys_id in LDKChannelSigner from rust threw an exception.");
2722         }
2723         LDKThirtyTwoBytes ret_ref;
2724         CHECK((*env)->GetArrayLength(env, ret) == 32);
2725         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2726         if (get_jenv_res == JNI_EDETACHED) {
2727                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2728         }
2729         return ret_ref;
2730 }
2731 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2732         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2733         JNIEnv *env;
2734         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2735         if (get_jenv_res == JNI_EDETACHED) {
2736                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2737         } else {
2738                 DO_ASSERT(get_jenv_res == JNI_OK);
2739         }
2740         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2741         int64_t channel_parameters_ref = 0;
2742         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
2743         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
2744         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
2745         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2746         CHECK(obj != NULL);
2747         (*env)->CallVoidMethod(env, obj, j_calls->provide_channel_parameters_meth, channel_parameters_ref);
2748         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2749                 (*env)->ExceptionDescribe(env);
2750                 (*env)->FatalError(env, "A call to provide_channel_parameters in LDKChannelSigner from rust threw an exception.");
2751         }
2752         if (get_jenv_res == JNI_EDETACHED) {
2753                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2754         }
2755 }
2756 static inline LDKChannelSigner LDKChannelSigner_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2757         jclass c = (*env)->GetObjectClass(env, o);
2758         CHECK(c != NULL);
2759         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
2760         atomic_init(&calls->refcnt, 1);
2761         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2762         calls->o = (*env)->NewWeakGlobalRef(env, o);
2763         calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2764         CHECK(calls->get_per_commitment_point_meth != NULL);
2765         calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2766         CHECK(calls->release_commitment_secret_meth != NULL);
2767         calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
2768         CHECK(calls->validate_holder_commitment_meth != NULL);
2769         calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
2770         CHECK(calls->validate_counterparty_revocation_meth != NULL);
2771         calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2772         CHECK(calls->channel_keys_id_meth != NULL);
2773         calls->provide_channel_parameters_meth = (*env)->GetMethodID(env, c, "provide_channel_parameters", "(J)V");
2774         CHECK(calls->provide_channel_parameters_meth != NULL);
2775
2776         LDKChannelPublicKeys pubkeys_conv;
2777         pubkeys_conv.inner = untag_ptr(pubkeys);
2778         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2779         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2780
2781         LDKChannelSigner ret = {
2782                 .this_arg = (void*) calls,
2783                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
2784                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
2785                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
2786                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKChannelSigner_jcall,
2787                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
2788                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
2789                 .free = LDKChannelSigner_JCalls_free,
2790                 .pubkeys = pubkeys_conv,
2791                 .set_pubkeys = NULL,
2792         };
2793         return ret;
2794 }
2795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2796         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
2797         *res_ptr = LDKChannelSigner_init(env, clz, o, pubkeys);
2798         return tag_ptr(res_ptr, true);
2799 }
2800 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2801         void* this_arg_ptr = untag_ptr(this_arg);
2802         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2803         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2804         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2805         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2806         return ret_arr;
2807 }
2808
2809 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2810         void* this_arg_ptr = untag_ptr(this_arg);
2811         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2812         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2813         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2814         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2815         return ret_arr;
2816 }
2817
2818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1validate_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t holder_tx, jobjectArray outbound_htlc_preimages) {
2819         void* this_arg_ptr = untag_ptr(this_arg);
2820         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2821         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2822         LDKHolderCommitmentTransaction holder_tx_conv;
2823         holder_tx_conv.inner = untag_ptr(holder_tx);
2824         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
2825         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
2826         holder_tx_conv.is_owned = false;
2827         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
2828         outbound_htlc_preimages_constr.datalen = (*env)->GetArrayLength(env, outbound_htlc_preimages);
2829         if (outbound_htlc_preimages_constr.datalen > 0)
2830                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
2831         else
2832                 outbound_htlc_preimages_constr.data = NULL;
2833         for (size_t i = 0; i < outbound_htlc_preimages_constr.datalen; i++) {
2834                 int8_tArray outbound_htlc_preimages_conv_8 = (*env)->GetObjectArrayElement(env, outbound_htlc_preimages, i);
2835                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_8_ref;
2836                 CHECK((*env)->GetArrayLength(env, outbound_htlc_preimages_conv_8) == 32);
2837                 (*env)->GetByteArrayRegion(env, outbound_htlc_preimages_conv_8, 0, 32, outbound_htlc_preimages_conv_8_ref.data);
2838                 outbound_htlc_preimages_constr.data[i] = outbound_htlc_preimages_conv_8_ref;
2839         }
2840         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2841         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, outbound_htlc_preimages_constr);
2842         return tag_ptr(ret_conv, true);
2843 }
2844
2845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1validate_1counterparty_1revocation(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) {
2846         void* this_arg_ptr = untag_ptr(this_arg);
2847         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2848         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2849         uint8_t secret_arr[32];
2850         CHECK((*env)->GetArrayLength(env, secret) == 32);
2851         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
2852         uint8_t (*secret_ref)[32] = &secret_arr;
2853         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2854         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
2855         return tag_ptr(ret_conv, true);
2856 }
2857
2858 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2859         void* this_arg_ptr = untag_ptr(this_arg);
2860         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2861         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2862         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2863         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2864         return ret_arr;
2865 }
2866
2867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1provide_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2868         void* this_arg_ptr = untag_ptr(this_arg);
2869         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2870         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2871         LDKChannelTransactionParameters channel_parameters_conv;
2872         channel_parameters_conv.inner = untag_ptr(channel_parameters);
2873         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
2874         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
2875         channel_parameters_conv.is_owned = false;
2876         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
2877 }
2878
2879 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
2880         if (this_arg->set_pubkeys != NULL)
2881                 this_arg->set_pubkeys(this_arg);
2882         return this_arg->pubkeys;
2883 }
2884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2885         void* this_arg_ptr = untag_ptr(this_arg);
2886         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2887         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2888         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
2889         int64_t ret_ref = 0;
2890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2892         return ret_ref;
2893 }
2894
2895 typedef struct LDKEcdsaChannelSigner_JCalls {
2896         atomic_size_t refcnt;
2897         JavaVM *vm;
2898         jweak o;
2899         LDKChannelSigner_JCalls* ChannelSigner;
2900         jmethodID sign_counterparty_commitment_meth;
2901         jmethodID sign_holder_commitment_meth;
2902         jmethodID sign_justice_revoked_output_meth;
2903         jmethodID sign_justice_revoked_htlc_meth;
2904         jmethodID sign_holder_htlc_transaction_meth;
2905         jmethodID sign_counterparty_htlc_transaction_meth;
2906         jmethodID sign_closing_transaction_meth;
2907         jmethodID sign_holder_anchor_input_meth;
2908         jmethodID sign_channel_announcement_with_funding_key_meth;
2909 } LDKEcdsaChannelSigner_JCalls;
2910 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
2911         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2912         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2913                 JNIEnv *env;
2914                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2915                 if (get_jenv_res == JNI_EDETACHED) {
2916                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2917                 } else {
2918                         DO_ASSERT(get_jenv_res == JNI_OK);
2919                 }
2920                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2921                 if (get_jenv_res == JNI_EDETACHED) {
2922                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2923                 }
2924                 FREE(j_calls);
2925         }
2926 }
2927 LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages, LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages) {
2928         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2929         JNIEnv *env;
2930         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2931         if (get_jenv_res == JNI_EDETACHED) {
2932                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2933         } else {
2934                 DO_ASSERT(get_jenv_res == JNI_OK);
2935         }
2936         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2937         int64_t commitment_tx_ref = 0;
2938         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
2939         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2940         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
2941         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_var = inbound_htlc_preimages;
2942         jobjectArray inbound_htlc_preimages_arr = NULL;
2943         inbound_htlc_preimages_arr = (*env)->NewObjectArray(env, inbound_htlc_preimages_var.datalen, arr_of_B_clz, NULL);
2944         ;
2945         for (size_t i = 0; i < inbound_htlc_preimages_var.datalen; i++) {
2946                 int8_tArray inbound_htlc_preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
2947                 (*env)->SetByteArrayRegion(env, inbound_htlc_preimages_conv_8_arr, 0, 32, inbound_htlc_preimages_var.data[i].data);
2948                 (*env)->SetObjectArrayElement(env, inbound_htlc_preimages_arr, i, inbound_htlc_preimages_conv_8_arr);
2949         }
2950         
2951         FREE(inbound_htlc_preimages_var.data);
2952         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
2953         jobjectArray outbound_htlc_preimages_arr = NULL;
2954         outbound_htlc_preimages_arr = (*env)->NewObjectArray(env, outbound_htlc_preimages_var.datalen, arr_of_B_clz, NULL);
2955         ;
2956         for (size_t i = 0; i < outbound_htlc_preimages_var.datalen; i++) {
2957                 int8_tArray outbound_htlc_preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
2958                 (*env)->SetByteArrayRegion(env, outbound_htlc_preimages_conv_8_arr, 0, 32, outbound_htlc_preimages_var.data[i].data);
2959                 (*env)->SetObjectArrayElement(env, outbound_htlc_preimages_arr, i, outbound_htlc_preimages_conv_8_arr);
2960         }
2961         
2962         FREE(outbound_htlc_preimages_var.data);
2963         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2964         CHECK(obj != NULL);
2965         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, inbound_htlc_preimages_arr, outbound_htlc_preimages_arr);
2966         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2967                 (*env)->ExceptionDescribe(env);
2968                 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKEcdsaChannelSigner from rust threw an exception.");
2969         }
2970         void* ret_ptr = untag_ptr(ret);
2971         CHECK_ACCESS(ret_ptr);
2972         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
2973         FREE(untag_ptr(ret));
2974         if (get_jenv_res == JNI_EDETACHED) {
2975                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2976         }
2977         return ret_conv;
2978 }
2979 LDKCResult_ECDSASignatureNoneZ sign_holder_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2980         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2981         JNIEnv *env;
2982         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2983         if (get_jenv_res == JNI_EDETACHED) {
2984                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2985         } else {
2986                 DO_ASSERT(get_jenv_res == JNI_OK);
2987         }
2988         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2989         int64_t commitment_tx_ref = 0;
2990         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
2991         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2992         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
2993         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2994         CHECK(obj != NULL);
2995         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_meth, commitment_tx_ref);
2996         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2997                 (*env)->ExceptionDescribe(env);
2998                 (*env)->FatalError(env, "A call to sign_holder_commitment in LDKEcdsaChannelSigner from rust threw an exception.");
2999         }
3000         void* ret_ptr = untag_ptr(ret);
3001         CHECK_ACCESS(ret_ptr);
3002         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3003         FREE(untag_ptr(ret));
3004         if (get_jenv_res == JNI_EDETACHED) {
3005                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3006         }
3007         return ret_conv;
3008 }
3009 LDKCResult_ECDSASignatureNoneZ sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32]) {
3010         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3011         JNIEnv *env;
3012         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3013         if (get_jenv_res == JNI_EDETACHED) {
3014                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3015         } else {
3016                 DO_ASSERT(get_jenv_res == JNI_OK);
3017         }
3018         LDKTransaction justice_tx_var = justice_tx;
3019         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3020         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3021         Transaction_free(justice_tx_var);
3022         int64_t input_conv = input;
3023         int64_t amount_conv = amount;
3024         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3025         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3026         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3027         CHECK(obj != NULL);
3028         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input_conv, amount_conv, per_commitment_key_arr);
3029         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3030                 (*env)->ExceptionDescribe(env);
3031                 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKEcdsaChannelSigner from rust threw an exception.");
3032         }
3033         void* ret_ptr = untag_ptr(ret);
3034         CHECK_ACCESS(ret_ptr);
3035         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3036         FREE(untag_ptr(ret));
3037         if (get_jenv_res == JNI_EDETACHED) {
3038                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3039         }
3040         return ret_conv;
3041 }
3042 LDKCResult_ECDSASignatureNoneZ sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
3043         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3044         JNIEnv *env;
3045         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3046         if (get_jenv_res == JNI_EDETACHED) {
3047                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3048         } else {
3049                 DO_ASSERT(get_jenv_res == JNI_OK);
3050         }
3051         LDKTransaction justice_tx_var = justice_tx;
3052         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3053         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3054         Transaction_free(justice_tx_var);
3055         int64_t input_conv = input;
3056         int64_t amount_conv = amount;
3057         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3058         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3059         LDKHTLCOutputInCommitment htlc_var = *htlc;
3060         int64_t htlc_ref = 0;
3061         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3062         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3063         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3064         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3065         CHECK(obj != NULL);
3066         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input_conv, amount_conv, per_commitment_key_arr, htlc_ref);
3067         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3068                 (*env)->ExceptionDescribe(env);
3069                 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKEcdsaChannelSigner from rust threw an exception.");
3070         }
3071         void* ret_ptr = untag_ptr(ret);
3072         CHECK_ACCESS(ret_ptr);
3073         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3074         FREE(untag_ptr(ret));
3075         if (get_jenv_res == JNI_EDETACHED) {
3076                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3077         }
3078         return ret_conv;
3079 }
3080 LDKCResult_ECDSASignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
3081         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3082         JNIEnv *env;
3083         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3084         if (get_jenv_res == JNI_EDETACHED) {
3085                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3086         } else {
3087                 DO_ASSERT(get_jenv_res == JNI_OK);
3088         }
3089         LDKTransaction htlc_tx_var = htlc_tx;
3090         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
3091         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
3092         Transaction_free(htlc_tx_var);
3093         int64_t input_conv = input;
3094         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
3095         int64_t htlc_descriptor_ref = 0;
3096         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
3097         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
3098         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
3099         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3100         CHECK(obj != NULL);
3101         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_htlc_transaction_meth, htlc_tx_arr, input_conv, htlc_descriptor_ref);
3102         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3103                 (*env)->ExceptionDescribe(env);
3104                 (*env)->FatalError(env, "A call to sign_holder_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3105         }
3106         void* ret_ptr = untag_ptr(ret);
3107         CHECK_ACCESS(ret_ptr);
3108         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3109         FREE(untag_ptr(ret));
3110         if (get_jenv_res == JNI_EDETACHED) {
3111                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3112         }
3113         return ret_conv;
3114 }
3115 LDKCResult_ECDSASignatureNoneZ sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
3116         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3117         JNIEnv *env;
3118         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3119         if (get_jenv_res == JNI_EDETACHED) {
3120                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3121         } else {
3122                 DO_ASSERT(get_jenv_res == JNI_OK);
3123         }
3124         LDKTransaction htlc_tx_var = htlc_tx;
3125         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
3126         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
3127         Transaction_free(htlc_tx_var);
3128         int64_t input_conv = input;
3129         int64_t amount_conv = amount;
3130         int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
3131         (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
3132         LDKHTLCOutputInCommitment htlc_var = *htlc;
3133         int64_t htlc_ref = 0;
3134         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3135         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3136         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3137         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3138         CHECK(obj != NULL);
3139         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input_conv, amount_conv, per_commitment_point_arr, htlc_ref);
3140         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3141                 (*env)->ExceptionDescribe(env);
3142                 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3143         }
3144         void* ret_ptr = untag_ptr(ret);
3145         CHECK_ACCESS(ret_ptr);
3146         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3147         FREE(untag_ptr(ret));
3148         if (get_jenv_res == JNI_EDETACHED) {
3149                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3150         }
3151         return ret_conv;
3152 }
3153 LDKCResult_ECDSASignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
3154         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3155         JNIEnv *env;
3156         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3157         if (get_jenv_res == JNI_EDETACHED) {
3158                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3159         } else {
3160                 DO_ASSERT(get_jenv_res == JNI_OK);
3161         }
3162         LDKClosingTransaction closing_tx_var = *closing_tx;
3163         int64_t closing_tx_ref = 0;
3164         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
3165         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
3166         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
3167         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3168         CHECK(obj != NULL);
3169         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
3170         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3171                 (*env)->ExceptionDescribe(env);
3172                 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3173         }
3174         void* ret_ptr = untag_ptr(ret);
3175         CHECK_ACCESS(ret_ptr);
3176         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3177         FREE(untag_ptr(ret));
3178         if (get_jenv_res == JNI_EDETACHED) {
3179                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3180         }
3181         return ret_conv;
3182 }
3183 LDKCResult_ECDSASignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
3184         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3185         JNIEnv *env;
3186         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3187         if (get_jenv_res == JNI_EDETACHED) {
3188                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3189         } else {
3190                 DO_ASSERT(get_jenv_res == JNI_OK);
3191         }
3192         LDKTransaction anchor_tx_var = anchor_tx;
3193         int8_tArray anchor_tx_arr = (*env)->NewByteArray(env, anchor_tx_var.datalen);
3194         (*env)->SetByteArrayRegion(env, anchor_tx_arr, 0, anchor_tx_var.datalen, anchor_tx_var.data);
3195         Transaction_free(anchor_tx_var);
3196         int64_t input_conv = input;
3197         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3198         CHECK(obj != NULL);
3199         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_anchor_input_meth, anchor_tx_arr, input_conv);
3200         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3201                 (*env)->ExceptionDescribe(env);
3202                 (*env)->FatalError(env, "A call to sign_holder_anchor_input in LDKEcdsaChannelSigner from rust threw an exception.");
3203         }
3204         void* ret_ptr = untag_ptr(ret);
3205         CHECK_ACCESS(ret_ptr);
3206         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3207         FREE(untag_ptr(ret));
3208         if (get_jenv_res == JNI_EDETACHED) {
3209                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3210         }
3211         return ret_conv;
3212 }
3213 LDKCResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
3214         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3215         JNIEnv *env;
3216         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3217         if (get_jenv_res == JNI_EDETACHED) {
3218                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3219         } else {
3220                 DO_ASSERT(get_jenv_res == JNI_OK);
3221         }
3222         LDKUnsignedChannelAnnouncement msg_var = *msg;
3223         int64_t msg_ref = 0;
3224         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
3225         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3226         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
3227         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3228         CHECK(obj != NULL);
3229         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_with_funding_key_meth, msg_ref);
3230         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3231                 (*env)->ExceptionDescribe(env);
3232                 (*env)->FatalError(env, "A call to sign_channel_announcement_with_funding_key in LDKEcdsaChannelSigner from rust threw an exception.");
3233         }
3234         void* ret_ptr = untag_ptr(ret);
3235         CHECK_ACCESS(ret_ptr);
3236         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3237         FREE(untag_ptr(ret));
3238         if (get_jenv_res == JNI_EDETACHED) {
3239                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3240         }
3241         return ret_conv;
3242 }
3243 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
3244         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
3245         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3246         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
3247 }
3248 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
3249         jclass c = (*env)->GetObjectClass(env, o);
3250         CHECK(c != NULL);
3251         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
3252         atomic_init(&calls->refcnt, 1);
3253         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3254         calls->o = (*env)->NewWeakGlobalRef(env, o);
3255         calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B[[B)J");
3256         CHECK(calls->sign_counterparty_commitment_meth != NULL);
3257         calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
3258         CHECK(calls->sign_holder_commitment_meth != NULL);
3259         calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
3260         CHECK(calls->sign_justice_revoked_output_meth != NULL);
3261         calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
3262         CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
3263         calls->sign_holder_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_holder_htlc_transaction", "([BJJ)J");
3264         CHECK(calls->sign_holder_htlc_transaction_meth != NULL);
3265         calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
3266         CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
3267         calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
3268         CHECK(calls->sign_closing_transaction_meth != NULL);
3269         calls->sign_holder_anchor_input_meth = (*env)->GetMethodID(env, c, "sign_holder_anchor_input", "([BJ)J");
3270         CHECK(calls->sign_holder_anchor_input_meth != NULL);
3271         calls->sign_channel_announcement_with_funding_key_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement_with_funding_key", "(J)J");
3272         CHECK(calls->sign_channel_announcement_with_funding_key_meth != NULL);
3273
3274         LDKChannelPublicKeys pubkeys_conv;
3275         pubkeys_conv.inner = untag_ptr(pubkeys);
3276         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3277         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3278
3279         LDKEcdsaChannelSigner ret = {
3280                 .this_arg = (void*) calls,
3281                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
3282                 .sign_holder_commitment = sign_holder_commitment_LDKEcdsaChannelSigner_jcall,
3283                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
3284                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
3285                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
3286                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
3287                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
3288                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
3289                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
3290                 .free = LDKEcdsaChannelSigner_JCalls_free,
3291                 .ChannelSigner = LDKChannelSigner_init(env, clz, ChannelSigner, pubkeys),
3292         };
3293         calls->ChannelSigner = ret.ChannelSigner.this_arg;
3294         return ret;
3295 }
3296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
3297         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
3298         *res_ptr = LDKEcdsaChannelSigner_init(env, clz, o, ChannelSigner, pubkeys);
3299         return tag_ptr(res_ptr, true);
3300 }
3301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3302         LDKEcdsaChannelSigner *inp = (LDKEcdsaChannelSigner *)untag_ptr(arg);
3303         return tag_ptr(&inp->ChannelSigner, false);
3304 }
3305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx, jobjectArray inbound_htlc_preimages, jobjectArray outbound_htlc_preimages) {
3306         void* this_arg_ptr = untag_ptr(this_arg);
3307         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3308         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3309         LDKCommitmentTransaction commitment_tx_conv;
3310         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3311         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3312         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3313         commitment_tx_conv.is_owned = false;
3314         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_constr;
3315         inbound_htlc_preimages_constr.datalen = (*env)->GetArrayLength(env, inbound_htlc_preimages);
3316         if (inbound_htlc_preimages_constr.datalen > 0)
3317                 inbound_htlc_preimages_constr.data = MALLOC(inbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
3318         else
3319                 inbound_htlc_preimages_constr.data = NULL;
3320         for (size_t i = 0; i < inbound_htlc_preimages_constr.datalen; i++) {
3321                 int8_tArray inbound_htlc_preimages_conv_8 = (*env)->GetObjectArrayElement(env, inbound_htlc_preimages, i);
3322                 LDKThirtyTwoBytes inbound_htlc_preimages_conv_8_ref;
3323                 CHECK((*env)->GetArrayLength(env, inbound_htlc_preimages_conv_8) == 32);
3324                 (*env)->GetByteArrayRegion(env, inbound_htlc_preimages_conv_8, 0, 32, inbound_htlc_preimages_conv_8_ref.data);
3325                 inbound_htlc_preimages_constr.data[i] = inbound_htlc_preimages_conv_8_ref;
3326         }
3327         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
3328         outbound_htlc_preimages_constr.datalen = (*env)->GetArrayLength(env, outbound_htlc_preimages);
3329         if (outbound_htlc_preimages_constr.datalen > 0)
3330                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
3331         else
3332                 outbound_htlc_preimages_constr.data = NULL;
3333         for (size_t i = 0; i < outbound_htlc_preimages_constr.datalen; i++) {
3334                 int8_tArray outbound_htlc_preimages_conv_8 = (*env)->GetObjectArrayElement(env, outbound_htlc_preimages, i);
3335                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_8_ref;
3336                 CHECK((*env)->GetArrayLength(env, outbound_htlc_preimages_conv_8) == 32);
3337                 (*env)->GetByteArrayRegion(env, outbound_htlc_preimages_conv_8, 0, 32, outbound_htlc_preimages_conv_8_ref.data);
3338                 outbound_htlc_preimages_constr.data[i] = outbound_htlc_preimages_conv_8_ref;
3339         }
3340         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
3341         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, inbound_htlc_preimages_constr, outbound_htlc_preimages_constr);
3342         return tag_ptr(ret_conv, true);
3343 }
3344
3345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
3346         void* this_arg_ptr = untag_ptr(this_arg);
3347         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3348         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3349         LDKHolderCommitmentTransaction commitment_tx_conv;
3350         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3351         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3352         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3353         commitment_tx_conv.is_owned = false;
3354         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3355         *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
3356         return tag_ptr(ret_conv, true);
3357 }
3358
3359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1justice_1revoked_1output(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key) {
3360         void* this_arg_ptr = untag_ptr(this_arg);
3361         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3362         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3363         LDKTransaction justice_tx_ref;
3364         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3365         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3366         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3367         justice_tx_ref.data_is_owned = true;
3368         uint8_t per_commitment_key_arr[32];
3369         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3370         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3371         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3372         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3373         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
3374         return tag_ptr(ret_conv, true);
3375 }
3376
3377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1justice_1revoked_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key, int64_t htlc) {
3378         void* this_arg_ptr = untag_ptr(this_arg);
3379         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3380         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3381         LDKTransaction justice_tx_ref;
3382         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3383         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3384         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3385         justice_tx_ref.data_is_owned = true;
3386         uint8_t per_commitment_key_arr[32];
3387         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3388         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3389         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3390         LDKHTLCOutputInCommitment htlc_conv;
3391         htlc_conv.inner = untag_ptr(htlc);
3392         htlc_conv.is_owned = ptr_is_owned(htlc);
3393         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3394         htlc_conv.is_owned = false;
3395         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3396         *ret_conv = (this_arg_conv->sign_justice_revoked_htlc)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
3397         return tag_ptr(ret_conv, true);
3398 }
3399
3400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1holder_1htlc_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t htlc_descriptor) {
3401         void* this_arg_ptr = untag_ptr(this_arg);
3402         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3403         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3404         LDKTransaction htlc_tx_ref;
3405         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3406         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3407         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3408         htlc_tx_ref.data_is_owned = true;
3409         LDKHTLCDescriptor htlc_descriptor_conv;
3410         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
3411         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
3412         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
3413         htlc_descriptor_conv.is_owned = false;
3414         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3415         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
3416         return tag_ptr(ret_conv, true);
3417 }
3418
3419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1counterparty_1htlc_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t amount, int8_tArray per_commitment_point, int64_t htlc) {
3420         void* this_arg_ptr = untag_ptr(this_arg);
3421         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3422         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3423         LDKTransaction htlc_tx_ref;
3424         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3425         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3426         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3427         htlc_tx_ref.data_is_owned = true;
3428         LDKPublicKey per_commitment_point_ref;
3429         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
3430         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
3431         LDKHTLCOutputInCommitment htlc_conv;
3432         htlc_conv.inner = untag_ptr(htlc);
3433         htlc_conv.is_owned = ptr_is_owned(htlc);
3434         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3435         htlc_conv.is_owned = false;
3436         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3437         *ret_conv = (this_arg_conv->sign_counterparty_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, amount, per_commitment_point_ref, &htlc_conv);
3438         return tag_ptr(ret_conv, true);
3439 }
3440
3441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int64_t closing_tx) {
3442         void* this_arg_ptr = untag_ptr(this_arg);
3443         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3444         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3445         LDKClosingTransaction closing_tx_conv;
3446         closing_tx_conv.inner = untag_ptr(closing_tx);
3447         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
3448         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
3449         closing_tx_conv.is_owned = false;
3450         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3451         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
3452         return tag_ptr(ret_conv, true);
3453 }
3454
3455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1holder_1anchor_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray anchor_tx, int64_t input) {
3456         void* this_arg_ptr = untag_ptr(this_arg);
3457         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3458         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3459         LDKTransaction anchor_tx_ref;
3460         anchor_tx_ref.datalen = (*env)->GetArrayLength(env, anchor_tx);
3461         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
3462         (*env)->GetByteArrayRegion(env, anchor_tx, 0, anchor_tx_ref.datalen, anchor_tx_ref.data);
3463         anchor_tx_ref.data_is_owned = true;
3464         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3465         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
3466         return tag_ptr(ret_conv, true);
3467 }
3468
3469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1channel_1announcement_1with_1funding_1key(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
3470         void* this_arg_ptr = untag_ptr(this_arg);
3471         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3472         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3473         LDKUnsignedChannelAnnouncement msg_conv;
3474         msg_conv.inner = untag_ptr(msg);
3475         msg_conv.is_owned = ptr_is_owned(msg);
3476         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
3477         msg_conv.is_owned = false;
3478         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3479         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
3480         return tag_ptr(ret_conv, true);
3481 }
3482
3483 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
3484         atomic_size_t refcnt;
3485         JavaVM *vm;
3486         jweak o;
3487         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
3488         LDKChannelSigner_JCalls* ChannelSigner;
3489         jmethodID write_meth;
3490 } LDKWriteableEcdsaChannelSigner_JCalls;
3491 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
3492         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
3493         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3494                 JNIEnv *env;
3495                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3496                 if (get_jenv_res == JNI_EDETACHED) {
3497                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3498                 } else {
3499                         DO_ASSERT(get_jenv_res == JNI_OK);
3500                 }
3501                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3502                 if (get_jenv_res == JNI_EDETACHED) {
3503                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3504                 }
3505                 FREE(j_calls);
3506         }
3507 }
3508 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
3509         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
3510         JNIEnv *env;
3511         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3512         if (get_jenv_res == JNI_EDETACHED) {
3513                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3514         } else {
3515                 DO_ASSERT(get_jenv_res == JNI_OK);
3516         }
3517         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3518         CHECK(obj != NULL);
3519         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
3520         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3521                 (*env)->ExceptionDescribe(env);
3522                 (*env)->FatalError(env, "A call to write in LDKWriteableEcdsaChannelSigner from rust threw an exception.");
3523         }
3524         LDKCVec_u8Z ret_ref;
3525         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3526         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3527         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3528         if (get_jenv_res == JNI_EDETACHED) {
3529                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3530         }
3531         return ret_ref;
3532 }
3533 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
3534         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
3535         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3536         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
3537         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
3538 }
3539 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
3540         jclass c = (*env)->GetObjectClass(env, o);
3541         CHECK(c != NULL);
3542         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
3543         atomic_init(&calls->refcnt, 1);
3544         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3545         calls->o = (*env)->NewWeakGlobalRef(env, o);
3546         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
3547         CHECK(calls->write_meth != NULL);
3548
3549         LDKChannelPublicKeys pubkeys_conv;
3550         pubkeys_conv.inner = untag_ptr(pubkeys);
3551         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3552         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3553
3554         LDKWriteableEcdsaChannelSigner ret = {
3555                 .this_arg = (void*) calls,
3556                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
3557                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
3558                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
3559                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(env, clz, EcdsaChannelSigner, ChannelSigner, pubkeys),
3560         };
3561         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
3562         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
3563         return ret;
3564 }
3565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
3566         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
3567         *res_ptr = LDKWriteableEcdsaChannelSigner_init(env, clz, o, EcdsaChannelSigner, ChannelSigner, pubkeys);
3568         return tag_ptr(res_ptr, true);
3569 }
3570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3571         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
3572         return tag_ptr(&inp->EcdsaChannelSigner, false);
3573 }
3574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3575         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
3576         return tag_ptr(&inp->EcdsaChannelSigner.ChannelSigner, false);
3577 }
3578 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
3579         void* this_arg_ptr = untag_ptr(this_arg);
3580         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3581         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
3582         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3583         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3584         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3585         CVec_u8Z_free(ret_var);
3586         return ret_arr;
3587 }
3588
3589 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
3590 CHECK(owner->result_ok);
3591         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
3592 }
3593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3594         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
3595         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
3596         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
3597         return tag_ptr(ret_ret, true);
3598 }
3599
3600 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
3601 CHECK(!owner->result_ok);
3602         return DecodeError_clone(&*owner->contents.err);
3603 }
3604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3605         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
3606         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3607         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
3608         int64_t ret_ref = tag_ptr(ret_copy, true);
3609         return ret_ref;
3610 }
3611
3612 static inline struct LDKCVec_u8Z CResult_CVec_u8ZNoneZ_get_ok(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
3613 CHECK(owner->result_ok);
3614         return CVec_u8Z_clone(&*owner->contents.result);
3615 }
3616 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3617         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
3618         LDKCVec_u8Z ret_var = CResult_CVec_u8ZNoneZ_get_ok(owner_conv);
3619         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3620         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3621         CVec_u8Z_free(ret_var);
3622         return ret_arr;
3623 }
3624
3625 static inline void CResult_CVec_u8ZNoneZ_get_err(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
3626 CHECK(!owner->result_ok);
3627         return *owner->contents.err;
3628 }
3629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3630         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
3631         CResult_CVec_u8ZNoneZ_get_err(owner_conv);
3632 }
3633
3634 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
3635         LDKShutdownScript ret = *owner->contents.result;
3636         ret.is_owned = false;
3637         return ret;
3638 }
3639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3640         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
3641         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
3642         int64_t ret_ref = 0;
3643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3645         return ret_ref;
3646 }
3647
3648 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
3649 CHECK(!owner->result_ok);
3650         return *owner->contents.err;
3651 }
3652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3653         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
3654         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
3655 }
3656
3657 static jclass LDKCOption_u16Z_Some_class = NULL;
3658 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
3659 static jclass LDKCOption_u16Z_None_class = NULL;
3660 static jmethodID LDKCOption_u16Z_None_meth = NULL;
3661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
3662         LDKCOption_u16Z_Some_class =
3663                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
3664         CHECK(LDKCOption_u16Z_Some_class != NULL);
3665         LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
3666         CHECK(LDKCOption_u16Z_Some_meth != NULL);
3667         LDKCOption_u16Z_None_class =
3668                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
3669         CHECK(LDKCOption_u16Z_None_class != NULL);
3670         LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
3671         CHECK(LDKCOption_u16Z_None_meth != NULL);
3672 }
3673 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3674         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
3675         switch(obj->tag) {
3676                 case LDKCOption_u16Z_Some: {
3677                         int16_t some_conv = obj->some;
3678                         return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, some_conv);
3679                 }
3680                 case LDKCOption_u16Z_None: {
3681                         return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
3682                 }
3683                 default: abort();
3684         }
3685 }
3686 static jclass LDKCOption_boolZ_Some_class = NULL;
3687 static jmethodID LDKCOption_boolZ_Some_meth = NULL;
3688 static jclass LDKCOption_boolZ_None_class = NULL;
3689 static jmethodID LDKCOption_boolZ_None_meth = NULL;
3690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1boolZ_init (JNIEnv *env, jclass clz) {
3691         LDKCOption_boolZ_Some_class =
3692                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_boolZ$Some"));
3693         CHECK(LDKCOption_boolZ_Some_class != NULL);
3694         LDKCOption_boolZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_boolZ_Some_class, "<init>", "(Z)V");
3695         CHECK(LDKCOption_boolZ_Some_meth != NULL);
3696         LDKCOption_boolZ_None_class =
3697                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_boolZ$None"));
3698         CHECK(LDKCOption_boolZ_None_class != NULL);
3699         LDKCOption_boolZ_None_meth = (*env)->GetMethodID(env, LDKCOption_boolZ_None_class, "<init>", "()V");
3700         CHECK(LDKCOption_boolZ_None_meth != NULL);
3701 }
3702 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1boolZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3703         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
3704         switch(obj->tag) {
3705                 case LDKCOption_boolZ_Some: {
3706                         jboolean some_conv = obj->some;
3707                         return (*env)->NewObject(env, LDKCOption_boolZ_Some_class, LDKCOption_boolZ_Some_meth, some_conv);
3708                 }
3709                 case LDKCOption_boolZ_None: {
3710                         return (*env)->NewObject(env, LDKCOption_boolZ_None_class, LDKCOption_boolZ_None_meth);
3711                 }
3712                 default: abort();
3713         }
3714 }
3715 static inline struct LDKWitness CResult_WitnessNoneZ_get_ok(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
3716 CHECK(owner->result_ok);
3717         return Witness_clone(&*owner->contents.result);
3718 }
3719 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3720         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
3721         LDKWitness ret_var = CResult_WitnessNoneZ_get_ok(owner_conv);
3722         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3723         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3724         Witness_free(ret_var);
3725         return ret_arr;
3726 }
3727
3728 static inline void CResult_WitnessNoneZ_get_err(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
3729 CHECK(!owner->result_ok);
3730         return *owner->contents.err;
3731 }
3732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3733         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
3734         CResult_WitnessNoneZ_get_err(owner_conv);
3735 }
3736
3737 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
3738         LDKInMemorySigner ret = *owner->contents.result;
3739         ret.is_owned = false;
3740         return ret;
3741 }
3742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3743         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
3744         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
3745         int64_t ret_ref = 0;
3746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3748         return ret_ref;
3749 }
3750
3751 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
3752 CHECK(!owner->result_ok);
3753         return DecodeError_clone(&*owner->contents.err);
3754 }
3755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3756         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
3757         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3758         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
3759         int64_t ret_ref = tag_ptr(ret_copy, true);
3760         return ret_ref;
3761 }
3762
3763 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
3764 CHECK(owner->result_ok);
3765         return *owner->contents.result;
3766 }
3767 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3768         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
3769         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
3770         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3771         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3772         return ret_arr;
3773 }
3774
3775 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
3776 CHECK(!owner->result_ok);
3777         return *owner->contents.err;
3778 }
3779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3780         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
3781         CResult_TransactionNoneZ_get_err(owner_conv);
3782 }
3783
3784 static jclass LDKCandidateRouteHop_FirstHop_class = NULL;
3785 static jmethodID LDKCandidateRouteHop_FirstHop_meth = NULL;
3786 static jclass LDKCandidateRouteHop_PublicHop_class = NULL;
3787 static jmethodID LDKCandidateRouteHop_PublicHop_meth = NULL;
3788 static jclass LDKCandidateRouteHop_PrivateHop_class = NULL;
3789 static jmethodID LDKCandidateRouteHop_PrivateHop_meth = NULL;
3790 static jclass LDKCandidateRouteHop_Blinded_class = NULL;
3791 static jmethodID LDKCandidateRouteHop_Blinded_meth = NULL;
3792 static jclass LDKCandidateRouteHop_OneHopBlinded_class = NULL;
3793 static jmethodID LDKCandidateRouteHop_OneHopBlinded_meth = NULL;
3794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCandidateRouteHop_init (JNIEnv *env, jclass clz) {
3795         LDKCandidateRouteHop_FirstHop_class =
3796                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$FirstHop"));
3797         CHECK(LDKCandidateRouteHop_FirstHop_class != NULL);
3798         LDKCandidateRouteHop_FirstHop_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_FirstHop_class, "<init>", "(J)V");
3799         CHECK(LDKCandidateRouteHop_FirstHop_meth != NULL);
3800         LDKCandidateRouteHop_PublicHop_class =
3801                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$PublicHop"));
3802         CHECK(LDKCandidateRouteHop_PublicHop_class != NULL);
3803         LDKCandidateRouteHop_PublicHop_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_PublicHop_class, "<init>", "(J)V");
3804         CHECK(LDKCandidateRouteHop_PublicHop_meth != NULL);
3805         LDKCandidateRouteHop_PrivateHop_class =
3806                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$PrivateHop"));
3807         CHECK(LDKCandidateRouteHop_PrivateHop_class != NULL);
3808         LDKCandidateRouteHop_PrivateHop_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_PrivateHop_class, "<init>", "(J)V");
3809         CHECK(LDKCandidateRouteHop_PrivateHop_meth != NULL);
3810         LDKCandidateRouteHop_Blinded_class =
3811                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$Blinded"));
3812         CHECK(LDKCandidateRouteHop_Blinded_class != NULL);
3813         LDKCandidateRouteHop_Blinded_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_Blinded_class, "<init>", "(J)V");
3814         CHECK(LDKCandidateRouteHop_Blinded_meth != NULL);
3815         LDKCandidateRouteHop_OneHopBlinded_class =
3816                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$OneHopBlinded"));
3817         CHECK(LDKCandidateRouteHop_OneHopBlinded_class != NULL);
3818         LDKCandidateRouteHop_OneHopBlinded_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_OneHopBlinded_class, "<init>", "(J)V");
3819         CHECK(LDKCandidateRouteHop_OneHopBlinded_meth != NULL);
3820 }
3821 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCandidateRouteHop_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3822         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
3823         switch(obj->tag) {
3824                 case LDKCandidateRouteHop_FirstHop: {
3825                         LDKFirstHopCandidate first_hop_var = obj->first_hop;
3826                         int64_t first_hop_ref = 0;
3827                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hop_var);
3828                         first_hop_ref = tag_ptr(first_hop_var.inner, false);
3829                         return (*env)->NewObject(env, LDKCandidateRouteHop_FirstHop_class, LDKCandidateRouteHop_FirstHop_meth, first_hop_ref);
3830                 }
3831                 case LDKCandidateRouteHop_PublicHop: {
3832                         LDKPublicHopCandidate public_hop_var = obj->public_hop;
3833                         int64_t public_hop_ref = 0;
3834                         CHECK_INNER_FIELD_ACCESS_OR_NULL(public_hop_var);
3835                         public_hop_ref = tag_ptr(public_hop_var.inner, false);
3836                         return (*env)->NewObject(env, LDKCandidateRouteHop_PublicHop_class, LDKCandidateRouteHop_PublicHop_meth, public_hop_ref);
3837                 }
3838                 case LDKCandidateRouteHop_PrivateHop: {
3839                         LDKPrivateHopCandidate private_hop_var = obj->private_hop;
3840                         int64_t private_hop_ref = 0;
3841                         CHECK_INNER_FIELD_ACCESS_OR_NULL(private_hop_var);
3842                         private_hop_ref = tag_ptr(private_hop_var.inner, false);
3843                         return (*env)->NewObject(env, LDKCandidateRouteHop_PrivateHop_class, LDKCandidateRouteHop_PrivateHop_meth, private_hop_ref);
3844                 }
3845                 case LDKCandidateRouteHop_Blinded: {
3846                         LDKBlindedPathCandidate blinded_var = obj->blinded;
3847                         int64_t blinded_ref = 0;
3848                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
3849                         blinded_ref = tag_ptr(blinded_var.inner, false);
3850                         return (*env)->NewObject(env, LDKCandidateRouteHop_Blinded_class, LDKCandidateRouteHop_Blinded_meth, blinded_ref);
3851                 }
3852                 case LDKCandidateRouteHop_OneHopBlinded: {
3853                         LDKOneHopBlindedPathCandidate one_hop_blinded_var = obj->one_hop_blinded;
3854                         int64_t one_hop_blinded_ref = 0;
3855                         CHECK_INNER_FIELD_ACCESS_OR_NULL(one_hop_blinded_var);
3856                         one_hop_blinded_ref = tag_ptr(one_hop_blinded_var.inner, false);
3857                         return (*env)->NewObject(env, LDKCandidateRouteHop_OneHopBlinded_class, LDKCandidateRouteHop_OneHopBlinded_meth, one_hop_blinded_ref);
3858                 }
3859                 default: abort();
3860         }
3861 }
3862 typedef struct LDKScoreLookUp_JCalls {
3863         atomic_size_t refcnt;
3864         JavaVM *vm;
3865         jweak o;
3866         jmethodID channel_penalty_msat_meth;
3867 } LDKScoreLookUp_JCalls;
3868 static void LDKScoreLookUp_JCalls_free(void* this_arg) {
3869         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
3870         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3871                 JNIEnv *env;
3872                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3873                 if (get_jenv_res == JNI_EDETACHED) {
3874                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3875                 } else {
3876                         DO_ASSERT(get_jenv_res == JNI_OK);
3877                 }
3878                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3879                 if (get_jenv_res == JNI_EDETACHED) {
3880                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3881                 }
3882                 FREE(j_calls);
3883         }
3884 }
3885 uint64_t channel_penalty_msat_LDKScoreLookUp_jcall(const void* this_arg, const LDKCandidateRouteHop * candidate, LDKChannelUsage usage, const LDKProbabilisticScoringFeeParameters * score_params) {
3886         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
3887         JNIEnv *env;
3888         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3889         if (get_jenv_res == JNI_EDETACHED) {
3890                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3891         } else {
3892                 DO_ASSERT(get_jenv_res == JNI_OK);
3893         }
3894         LDKCandidateRouteHop *ret_candidate = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop ret conversion");
3895         *ret_candidate = CandidateRouteHop_clone(candidate);
3896         int64_t ref_candidate = tag_ptr(ret_candidate, true);
3897         LDKChannelUsage usage_var = usage;
3898         int64_t usage_ref = 0;
3899         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
3900         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
3901         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
3902         int64_t score_params_ref = 0;
3903         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
3904         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
3905         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
3906         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3907         CHECK(obj != NULL);
3908         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, ref_candidate, usage_ref, score_params_ref);
3909         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3910                 (*env)->ExceptionDescribe(env);
3911                 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScoreLookUp from rust threw an exception.");
3912         }
3913         if (get_jenv_res == JNI_EDETACHED) {
3914                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3915         }
3916         return ret;
3917 }
3918 static void LDKScoreLookUp_JCalls_cloned(LDKScoreLookUp* new_obj) {
3919         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) new_obj->this_arg;
3920         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3921 }
3922 static inline LDKScoreLookUp LDKScoreLookUp_init (JNIEnv *env, jclass clz, jobject o) {
3923         jclass c = (*env)->GetObjectClass(env, o);
3924         CHECK(c != NULL);
3925         LDKScoreLookUp_JCalls *calls = MALLOC(sizeof(LDKScoreLookUp_JCalls), "LDKScoreLookUp_JCalls");
3926         atomic_init(&calls->refcnt, 1);
3927         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3928         calls->o = (*env)->NewWeakGlobalRef(env, o);
3929         calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJ)J");
3930         CHECK(calls->channel_penalty_msat_meth != NULL);
3931
3932         LDKScoreLookUp ret = {
3933                 .this_arg = (void*) calls,
3934                 .channel_penalty_msat = channel_penalty_msat_LDKScoreLookUp_jcall,
3935                 .free = LDKScoreLookUp_JCalls_free,
3936         };
3937         return ret;
3938 }
3939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScoreLookUp_1new(JNIEnv *env, jclass clz, jobject o) {
3940         LDKScoreLookUp *res_ptr = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
3941         *res_ptr = LDKScoreLookUp_init(env, clz, o);
3942         return tag_ptr(res_ptr, true);
3943 }
3944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoreLookUp_1channel_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t candidate, int64_t usage, int64_t score_params) {
3945         void* this_arg_ptr = untag_ptr(this_arg);
3946         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3947         LDKScoreLookUp* this_arg_conv = (LDKScoreLookUp*)this_arg_ptr;
3948         LDKCandidateRouteHop* candidate_conv = (LDKCandidateRouteHop*)untag_ptr(candidate);
3949         LDKChannelUsage usage_conv;
3950         usage_conv.inner = untag_ptr(usage);
3951         usage_conv.is_owned = ptr_is_owned(usage);
3952         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
3953         usage_conv = ChannelUsage_clone(&usage_conv);
3954         LDKProbabilisticScoringFeeParameters score_params_conv;
3955         score_params_conv.inner = untag_ptr(score_params);
3956         score_params_conv.is_owned = ptr_is_owned(score_params);
3957         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
3958         score_params_conv.is_owned = false;
3959         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, candidate_conv, usage_conv, &score_params_conv);
3960         return ret_conv;
3961 }
3962
3963 typedef struct LDKScoreUpdate_JCalls {
3964         atomic_size_t refcnt;
3965         JavaVM *vm;
3966         jweak o;
3967         jmethodID payment_path_failed_meth;
3968         jmethodID payment_path_successful_meth;
3969         jmethodID probe_failed_meth;
3970         jmethodID probe_successful_meth;
3971         jmethodID time_passed_meth;
3972 } LDKScoreUpdate_JCalls;
3973 static void LDKScoreUpdate_JCalls_free(void* this_arg) {
3974         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
3975         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3976                 JNIEnv *env;
3977                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3978                 if (get_jenv_res == JNI_EDETACHED) {
3979                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3980                 } else {
3981                         DO_ASSERT(get_jenv_res == JNI_OK);
3982                 }
3983                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3984                 if (get_jenv_res == JNI_EDETACHED) {
3985                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3986                 }
3987                 FREE(j_calls);
3988         }
3989 }
3990 void payment_path_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
3991         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
3992         JNIEnv *env;
3993         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3994         if (get_jenv_res == JNI_EDETACHED) {
3995                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3996         } else {
3997                 DO_ASSERT(get_jenv_res == JNI_OK);
3998         }
3999         LDKPath path_var = *path;
4000         int64_t path_ref = 0;
4001         path_var = Path_clone(&path_var);
4002         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4003         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4004         int64_t short_channel_id_conv = short_channel_id;
4005         int64_t duration_since_epoch_conv = duration_since_epoch;
4006         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4007         CHECK(obj != NULL);
4008         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_ref, short_channel_id_conv, duration_since_epoch_conv);
4009         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4010                 (*env)->ExceptionDescribe(env);
4011                 (*env)->FatalError(env, "A call to payment_path_failed in LDKScoreUpdate from rust threw an exception.");
4012         }
4013         if (get_jenv_res == JNI_EDETACHED) {
4014                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4015         }
4016 }
4017 void payment_path_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
4018         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4019         JNIEnv *env;
4020         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4021         if (get_jenv_res == JNI_EDETACHED) {
4022                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4023         } else {
4024                 DO_ASSERT(get_jenv_res == JNI_OK);
4025         }
4026         LDKPath path_var = *path;
4027         int64_t path_ref = 0;
4028         path_var = Path_clone(&path_var);
4029         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4030         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4031         int64_t duration_since_epoch_conv = duration_since_epoch;
4032         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4033         CHECK(obj != NULL);
4034         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_ref, duration_since_epoch_conv);
4035         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4036                 (*env)->ExceptionDescribe(env);
4037                 (*env)->FatalError(env, "A call to payment_path_successful in LDKScoreUpdate from rust threw an exception.");
4038         }
4039         if (get_jenv_res == JNI_EDETACHED) {
4040                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4041         }
4042 }
4043 void probe_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
4044         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4045         JNIEnv *env;
4046         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4047         if (get_jenv_res == JNI_EDETACHED) {
4048                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4049         } else {
4050                 DO_ASSERT(get_jenv_res == JNI_OK);
4051         }
4052         LDKPath path_var = *path;
4053         int64_t path_ref = 0;
4054         path_var = Path_clone(&path_var);
4055         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4056         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4057         int64_t short_channel_id_conv = short_channel_id;
4058         int64_t duration_since_epoch_conv = duration_since_epoch;
4059         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4060         CHECK(obj != NULL);
4061         (*env)->CallVoidMethod(env, obj, j_calls->probe_failed_meth, path_ref, short_channel_id_conv, duration_since_epoch_conv);
4062         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4063                 (*env)->ExceptionDescribe(env);
4064                 (*env)->FatalError(env, "A call to probe_failed in LDKScoreUpdate from rust threw an exception.");
4065         }
4066         if (get_jenv_res == JNI_EDETACHED) {
4067                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4068         }
4069 }
4070 void probe_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
4071         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4072         JNIEnv *env;
4073         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4074         if (get_jenv_res == JNI_EDETACHED) {
4075                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4076         } else {
4077                 DO_ASSERT(get_jenv_res == JNI_OK);
4078         }
4079         LDKPath path_var = *path;
4080         int64_t path_ref = 0;
4081         path_var = Path_clone(&path_var);
4082         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4083         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4084         int64_t duration_since_epoch_conv = duration_since_epoch;
4085         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4086         CHECK(obj != NULL);
4087         (*env)->CallVoidMethod(env, obj, j_calls->probe_successful_meth, path_ref, duration_since_epoch_conv);
4088         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4089                 (*env)->ExceptionDescribe(env);
4090                 (*env)->FatalError(env, "A call to probe_successful in LDKScoreUpdate from rust threw an exception.");
4091         }
4092         if (get_jenv_res == JNI_EDETACHED) {
4093                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4094         }
4095 }
4096 void time_passed_LDKScoreUpdate_jcall(void* this_arg, uint64_t duration_since_epoch) {
4097         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4098         JNIEnv *env;
4099         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4100         if (get_jenv_res == JNI_EDETACHED) {
4101                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4102         } else {
4103                 DO_ASSERT(get_jenv_res == JNI_OK);
4104         }
4105         int64_t duration_since_epoch_conv = duration_since_epoch;
4106         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4107         CHECK(obj != NULL);
4108         (*env)->CallVoidMethod(env, obj, j_calls->time_passed_meth, duration_since_epoch_conv);
4109         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4110                 (*env)->ExceptionDescribe(env);
4111                 (*env)->FatalError(env, "A call to time_passed in LDKScoreUpdate from rust threw an exception.");
4112         }
4113         if (get_jenv_res == JNI_EDETACHED) {
4114                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4115         }
4116 }
4117 static void LDKScoreUpdate_JCalls_cloned(LDKScoreUpdate* new_obj) {
4118         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) new_obj->this_arg;
4119         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4120 }
4121 static inline LDKScoreUpdate LDKScoreUpdate_init (JNIEnv *env, jclass clz, jobject o) {
4122         jclass c = (*env)->GetObjectClass(env, o);
4123         CHECK(c != NULL);
4124         LDKScoreUpdate_JCalls *calls = MALLOC(sizeof(LDKScoreUpdate_JCalls), "LDKScoreUpdate_JCalls");
4125         atomic_init(&calls->refcnt, 1);
4126         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4127         calls->o = (*env)->NewWeakGlobalRef(env, o);
4128         calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "(JJJ)V");
4129         CHECK(calls->payment_path_failed_meth != NULL);
4130         calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "(JJ)V");
4131         CHECK(calls->payment_path_successful_meth != NULL);
4132         calls->probe_failed_meth = (*env)->GetMethodID(env, c, "probe_failed", "(JJJ)V");
4133         CHECK(calls->probe_failed_meth != NULL);
4134         calls->probe_successful_meth = (*env)->GetMethodID(env, c, "probe_successful", "(JJ)V");
4135         CHECK(calls->probe_successful_meth != NULL);
4136         calls->time_passed_meth = (*env)->GetMethodID(env, c, "time_passed", "(J)V");
4137         CHECK(calls->time_passed_meth != NULL);
4138
4139         LDKScoreUpdate ret = {
4140                 .this_arg = (void*) calls,
4141                 .payment_path_failed = payment_path_failed_LDKScoreUpdate_jcall,
4142                 .payment_path_successful = payment_path_successful_LDKScoreUpdate_jcall,
4143                 .probe_failed = probe_failed_LDKScoreUpdate_jcall,
4144                 .probe_successful = probe_successful_LDKScoreUpdate_jcall,
4145                 .time_passed = time_passed_LDKScoreUpdate_jcall,
4146                 .free = LDKScoreUpdate_JCalls_free,
4147         };
4148         return ret;
4149 }
4150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScoreUpdate_1new(JNIEnv *env, jclass clz, jobject o) {
4151         LDKScoreUpdate *res_ptr = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
4152         *res_ptr = LDKScoreUpdate_init(env, clz, o);
4153         return tag_ptr(res_ptr, true);
4154 }
4155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1payment_1path_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path, int64_t short_channel_id, int64_t duration_since_epoch) {
4156         void* this_arg_ptr = untag_ptr(this_arg);
4157         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4158         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4159         LDKPath path_conv;
4160         path_conv.inner = untag_ptr(path);
4161         path_conv.is_owned = ptr_is_owned(path);
4162         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4163         path_conv.is_owned = false;
4164         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
4165 }
4166
4167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path, int64_t duration_since_epoch) {
4168         void* this_arg_ptr = untag_ptr(this_arg);
4169         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4170         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4171         LDKPath path_conv;
4172         path_conv.inner = untag_ptr(path);
4173         path_conv.is_owned = ptr_is_owned(path);
4174         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4175         path_conv.is_owned = false;
4176         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
4177 }
4178
4179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1probe_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path, int64_t short_channel_id, int64_t duration_since_epoch) {
4180         void* this_arg_ptr = untag_ptr(this_arg);
4181         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4182         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4183         LDKPath path_conv;
4184         path_conv.inner = untag_ptr(path);
4185         path_conv.is_owned = ptr_is_owned(path);
4186         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4187         path_conv.is_owned = false;
4188         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
4189 }
4190
4191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1probe_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path, int64_t duration_since_epoch) {
4192         void* this_arg_ptr = untag_ptr(this_arg);
4193         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4194         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4195         LDKPath path_conv;
4196         path_conv.inner = untag_ptr(path);
4197         path_conv.is_owned = ptr_is_owned(path);
4198         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4199         path_conv.is_owned = false;
4200         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
4201 }
4202
4203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1time_1passed(JNIEnv *env, jclass clz, int64_t this_arg, int64_t duration_since_epoch) {
4204         void* this_arg_ptr = untag_ptr(this_arg);
4205         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4206         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4207         (this_arg_conv->time_passed)(this_arg_conv->this_arg, duration_since_epoch);
4208 }
4209
4210 typedef struct LDKLockableScore_JCalls {
4211         atomic_size_t refcnt;
4212         JavaVM *vm;
4213         jweak o;
4214         jmethodID read_lock_meth;
4215         jmethodID write_lock_meth;
4216 } LDKLockableScore_JCalls;
4217 static void LDKLockableScore_JCalls_free(void* this_arg) {
4218         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4219         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4220                 JNIEnv *env;
4221                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4222                 if (get_jenv_res == JNI_EDETACHED) {
4223                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4224                 } else {
4225                         DO_ASSERT(get_jenv_res == JNI_OK);
4226                 }
4227                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4228                 if (get_jenv_res == JNI_EDETACHED) {
4229                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4230                 }
4231                 FREE(j_calls);
4232         }
4233 }
4234 LDKScoreLookUp read_lock_LDKLockableScore_jcall(const void* this_arg) {
4235         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4236         JNIEnv *env;
4237         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4238         if (get_jenv_res == JNI_EDETACHED) {
4239                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4240         } else {
4241                 DO_ASSERT(get_jenv_res == JNI_OK);
4242         }
4243         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4244         CHECK(obj != NULL);
4245         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_lock_meth);
4246         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4247                 (*env)->ExceptionDescribe(env);
4248                 (*env)->FatalError(env, "A call to read_lock in LDKLockableScore from rust threw an exception.");
4249         }
4250         void* ret_ptr = untag_ptr(ret);
4251         CHECK_ACCESS(ret_ptr);
4252         LDKScoreLookUp ret_conv = *(LDKScoreLookUp*)(ret_ptr);
4253         if (ret_conv.free == LDKScoreLookUp_JCalls_free) {
4254                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4255                 LDKScoreLookUp_JCalls_cloned(&ret_conv);
4256         }// WARNING: we may need a move here but no clone is available for LDKScoreLookUp
4257         
4258         if (get_jenv_res == JNI_EDETACHED) {
4259                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4260         }
4261         return ret_conv;
4262 }
4263 LDKScoreUpdate write_lock_LDKLockableScore_jcall(const void* this_arg) {
4264         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4265         JNIEnv *env;
4266         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4267         if (get_jenv_res == JNI_EDETACHED) {
4268                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4269         } else {
4270                 DO_ASSERT(get_jenv_res == JNI_OK);
4271         }
4272         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4273         CHECK(obj != NULL);
4274         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->write_lock_meth);
4275         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4276                 (*env)->ExceptionDescribe(env);
4277                 (*env)->FatalError(env, "A call to write_lock in LDKLockableScore from rust threw an exception.");
4278         }
4279         void* ret_ptr = untag_ptr(ret);
4280         CHECK_ACCESS(ret_ptr);
4281         LDKScoreUpdate ret_conv = *(LDKScoreUpdate*)(ret_ptr);
4282         if (ret_conv.free == LDKScoreUpdate_JCalls_free) {
4283                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4284                 LDKScoreUpdate_JCalls_cloned(&ret_conv);
4285         }// WARNING: we may need a move here but no clone is available for LDKScoreUpdate
4286         
4287         if (get_jenv_res == JNI_EDETACHED) {
4288                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4289         }
4290         return ret_conv;
4291 }
4292 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
4293         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
4294         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4295 }
4296 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
4297         jclass c = (*env)->GetObjectClass(env, o);
4298         CHECK(c != NULL);
4299         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
4300         atomic_init(&calls->refcnt, 1);
4301         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4302         calls->o = (*env)->NewWeakGlobalRef(env, o);
4303         calls->read_lock_meth = (*env)->GetMethodID(env, c, "read_lock", "()J");
4304         CHECK(calls->read_lock_meth != NULL);
4305         calls->write_lock_meth = (*env)->GetMethodID(env, c, "write_lock", "()J");
4306         CHECK(calls->write_lock_meth != NULL);
4307
4308         LDKLockableScore ret = {
4309                 .this_arg = (void*) calls,
4310                 .read_lock = read_lock_LDKLockableScore_jcall,
4311                 .write_lock = write_lock_LDKLockableScore_jcall,
4312                 .free = LDKLockableScore_JCalls_free,
4313         };
4314         return ret;
4315 }
4316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
4317         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
4318         *res_ptr = LDKLockableScore_init(env, clz, o);
4319         return tag_ptr(res_ptr, true);
4320 }
4321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1read_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
4322         void* this_arg_ptr = untag_ptr(this_arg);
4323         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4324         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
4325         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
4326         *ret_ret = (this_arg_conv->read_lock)(this_arg_conv->this_arg);
4327         return tag_ptr(ret_ret, true);
4328 }
4329
4330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1write_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
4331         void* this_arg_ptr = untag_ptr(this_arg);
4332         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4333         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
4334         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
4335         *ret_ret = (this_arg_conv->write_lock)(this_arg_conv->this_arg);
4336         return tag_ptr(ret_ret, true);
4337 }
4338
4339 typedef struct LDKWriteableScore_JCalls {
4340         atomic_size_t refcnt;
4341         JavaVM *vm;
4342         jweak o;
4343         LDKLockableScore_JCalls* LockableScore;
4344         jmethodID write_meth;
4345 } LDKWriteableScore_JCalls;
4346 static void LDKWriteableScore_JCalls_free(void* this_arg) {
4347         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
4348         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4349                 JNIEnv *env;
4350                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4351                 if (get_jenv_res == JNI_EDETACHED) {
4352                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4353                 } else {
4354                         DO_ASSERT(get_jenv_res == JNI_OK);
4355                 }
4356                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4357                 if (get_jenv_res == JNI_EDETACHED) {
4358                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4359                 }
4360                 FREE(j_calls);
4361         }
4362 }
4363 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
4364         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
4365         JNIEnv *env;
4366         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4367         if (get_jenv_res == JNI_EDETACHED) {
4368                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4369         } else {
4370                 DO_ASSERT(get_jenv_res == JNI_OK);
4371         }
4372         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4373         CHECK(obj != NULL);
4374         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
4375         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4376                 (*env)->ExceptionDescribe(env);
4377                 (*env)->FatalError(env, "A call to write in LDKWriteableScore from rust threw an exception.");
4378         }
4379         LDKCVec_u8Z ret_ref;
4380         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4381         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4382         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4383         if (get_jenv_res == JNI_EDETACHED) {
4384                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4385         }
4386         return ret_ref;
4387 }
4388 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
4389         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
4390         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4391         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
4392 }
4393 static inline LDKWriteableScore LDKWriteableScore_init (JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
4394         jclass c = (*env)->GetObjectClass(env, o);
4395         CHECK(c != NULL);
4396         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
4397         atomic_init(&calls->refcnt, 1);
4398         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4399         calls->o = (*env)->NewWeakGlobalRef(env, o);
4400         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
4401         CHECK(calls->write_meth != NULL);
4402
4403         LDKWriteableScore ret = {
4404                 .this_arg = (void*) calls,
4405                 .write = write_LDKWriteableScore_jcall,
4406                 .free = LDKWriteableScore_JCalls_free,
4407                 .LockableScore = LDKLockableScore_init(env, clz, LockableScore),
4408         };
4409         calls->LockableScore = ret.LockableScore.this_arg;
4410         return ret;
4411 }
4412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1new(JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
4413         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
4414         *res_ptr = LDKWriteableScore_init(env, clz, o, LockableScore);
4415         return tag_ptr(res_ptr, true);
4416 }
4417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1get_1LockableScore(JNIEnv *env, jclass clz, int64_t arg) {
4418         LDKWriteableScore *inp = (LDKWriteableScore *)untag_ptr(arg);
4419         return tag_ptr(&inp->LockableScore, false);
4420 }
4421 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableScore_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
4422         void* this_arg_ptr = untag_ptr(this_arg);
4423         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4424         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
4425         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4426         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4427         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4428         CVec_u8Z_free(ret_var);
4429         return ret_arr;
4430 }
4431
4432 static jclass LDKCOption_WriteableScoreZ_Some_class = NULL;
4433 static jmethodID LDKCOption_WriteableScoreZ_Some_meth = NULL;
4434 static jclass LDKCOption_WriteableScoreZ_None_class = NULL;
4435 static jmethodID LDKCOption_WriteableScoreZ_None_meth = NULL;
4436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1WriteableScoreZ_init (JNIEnv *env, jclass clz) {
4437         LDKCOption_WriteableScoreZ_Some_class =
4438                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$Some"));
4439         CHECK(LDKCOption_WriteableScoreZ_Some_class != NULL);
4440         LDKCOption_WriteableScoreZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_Some_class, "<init>", "(J)V");
4441         CHECK(LDKCOption_WriteableScoreZ_Some_meth != NULL);
4442         LDKCOption_WriteableScoreZ_None_class =
4443                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$None"));
4444         CHECK(LDKCOption_WriteableScoreZ_None_class != NULL);
4445         LDKCOption_WriteableScoreZ_None_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_None_class, "<init>", "()V");
4446         CHECK(LDKCOption_WriteableScoreZ_None_meth != NULL);
4447 }
4448 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1WriteableScoreZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4449         LDKCOption_WriteableScoreZ *obj = (LDKCOption_WriteableScoreZ*)untag_ptr(ptr);
4450         switch(obj->tag) {
4451                 case LDKCOption_WriteableScoreZ_Some: {
4452                         LDKWriteableScore* some_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
4453                         *some_ret = obj->some;
4454                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
4455                         if ((*some_ret).free == LDKWriteableScore_JCalls_free) {
4456                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4457                                 LDKWriteableScore_JCalls_cloned(&(*some_ret));
4458                         }
4459                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_Some_class, LDKCOption_WriteableScoreZ_Some_meth, tag_ptr(some_ret, true));
4460                 }
4461                 case LDKCOption_WriteableScoreZ_None: {
4462                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_None_class, LDKCOption_WriteableScoreZ_None_meth);
4463                 }
4464                 default: abort();
4465         }
4466 }
4467 static inline void CResult_NoneIOErrorZ_get_ok(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
4468 CHECK(owner->result_ok);
4469         return *owner->contents.result;
4470 }
4471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4472         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
4473         CResult_NoneIOErrorZ_get_ok(owner_conv);
4474 }
4475
4476 static inline enum LDKIOError CResult_NoneIOErrorZ_get_err(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
4477 CHECK(!owner->result_ok);
4478         return *owner->contents.err;
4479 }
4480 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4481         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
4482         jclass ret_conv = LDKIOError_to_java(env, CResult_NoneIOErrorZ_get_err(owner_conv));
4483         return ret_conv;
4484 }
4485
4486 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
4487         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
4488         for (size_t i = 0; i < ret.datalen; i++) {
4489                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
4490         }
4491         return ret;
4492 }
4493 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
4494         LDKRoute ret = *owner->contents.result;
4495         ret.is_owned = false;
4496         return ret;
4497 }
4498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4499         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
4500         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
4501         int64_t ret_ref = 0;
4502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4504         return ret_ref;
4505 }
4506
4507 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
4508         LDKLightningError ret = *owner->contents.err;
4509         ret.is_owned = false;
4510         return ret;
4511 }
4512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4513         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
4514         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
4515         int64_t ret_ref = 0;
4516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4518         return ret_ref;
4519 }
4520
4521 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
4522         LDKBlindedPayInfo ret = owner->a;
4523         ret.is_owned = false;
4524         return ret;
4525 }
4526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4527         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
4528         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
4529         int64_t ret_ref = 0;
4530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4532         return ret_ref;
4533 }
4534
4535 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
4536         LDKBlindedPath ret = owner->b;
4537         ret.is_owned = false;
4538         return ret;
4539 }
4540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4541         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
4542         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
4543         int64_t ret_ref = 0;
4544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4546         return ret_ref;
4547 }
4548
4549 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
4550         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
4551         for (size_t i = 0; i < ret.datalen; i++) {
4552                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
4553         }
4554         return ret;
4555 }
4556 static inline struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
4557 CHECK(owner->result_ok);
4558         return CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(&*owner->contents.result);
4559 }
4560 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4561         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
4562         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret_var = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(owner_conv);
4563         int64_tArray ret_arr = NULL;
4564         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4565         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4566         for (size_t l = 0; l < ret_var.datalen; l++) {
4567                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
4568                 *ret_conv_37_conv = ret_var.data[l];
4569                 ret_arr_ptr[l] = tag_ptr(ret_conv_37_conv, true);
4570         }
4571         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4572         FREE(ret_var.data);
4573         return ret_arr;
4574 }
4575
4576 static inline void CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
4577 CHECK(!owner->result_ok);
4578         return *owner->contents.err;
4579 }
4580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4581         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
4582         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(owner_conv);
4583 }
4584
4585 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
4586         LDKOnionMessagePath ret = *owner->contents.result;
4587         ret.is_owned = false;
4588         return ret;
4589 }
4590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4591         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
4592         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
4593         int64_t ret_ref = 0;
4594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4596         return ret_ref;
4597 }
4598
4599 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
4600 CHECK(!owner->result_ok);
4601         return *owner->contents.err;
4602 }
4603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4604         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
4605         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
4606 }
4607
4608 static inline struct LDKCVec_BlindedPathZ CResult_CVec_BlindedPathZNoneZ_get_ok(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
4609 CHECK(owner->result_ok);
4610         return CVec_BlindedPathZ_clone(&*owner->contents.result);
4611 }
4612 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4613         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
4614         LDKCVec_BlindedPathZ ret_var = CResult_CVec_BlindedPathZNoneZ_get_ok(owner_conv);
4615         int64_tArray ret_arr = NULL;
4616         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4617         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4618         for (size_t n = 0; n < ret_var.datalen; n++) {
4619                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
4620                 int64_t ret_conv_13_ref = 0;
4621                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
4622                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
4623                 ret_arr_ptr[n] = ret_conv_13_ref;
4624         }
4625         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4626         FREE(ret_var.data);
4627         return ret_arr;
4628 }
4629
4630 static inline void CResult_CVec_BlindedPathZNoneZ_get_err(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
4631 CHECK(!owner->result_ok);
4632         return *owner->contents.err;
4633 }
4634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4635         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
4636         CResult_CVec_BlindedPathZNoneZ_get_err(owner_conv);
4637 }
4638
4639 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
4640         LDKInFlightHtlcs ret = *owner->contents.result;
4641         ret.is_owned = false;
4642         return ret;
4643 }
4644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4645         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
4646         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
4647         int64_t ret_ref = 0;
4648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4650         return ret_ref;
4651 }
4652
4653 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
4654 CHECK(!owner->result_ok);
4655         return DecodeError_clone(&*owner->contents.err);
4656 }
4657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4658         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
4659         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4660         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
4661         int64_t ret_ref = tag_ptr(ret_copy, true);
4662         return ret_ref;
4663 }
4664
4665 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
4666         LDKRouteHop ret = *owner->contents.result;
4667         ret.is_owned = false;
4668         return ret;
4669 }
4670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4671         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
4672         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
4673         int64_t ret_ref = 0;
4674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4676         return ret_ref;
4677 }
4678
4679 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
4680 CHECK(!owner->result_ok);
4681         return DecodeError_clone(&*owner->contents.err);
4682 }
4683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4684         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
4685         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4686         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
4687         int64_t ret_ref = tag_ptr(ret_copy, true);
4688         return ret_ref;
4689 }
4690
4691 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
4692         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
4693         for (size_t i = 0; i < ret.datalen; i++) {
4694                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
4695         }
4696         return ret;
4697 }
4698 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
4699         LDKBlindedTail ret = *owner->contents.result;
4700         ret.is_owned = false;
4701         return ret;
4702 }
4703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4704         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
4705         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
4706         int64_t ret_ref = 0;
4707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4709         return ret_ref;
4710 }
4711
4712 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
4713 CHECK(!owner->result_ok);
4714         return DecodeError_clone(&*owner->contents.err);
4715 }
4716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4717         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
4718         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4719         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
4720         int64_t ret_ref = tag_ptr(ret_copy, true);
4721         return ret_ref;
4722 }
4723
4724 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
4725         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
4726         for (size_t i = 0; i < ret.datalen; i++) {
4727                 ret.data[i] = RouteHop_clone(&orig->data[i]);
4728         }
4729         return ret;
4730 }
4731 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
4732         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
4733         for (size_t i = 0; i < ret.datalen; i++) {
4734                 ret.data[i] = Path_clone(&orig->data[i]);
4735         }
4736         return ret;
4737 }
4738 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
4739         LDKRoute ret = *owner->contents.result;
4740         ret.is_owned = false;
4741         return ret;
4742 }
4743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4744         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
4745         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
4746         int64_t ret_ref = 0;
4747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4749         return ret_ref;
4750 }
4751
4752 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
4753 CHECK(!owner->result_ok);
4754         return DecodeError_clone(&*owner->contents.err);
4755 }
4756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4757         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
4758         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4759         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
4760         int64_t ret_ref = tag_ptr(ret_copy, true);
4761         return ret_ref;
4762 }
4763
4764 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
4765         LDKRouteParameters ret = *owner->contents.result;
4766         ret.is_owned = false;
4767         return ret;
4768 }
4769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4770         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
4771         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
4772         int64_t ret_ref = 0;
4773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4775         return ret_ref;
4776 }
4777
4778 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
4779 CHECK(!owner->result_ok);
4780         return DecodeError_clone(&*owner->contents.err);
4781 }
4782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4783         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
4784         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4785         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
4786         int64_t ret_ref = tag_ptr(ret_copy, true);
4787         return ret_ref;
4788 }
4789
4790 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
4791         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
4792         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
4793         return ret;
4794 }
4795 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
4796         LDKPaymentParameters ret = *owner->contents.result;
4797         ret.is_owned = false;
4798         return ret;
4799 }
4800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4801         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
4802         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
4803         int64_t ret_ref = 0;
4804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4806         return ret_ref;
4807 }
4808
4809 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
4810 CHECK(!owner->result_ok);
4811         return DecodeError_clone(&*owner->contents.err);
4812 }
4813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4814         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
4815         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4816         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
4817         int64_t ret_ref = tag_ptr(ret_copy, true);
4818         return ret_ref;
4819 }
4820
4821 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
4822         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
4823         for (size_t i = 0; i < ret.datalen; i++) {
4824                 ret.data[i] = RouteHint_clone(&orig->data[i]);
4825         }
4826         return ret;
4827 }
4828 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
4829         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
4830         for (size_t i = 0; i < ret.datalen; i++) {
4831                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
4832         }
4833         return ret;
4834 }
4835 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
4836         LDKRouteHint ret = *owner->contents.result;
4837         ret.is_owned = false;
4838         return ret;
4839 }
4840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4841         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
4842         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
4843         int64_t ret_ref = 0;
4844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4846         return ret_ref;
4847 }
4848
4849 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
4850 CHECK(!owner->result_ok);
4851         return DecodeError_clone(&*owner->contents.err);
4852 }
4853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4854         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
4855         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4856         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
4857         int64_t ret_ref = tag_ptr(ret_copy, true);
4858         return ret_ref;
4859 }
4860
4861 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
4862         LDKRouteHintHop ret = *owner->contents.result;
4863         ret.is_owned = false;
4864         return ret;
4865 }
4866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4867         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
4868         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
4869         int64_t ret_ref = 0;
4870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4872         return ret_ref;
4873 }
4874
4875 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
4876 CHECK(!owner->result_ok);
4877         return DecodeError_clone(&*owner->contents.err);
4878 }
4879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4880         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
4881         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4882         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
4883         int64_t ret_ref = tag_ptr(ret_copy, true);
4884         return ret_ref;
4885 }
4886
4887 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
4888         LDKFixedPenaltyScorer ret = *owner->contents.result;
4889         ret.is_owned = false;
4890         return ret;
4891 }
4892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4893         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
4894         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
4895         int64_t ret_ref = 0;
4896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4898         return ret_ref;
4899 }
4900
4901 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
4902 CHECK(!owner->result_ok);
4903         return DecodeError_clone(&*owner->contents.err);
4904 }
4905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4906         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
4907         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4908         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
4909         int64_t ret_ref = tag_ptr(ret_copy, true);
4910         return ret_ref;
4911 }
4912
4913 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
4914         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
4915         for (size_t i = 0; i < ret.datalen; i++) {
4916                 ret.data[i] = NodeId_clone(&orig->data[i]);
4917         }
4918         return ret;
4919 }
4920 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
4921         return owner->a;
4922 }
4923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4924         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
4925         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
4926         return ret_conv;
4927 }
4928
4929 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
4930         return owner->b;
4931 }
4932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4933         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
4934         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
4935         return ret_conv;
4936 }
4937
4938 static jclass LDKCOption_C2Tuple_u64u64ZZ_Some_class = NULL;
4939 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_Some_meth = NULL;
4940 static jclass LDKCOption_C2Tuple_u64u64ZZ_None_class = NULL;
4941 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_None_meth = NULL;
4942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u64ZZ_init (JNIEnv *env, jclass clz) {
4943         LDKCOption_C2Tuple_u64u64ZZ_Some_class =
4944                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$Some"));
4945         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_class != NULL);
4946         LDKCOption_C2Tuple_u64u64ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, "<init>", "(J)V");
4947         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_meth != NULL);
4948         LDKCOption_C2Tuple_u64u64ZZ_None_class =
4949                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$None"));
4950         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_class != NULL);
4951         LDKCOption_C2Tuple_u64u64ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, "<init>", "()V");
4952         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_meth != NULL);
4953 }
4954 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u64ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4955         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
4956         switch(obj->tag) {
4957                 case LDKCOption_C2Tuple_u64u64ZZ_Some: {
4958                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
4959                         *some_conv = obj->some;
4960                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
4961                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, LDKCOption_C2Tuple_u64u64ZZ_Some_meth, tag_ptr(some_conv, true));
4962                 }
4963                 case LDKCOption_C2Tuple_u64u64ZZ_None: {
4964                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, LDKCOption_C2Tuple_u64u64ZZ_None_meth);
4965                 }
4966                 default: abort();
4967         }
4968 }
4969 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
4970         return owner->a;
4971 }
4972 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4973         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
4974         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
4975         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple_Z_get_a(owner_conv).data);
4976         return ret_arr;
4977 }
4978
4979 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
4980         return owner->b;
4981 }
4982 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4983         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
4984         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
4985         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple_Z_get_b(owner_conv).data);
4986         return ret_arr;
4987 }
4988
4989 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_a(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
4990         return owner->a;
4991 }
4992 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4993         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
4994         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
4995         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple__u1632_u1632Z_get_a(owner_conv).data);
4996         return ret_arr;
4997 }
4998
4999 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_b(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
5000         return owner->b;
5001 }
5002 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5003         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
5004         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
5005         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple__u1632_u1632Z_get_b(owner_conv).data);
5006         return ret_arr;
5007 }
5008
5009 static jclass LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class = NULL;
5010 static jmethodID LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth = NULL;
5011 static jclass LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class = NULL;
5012 static jmethodID LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth = NULL;
5013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_init (JNIEnv *env, jclass clz) {
5014         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class =
5015                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ$Some"));
5016         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class != NULL);
5017         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class, "<init>", "(J)V");
5018         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth != NULL);
5019         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class =
5020                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ$None"));
5021         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class != NULL);
5022         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class, "<init>", "()V");
5023         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth != NULL);
5024 }
5025 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5026         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
5027         switch(obj->tag) {
5028                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some: {
5029                         LDKC2Tuple__u1632_u1632Z* some_conv = &obj->some;
5030                         // WARNING: we really need to clone here, but no clone is available for LDKC2Tuple__u1632_u1632Z
5031                         return (*env)->NewObject(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth, tag_ptr(some_conv, false));
5032                 }
5033                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None: {
5034                         return (*env)->NewObject(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth);
5035                 }
5036                 default: abort();
5037         }
5038 }
5039 static jclass LDKCOption_f64Z_Some_class = NULL;
5040 static jmethodID LDKCOption_f64Z_Some_meth = NULL;
5041 static jclass LDKCOption_f64Z_None_class = NULL;
5042 static jmethodID LDKCOption_f64Z_None_meth = NULL;
5043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1f64Z_init (JNIEnv *env, jclass clz) {
5044         LDKCOption_f64Z_Some_class =
5045                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_f64Z$Some"));
5046         CHECK(LDKCOption_f64Z_Some_class != NULL);
5047         LDKCOption_f64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_f64Z_Some_class, "<init>", "(D)V");
5048         CHECK(LDKCOption_f64Z_Some_meth != NULL);
5049         LDKCOption_f64Z_None_class =
5050                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_f64Z$None"));
5051         CHECK(LDKCOption_f64Z_None_class != NULL);
5052         LDKCOption_f64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_f64Z_None_class, "<init>", "()V");
5053         CHECK(LDKCOption_f64Z_None_meth != NULL);
5054 }
5055 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1f64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5056         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
5057         switch(obj->tag) {
5058                 case LDKCOption_f64Z_Some: {
5059                         double some_conv = obj->some;
5060                         return (*env)->NewObject(env, LDKCOption_f64Z_Some_class, LDKCOption_f64Z_Some_meth, some_conv);
5061                 }
5062                 case LDKCOption_f64Z_None: {
5063                         return (*env)->NewObject(env, LDKCOption_f64Z_None_class, LDKCOption_f64Z_None_meth);
5064                 }
5065                 default: abort();
5066         }
5067 }
5068 typedef struct LDKLogger_JCalls {
5069         atomic_size_t refcnt;
5070         JavaVM *vm;
5071         jweak o;
5072         jmethodID log_meth;
5073 } LDKLogger_JCalls;
5074 static void LDKLogger_JCalls_free(void* this_arg) {
5075         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
5076         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5077                 JNIEnv *env;
5078                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5079                 if (get_jenv_res == JNI_EDETACHED) {
5080                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5081                 } else {
5082                         DO_ASSERT(get_jenv_res == JNI_OK);
5083                 }
5084                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5085                 if (get_jenv_res == JNI_EDETACHED) {
5086                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5087                 }
5088                 FREE(j_calls);
5089         }
5090 }
5091 void log_LDKLogger_jcall(const void* this_arg, LDKRecord record) {
5092         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
5093         JNIEnv *env;
5094         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5095         if (get_jenv_res == JNI_EDETACHED) {
5096                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5097         } else {
5098                 DO_ASSERT(get_jenv_res == JNI_OK);
5099         }
5100         LDKRecord record_var = record;
5101         int64_t record_ref = 0;
5102         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
5103         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
5104         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5105         CHECK(obj != NULL);
5106         (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
5107         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5108                 (*env)->ExceptionDescribe(env);
5109                 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
5110         }
5111         if (get_jenv_res == JNI_EDETACHED) {
5112                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5113         }
5114 }
5115 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
5116         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
5117         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5118 }
5119 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
5120         jclass c = (*env)->GetObjectClass(env, o);
5121         CHECK(c != NULL);
5122         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
5123         atomic_init(&calls->refcnt, 1);
5124         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5125         calls->o = (*env)->NewWeakGlobalRef(env, o);
5126         calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
5127         CHECK(calls->log_meth != NULL);
5128
5129         LDKLogger ret = {
5130                 .this_arg = (void*) calls,
5131                 .log = log_LDKLogger_jcall,
5132                 .free = LDKLogger_JCalls_free,
5133         };
5134         return ret;
5135 }
5136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
5137         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
5138         *res_ptr = LDKLogger_init(env, clz, o);
5139         return tag_ptr(res_ptr, true);
5140 }
5141 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
5142         LDKProbabilisticScorer ret = *owner->contents.result;
5143         ret.is_owned = false;
5144         return ret;
5145 }
5146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5147         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
5148         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
5149         int64_t ret_ref = 0;
5150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5152         return ret_ref;
5153 }
5154
5155 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
5156 CHECK(!owner->result_ok);
5157         return DecodeError_clone(&*owner->contents.err);
5158 }
5159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5160         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
5161         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5162         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
5163         int64_t ret_ref = tag_ptr(ret_copy, true);
5164         return ret_ref;
5165 }
5166
5167 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
5168         return owner->a;
5169 }
5170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5171         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
5172         int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
5173         return ret_conv;
5174 }
5175
5176 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
5177         return owner->b;
5178 }
5179 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5180         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
5181         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
5182         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5183         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5184         return ret_arr;
5185 }
5186
5187 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
5188         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
5189         for (size_t i = 0; i < ret.datalen; i++) {
5190                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
5191         }
5192         return ret;
5193 }
5194 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
5195         return ThirtyTwoBytes_clone(&owner->a);
5196 }
5197 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5198         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
5199         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5200         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(owner_conv).data);
5201         return ret_arr;
5202 }
5203
5204 static inline uint32_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
5205         return owner->b;
5206 }
5207 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5208         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
5209         int32_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(owner_conv);
5210         return ret_conv;
5211 }
5212
5213 static inline struct LDKCOption_ThirtyTwoBytesZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
5214         return COption_ThirtyTwoBytesZ_clone(&owner->c);
5215 }
5216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
5217         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
5218         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
5219         *ret_copy = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(owner_conv);
5220         int64_t ret_ref = tag_ptr(ret_copy, true);
5221         return ret_ref;
5222 }
5223
5224 static inline LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_clone(const LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ *orig) {
5225         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) * orig->datalen, "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ clone bytes"), .datalen = orig->datalen };
5226         for (size_t i = 0; i < ret.datalen; i++) {
5227                 ret.data[i] = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(&orig->data[i]);
5228         }
5229         return ret;
5230 }
5231 static inline enum LDKChannelMonitorUpdateStatus CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
5232 CHECK(owner->result_ok);
5233         return ChannelMonitorUpdateStatus_clone(&*owner->contents.result);
5234 }
5235 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5236         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
5237         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(owner_conv));
5238         return ret_conv;
5239 }
5240
5241 static inline void CResult_ChannelMonitorUpdateStatusNoneZ_get_err(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
5242 CHECK(!owner->result_ok);
5243         return *owner->contents.err;
5244 }
5245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5246         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
5247         CResult_ChannelMonitorUpdateStatusNoneZ_get_err(owner_conv);
5248 }
5249
5250 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
5251 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
5252 static jclass LDKMonitorEvent_HolderForceClosed_class = NULL;
5253 static jmethodID LDKMonitorEvent_HolderForceClosed_meth = NULL;
5254 static jclass LDKMonitorEvent_Completed_class = NULL;
5255 static jmethodID LDKMonitorEvent_Completed_meth = NULL;
5256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
5257         LDKMonitorEvent_HTLCEvent_class =
5258                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
5259         CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
5260         LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
5261         CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
5262         LDKMonitorEvent_HolderForceClosed_class =
5263                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HolderForceClosed"));
5264         CHECK(LDKMonitorEvent_HolderForceClosed_class != NULL);
5265         LDKMonitorEvent_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HolderForceClosed_class, "<init>", "(J)V");
5266         CHECK(LDKMonitorEvent_HolderForceClosed_meth != NULL);
5267         LDKMonitorEvent_Completed_class =
5268                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$Completed"));
5269         CHECK(LDKMonitorEvent_Completed_class != NULL);
5270         LDKMonitorEvent_Completed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_Completed_class, "<init>", "(JJ)V");
5271         CHECK(LDKMonitorEvent_Completed_meth != NULL);
5272 }
5273 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5274         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
5275         switch(obj->tag) {
5276                 case LDKMonitorEvent_HTLCEvent: {
5277                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
5278                         int64_t htlc_event_ref = 0;
5279                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
5280                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
5281                         return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
5282                 }
5283                 case LDKMonitorEvent_HolderForceClosed: {
5284                         LDKOutPoint holder_force_closed_var = obj->holder_force_closed;
5285                         int64_t holder_force_closed_ref = 0;
5286                         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_force_closed_var);
5287                         holder_force_closed_ref = tag_ptr(holder_force_closed_var.inner, false);
5288                         return (*env)->NewObject(env, LDKMonitorEvent_HolderForceClosed_class, LDKMonitorEvent_HolderForceClosed_meth, holder_force_closed_ref);
5289                 }
5290                 case LDKMonitorEvent_Completed: {
5291                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
5292                         int64_t funding_txo_ref = 0;
5293                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5294                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
5295                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
5296                         return (*env)->NewObject(env, LDKMonitorEvent_Completed_class, LDKMonitorEvent_Completed_meth, funding_txo_ref, monitor_update_id_conv);
5297                 }
5298                 default: abort();
5299         }
5300 }
5301 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
5302         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
5303         for (size_t i = 0; i < ret.datalen; i++) {
5304                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
5305         }
5306         return ret;
5307 }
5308 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5309         LDKOutPoint ret = owner->a;
5310         ret.is_owned = false;
5311         return ret;
5312 }
5313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5314         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5315         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
5316         int64_t ret_ref = 0;
5317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5319         return ret_ref;
5320 }
5321
5322 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5323         return CVec_MonitorEventZ_clone(&owner->b);
5324 }
5325 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5326         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5327         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
5328         int64_tArray ret_arr = NULL;
5329         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5330         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5331         for (size_t o = 0; o < ret_var.datalen; o++) {
5332                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
5333                 *ret_conv_14_copy = ret_var.data[o];
5334                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
5335                 ret_arr_ptr[o] = ret_conv_14_ref;
5336         }
5337         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5338         FREE(ret_var.data);
5339         return ret_arr;
5340 }
5341
5342 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5343         return owner->c;
5344 }
5345 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
5346         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5347         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5348         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form);
5349         return ret_arr;
5350 }
5351
5352 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
5353         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
5354         for (size_t i = 0; i < ret.datalen; i++) {
5355                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
5356         }
5357         return ret;
5358 }
5359 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
5360         LDKInitFeatures ret = *owner->contents.result;
5361         ret.is_owned = false;
5362         return ret;
5363 }
5364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5365         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
5366         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
5367         int64_t ret_ref = 0;
5368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5370         return ret_ref;
5371 }
5372
5373 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
5374 CHECK(!owner->result_ok);
5375         return DecodeError_clone(&*owner->contents.err);
5376 }
5377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5378         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
5379         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5380         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
5381         int64_t ret_ref = tag_ptr(ret_copy, true);
5382         return ret_ref;
5383 }
5384
5385 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
5386         LDKChannelFeatures ret = *owner->contents.result;
5387         ret.is_owned = false;
5388         return ret;
5389 }
5390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5391         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
5392         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
5393         int64_t ret_ref = 0;
5394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5396         return ret_ref;
5397 }
5398
5399 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
5400 CHECK(!owner->result_ok);
5401         return DecodeError_clone(&*owner->contents.err);
5402 }
5403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5404         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
5405         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5406         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
5407         int64_t ret_ref = tag_ptr(ret_copy, true);
5408         return ret_ref;
5409 }
5410
5411 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5412         LDKNodeFeatures ret = *owner->contents.result;
5413         ret.is_owned = false;
5414         return ret;
5415 }
5416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5417         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
5418         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
5419         int64_t ret_ref = 0;
5420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5422         return ret_ref;
5423 }
5424
5425 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5426 CHECK(!owner->result_ok);
5427         return DecodeError_clone(&*owner->contents.err);
5428 }
5429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5430         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
5431         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5432         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
5433         int64_t ret_ref = tag_ptr(ret_copy, true);
5434         return ret_ref;
5435 }
5436
5437 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5438         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
5439         ret.is_owned = false;
5440         return ret;
5441 }
5442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5443         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5444         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
5445         int64_t ret_ref = 0;
5446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5448         return ret_ref;
5449 }
5450
5451 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5452 CHECK(!owner->result_ok);
5453         return DecodeError_clone(&*owner->contents.err);
5454 }
5455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5456         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5457         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5458         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
5459         int64_t ret_ref = tag_ptr(ret_copy, true);
5460         return ret_ref;
5461 }
5462
5463 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5464         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
5465         ret.is_owned = false;
5466         return ret;
5467 }
5468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5469         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5470         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
5471         int64_t ret_ref = 0;
5472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5474         return ret_ref;
5475 }
5476
5477 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5478 CHECK(!owner->result_ok);
5479         return DecodeError_clone(&*owner->contents.err);
5480 }
5481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5482         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5483         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5484         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
5485         int64_t ret_ref = tag_ptr(ret_copy, true);
5486         return ret_ref;
5487 }
5488
5489 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
5490         LDKBlindedHopFeatures ret = *owner->contents.result;
5491         ret.is_owned = false;
5492         return ret;
5493 }
5494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5495         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
5496         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
5497         int64_t ret_ref = 0;
5498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5500         return ret_ref;
5501 }
5502
5503 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
5504 CHECK(!owner->result_ok);
5505         return DecodeError_clone(&*owner->contents.err);
5506 }
5507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5508         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
5509         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5510         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
5511         int64_t ret_ref = tag_ptr(ret_copy, true);
5512         return ret_ref;
5513 }
5514
5515 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5516         LDKChannelTypeFeatures ret = *owner->contents.result;
5517         ret.is_owned = false;
5518         return ret;
5519 }
5520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5521         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
5522         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
5523         int64_t ret_ref = 0;
5524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5526         return ret_ref;
5527 }
5528
5529 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5530 CHECK(!owner->result_ok);
5531         return DecodeError_clone(&*owner->contents.err);
5532 }
5533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5534         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
5535         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5536         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
5537         int64_t ret_ref = tag_ptr(ret_copy, true);
5538         return ret_ref;
5539 }
5540
5541 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
5542         LDKOffer ret = *owner->contents.result;
5543         ret.is_owned = false;
5544         return ret;
5545 }
5546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5547         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
5548         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
5549         int64_t ret_ref = 0;
5550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5552         return ret_ref;
5553 }
5554
5555 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
5556         LDKBolt12ParseError ret = *owner->contents.err;
5557         ret.is_owned = false;
5558         return ret;
5559 }
5560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5561         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
5562         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
5563         int64_t ret_ref = 0;
5564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5566         return ret_ref;
5567 }
5568
5569 static inline struct LDKPublicKey CResult_PublicKeySecp256k1ErrorZ_get_ok(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
5570 CHECK(owner->result_ok);
5571         return *owner->contents.result;
5572 }
5573 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5574         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
5575         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5576         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeySecp256k1ErrorZ_get_ok(owner_conv).compressed_form);
5577         return ret_arr;
5578 }
5579
5580 static inline enum LDKSecp256k1Error CResult_PublicKeySecp256k1ErrorZ_get_err(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
5581 CHECK(!owner->result_ok);
5582         return *owner->contents.err;
5583 }
5584 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5585         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
5586         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PublicKeySecp256k1ErrorZ_get_err(owner_conv));
5587         return ret_conv;
5588 }
5589
5590 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
5591         LDKNodeId ret = *owner->contents.result;
5592         ret.is_owned = false;
5593         return ret;
5594 }
5595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5596         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
5597         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
5598         int64_t ret_ref = 0;
5599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5601         return ret_ref;
5602 }
5603
5604 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
5605 CHECK(!owner->result_ok);
5606         return DecodeError_clone(&*owner->contents.err);
5607 }
5608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5609         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
5610         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5611         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
5612         int64_t ret_ref = tag_ptr(ret_copy, true);
5613         return ret_ref;
5614 }
5615
5616 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
5617 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
5618 static jclass LDKNetworkUpdate_ChannelFailure_class = NULL;
5619 static jmethodID LDKNetworkUpdate_ChannelFailure_meth = NULL;
5620 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
5621 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
5622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
5623         LDKNetworkUpdate_ChannelUpdateMessage_class =
5624                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
5625         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
5626         LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
5627         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
5628         LDKNetworkUpdate_ChannelFailure_class =
5629                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelFailure"));
5630         CHECK(LDKNetworkUpdate_ChannelFailure_class != NULL);
5631         LDKNetworkUpdate_ChannelFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelFailure_class, "<init>", "(JZ)V");
5632         CHECK(LDKNetworkUpdate_ChannelFailure_meth != NULL);
5633         LDKNetworkUpdate_NodeFailure_class =
5634                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
5635         CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
5636         LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
5637         CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
5638 }
5639 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5640         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
5641         switch(obj->tag) {
5642                 case LDKNetworkUpdate_ChannelUpdateMessage: {
5643                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
5644                         int64_t msg_ref = 0;
5645                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5646                         msg_ref = tag_ptr(msg_var.inner, false);
5647                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
5648                 }
5649                 case LDKNetworkUpdate_ChannelFailure: {
5650                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
5651                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
5652                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelFailure_class, LDKNetworkUpdate_ChannelFailure_meth, short_channel_id_conv, is_permanent_conv);
5653                 }
5654                 case LDKNetworkUpdate_NodeFailure: {
5655                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5656                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
5657                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
5658                         return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv);
5659                 }
5660                 default: abort();
5661         }
5662 }
5663 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
5664 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
5665 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
5666 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
5667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
5668         LDKCOption_NetworkUpdateZ_Some_class =
5669                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
5670         CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
5671         LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
5672         CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
5673         LDKCOption_NetworkUpdateZ_None_class =
5674                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
5675         CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
5676         LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
5677         CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
5678 }
5679 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5680         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
5681         switch(obj->tag) {
5682                 case LDKCOption_NetworkUpdateZ_Some: {
5683                         int64_t some_ref = tag_ptr(&obj->some, false);
5684                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
5685                 }
5686                 case LDKCOption_NetworkUpdateZ_None: {
5687                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
5688                 }
5689                 default: abort();
5690         }
5691 }
5692 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
5693 CHECK(owner->result_ok);
5694         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
5695 }
5696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5697         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
5698         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
5699         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
5700         int64_t ret_ref = tag_ptr(ret_copy, true);
5701         return ret_ref;
5702 }
5703
5704 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
5705 CHECK(!owner->result_ok);
5706         return DecodeError_clone(&*owner->contents.err);
5707 }
5708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5709         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
5710         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5711         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
5712         int64_t ret_ref = tag_ptr(ret_copy, true);
5713         return ret_ref;
5714 }
5715
5716 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
5717 CHECK(owner->result_ok);
5718         return TxOut_clone(&*owner->contents.result);
5719 }
5720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5721         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
5722         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5723         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
5724         return tag_ptr(ret_ref, true);
5725 }
5726
5727 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
5728 CHECK(!owner->result_ok);
5729         return UtxoLookupError_clone(&*owner->contents.err);
5730 }
5731 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5732         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
5733         jclass ret_conv = LDKUtxoLookupError_to_java(env, CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
5734         return ret_conv;
5735 }
5736
5737 static jclass LDKUtxoResult_Sync_class = NULL;
5738 static jmethodID LDKUtxoResult_Sync_meth = NULL;
5739 static jclass LDKUtxoResult_Async_class = NULL;
5740 static jmethodID LDKUtxoResult_Async_meth = NULL;
5741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUtxoResult_init (JNIEnv *env, jclass clz) {
5742         LDKUtxoResult_Sync_class =
5743                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Sync"));
5744         CHECK(LDKUtxoResult_Sync_class != NULL);
5745         LDKUtxoResult_Sync_meth = (*env)->GetMethodID(env, LDKUtxoResult_Sync_class, "<init>", "(J)V");
5746         CHECK(LDKUtxoResult_Sync_meth != NULL);
5747         LDKUtxoResult_Async_class =
5748                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Async"));
5749         CHECK(LDKUtxoResult_Async_class != NULL);
5750         LDKUtxoResult_Async_meth = (*env)->GetMethodID(env, LDKUtxoResult_Async_class, "<init>", "(J)V");
5751         CHECK(LDKUtxoResult_Async_meth != NULL);
5752 }
5753 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUtxoResult_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5754         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
5755         switch(obj->tag) {
5756                 case LDKUtxoResult_Sync: {
5757                         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
5758                         *sync_conv = obj->sync;
5759                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
5760                         return (*env)->NewObject(env, LDKUtxoResult_Sync_class, LDKUtxoResult_Sync_meth, tag_ptr(sync_conv, true));
5761                 }
5762                 case LDKUtxoResult_Async: {
5763                         LDKUtxoFuture async_var = obj->async;
5764                         int64_t async_ref = 0;
5765                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
5766                         async_ref = tag_ptr(async_var.inner, false);
5767                         return (*env)->NewObject(env, LDKUtxoResult_Async_class, LDKUtxoResult_Async_meth, async_ref);
5768                 }
5769                 default: abort();
5770         }
5771 }
5772 typedef struct LDKUtxoLookup_JCalls {
5773         atomic_size_t refcnt;
5774         JavaVM *vm;
5775         jweak o;
5776         jmethodID get_utxo_meth;
5777 } LDKUtxoLookup_JCalls;
5778 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
5779         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
5780         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5781                 JNIEnv *env;
5782                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5783                 if (get_jenv_res == JNI_EDETACHED) {
5784                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5785                 } else {
5786                         DO_ASSERT(get_jenv_res == JNI_OK);
5787                 }
5788                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5789                 if (get_jenv_res == JNI_EDETACHED) {
5790                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5791                 }
5792                 FREE(j_calls);
5793         }
5794 }
5795 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* chain_hash)[32], uint64_t short_channel_id) {
5796         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
5797         JNIEnv *env;
5798         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5799         if (get_jenv_res == JNI_EDETACHED) {
5800                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5801         } else {
5802                 DO_ASSERT(get_jenv_res == JNI_OK);
5803         }
5804         int8_tArray chain_hash_arr = (*env)->NewByteArray(env, 32);
5805         (*env)->SetByteArrayRegion(env, chain_hash_arr, 0, 32, *chain_hash);
5806         int64_t short_channel_id_conv = short_channel_id;
5807         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5808         CHECK(obj != NULL);
5809         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, chain_hash_arr, short_channel_id_conv);
5810         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5811                 (*env)->ExceptionDescribe(env);
5812                 (*env)->FatalError(env, "A call to get_utxo in LDKUtxoLookup from rust threw an exception.");
5813         }
5814         void* ret_ptr = untag_ptr(ret);
5815         CHECK_ACCESS(ret_ptr);
5816         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
5817         FREE(untag_ptr(ret));
5818         if (get_jenv_res == JNI_EDETACHED) {
5819                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5820         }
5821         return ret_conv;
5822 }
5823 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
5824         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
5825         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5826 }
5827 static inline LDKUtxoLookup LDKUtxoLookup_init (JNIEnv *env, jclass clz, jobject o) {
5828         jclass c = (*env)->GetObjectClass(env, o);
5829         CHECK(c != NULL);
5830         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
5831         atomic_init(&calls->refcnt, 1);
5832         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5833         calls->o = (*env)->NewWeakGlobalRef(env, o);
5834         calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
5835         CHECK(calls->get_utxo_meth != NULL);
5836
5837         LDKUtxoLookup ret = {
5838                 .this_arg = (void*) calls,
5839                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
5840                 .free = LDKUtxoLookup_JCalls_free,
5841         };
5842         return ret;
5843 }
5844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKUtxoLookup_1new(JNIEnv *env, jclass clz, jobject o) {
5845         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
5846         *res_ptr = LDKUtxoLookup_init(env, clz, o);
5847         return tag_ptr(res_ptr, true);
5848 }
5849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1get_1utxo(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray chain_hash, int64_t short_channel_id) {
5850         void* this_arg_ptr = untag_ptr(this_arg);
5851         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5852         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
5853         uint8_t chain_hash_arr[32];
5854         CHECK((*env)->GetArrayLength(env, chain_hash) == 32);
5855         (*env)->GetByteArrayRegion(env, chain_hash, 0, 32, chain_hash_arr);
5856         uint8_t (*chain_hash_ref)[32] = &chain_hash_arr;
5857         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
5858         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, chain_hash_ref, short_channel_id);
5859         int64_t ret_ref = tag_ptr(ret_copy, true);
5860         return ret_ref;
5861 }
5862
5863 static jclass LDKCOption_UtxoLookupZ_Some_class = NULL;
5864 static jmethodID LDKCOption_UtxoLookupZ_Some_meth = NULL;
5865 static jclass LDKCOption_UtxoLookupZ_None_class = NULL;
5866 static jmethodID LDKCOption_UtxoLookupZ_None_meth = NULL;
5867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1UtxoLookupZ_init (JNIEnv *env, jclass clz) {
5868         LDKCOption_UtxoLookupZ_Some_class =
5869                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$Some"));
5870         CHECK(LDKCOption_UtxoLookupZ_Some_class != NULL);
5871         LDKCOption_UtxoLookupZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_Some_class, "<init>", "(J)V");
5872         CHECK(LDKCOption_UtxoLookupZ_Some_meth != NULL);
5873         LDKCOption_UtxoLookupZ_None_class =
5874                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$None"));
5875         CHECK(LDKCOption_UtxoLookupZ_None_class != NULL);
5876         LDKCOption_UtxoLookupZ_None_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_None_class, "<init>", "()V");
5877         CHECK(LDKCOption_UtxoLookupZ_None_meth != NULL);
5878 }
5879 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1UtxoLookupZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5880         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
5881         switch(obj->tag) {
5882                 case LDKCOption_UtxoLookupZ_Some: {
5883                         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
5884                         *some_ret = obj->some;
5885                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
5886                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
5887                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5888                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
5889                         }
5890                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_Some_class, LDKCOption_UtxoLookupZ_Some_meth, tag_ptr(some_ret, true));
5891                 }
5892                 case LDKCOption_UtxoLookupZ_None: {
5893                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_None_class, LDKCOption_UtxoLookupZ_None_meth);
5894                 }
5895                 default: abort();
5896         }
5897 }
5898 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5899 CHECK(owner->result_ok);
5900         return *owner->contents.result;
5901 }
5902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5903         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
5904         CResult_NoneLightningErrorZ_get_ok(owner_conv);
5905 }
5906
5907 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5908         LDKLightningError ret = *owner->contents.err;
5909         ret.is_owned = false;
5910         return ret;
5911 }
5912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5913         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
5914         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
5915         int64_t ret_ref = 0;
5916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5918         return ret_ref;
5919 }
5920
5921 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5922 CHECK(owner->result_ok);
5923         return *owner->contents.result;
5924 }
5925 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5926         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
5927         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
5928         return ret_conv;
5929 }
5930
5931 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5932         LDKLightningError ret = *owner->contents.err;
5933         ret.is_owned = false;
5934         return ret;
5935 }
5936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5937         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
5938         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
5939         int64_t ret_ref = 0;
5940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5942         return ret_ref;
5943 }
5944
5945 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5946         LDKChannelAnnouncement ret = owner->a;
5947         ret.is_owned = false;
5948         return ret;
5949 }
5950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5951         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5952         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
5953         int64_t ret_ref = 0;
5954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5956         return ret_ref;
5957 }
5958
5959 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5960         LDKChannelUpdate ret = owner->b;
5961         ret.is_owned = false;
5962         return ret;
5963 }
5964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5965         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5966         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
5967         int64_t ret_ref = 0;
5968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5970         return ret_ref;
5971 }
5972
5973 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5974         LDKChannelUpdate ret = owner->c;
5975         ret.is_owned = false;
5976         return ret;
5977 }
5978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
5979         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5980         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
5981         int64_t ret_ref = 0;
5982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5984         return ret_ref;
5985 }
5986
5987 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class = NULL;
5988 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = NULL;
5989 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class = NULL;
5990 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = NULL;
5991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_init (JNIEnv *env, jclass clz) {
5992         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class =
5993                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$Some"));
5994         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class != NULL);
5995         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, "<init>", "(J)V");
5996         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth != NULL);
5997         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class =
5998                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$None"));
5999         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class != NULL);
6000         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, "<init>", "()V");
6001         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth != NULL);
6002 }
6003 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6004         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
6005         switch(obj->tag) {
6006                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: {
6007                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6008                         *some_conv = obj->some;
6009                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
6010                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth, tag_ptr(some_conv, true));
6011                 }
6012                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: {
6013                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth);
6014                 }
6015                 default: abort();
6016         }
6017 }
6018 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
6019 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
6020 static jclass LDKErrorAction_DisconnectPeerWithWarning_class = NULL;
6021 static jmethodID LDKErrorAction_DisconnectPeerWithWarning_meth = NULL;
6022 static jclass LDKErrorAction_IgnoreError_class = NULL;
6023 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
6024 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
6025 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
6026 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
6027 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
6028 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
6029 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
6030 static jclass LDKErrorAction_SendWarningMessage_class = NULL;
6031 static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL;
6032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
6033         LDKErrorAction_DisconnectPeer_class =
6034                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
6035         CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
6036         LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
6037         CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
6038         LDKErrorAction_DisconnectPeerWithWarning_class =
6039                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeerWithWarning"));
6040         CHECK(LDKErrorAction_DisconnectPeerWithWarning_class != NULL);
6041         LDKErrorAction_DisconnectPeerWithWarning_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeerWithWarning_class, "<init>", "(J)V");
6042         CHECK(LDKErrorAction_DisconnectPeerWithWarning_meth != NULL);
6043         LDKErrorAction_IgnoreError_class =
6044                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
6045         CHECK(LDKErrorAction_IgnoreError_class != NULL);
6046         LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
6047         CHECK(LDKErrorAction_IgnoreError_meth != NULL);
6048         LDKErrorAction_IgnoreAndLog_class =
6049                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
6050         CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
6051         LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
6052         CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
6053         LDKErrorAction_IgnoreDuplicateGossip_class =
6054                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
6055         CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
6056         LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
6057         CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
6058         LDKErrorAction_SendErrorMessage_class =
6059                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
6060         CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
6061         LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
6062         CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
6063         LDKErrorAction_SendWarningMessage_class =
6064                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage"));
6065         CHECK(LDKErrorAction_SendWarningMessage_class != NULL);
6066         LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "<init>", "(JLorg/ldk/enums/Level;)V");
6067         CHECK(LDKErrorAction_SendWarningMessage_meth != NULL);
6068 }
6069 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6070         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
6071         switch(obj->tag) {
6072                 case LDKErrorAction_DisconnectPeer: {
6073                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
6074                         int64_t msg_ref = 0;
6075                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6076                         msg_ref = tag_ptr(msg_var.inner, false);
6077                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
6078                 }
6079                 case LDKErrorAction_DisconnectPeerWithWarning: {
6080                         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
6081                         int64_t msg_ref = 0;
6082                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6083                         msg_ref = tag_ptr(msg_var.inner, false);
6084                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeerWithWarning_class, LDKErrorAction_DisconnectPeerWithWarning_meth, msg_ref);
6085                 }
6086                 case LDKErrorAction_IgnoreError: {
6087                         return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
6088                 }
6089                 case LDKErrorAction_IgnoreAndLog: {
6090                         jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
6091                         return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
6092                 }
6093                 case LDKErrorAction_IgnoreDuplicateGossip: {
6094                         return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
6095                 }
6096                 case LDKErrorAction_SendErrorMessage: {
6097                         LDKErrorMessage msg_var = obj->send_error_message.msg;
6098                         int64_t msg_ref = 0;
6099                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6100                         msg_ref = tag_ptr(msg_var.inner, false);
6101                         return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
6102                 }
6103                 case LDKErrorAction_SendWarningMessage: {
6104                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
6105                         int64_t msg_ref = 0;
6106                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6107                         msg_ref = tag_ptr(msg_var.inner, false);
6108                         jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level);
6109                         return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv);
6110                 }
6111                 default: abort();
6112         }
6113 }
6114 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
6115 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
6116 static jclass LDKMessageSendEvent_SendAcceptChannelV2_class = NULL;
6117 static jmethodID LDKMessageSendEvent_SendAcceptChannelV2_meth = NULL;
6118 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
6119 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
6120 static jclass LDKMessageSendEvent_SendOpenChannelV2_class = NULL;
6121 static jmethodID LDKMessageSendEvent_SendOpenChannelV2_meth = NULL;
6122 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
6123 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
6124 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
6125 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
6126 static jclass LDKMessageSendEvent_SendStfu_class = NULL;
6127 static jmethodID LDKMessageSendEvent_SendStfu_meth = NULL;
6128 static jclass LDKMessageSendEvent_SendSplice_class = NULL;
6129 static jmethodID LDKMessageSendEvent_SendSplice_meth = NULL;
6130 static jclass LDKMessageSendEvent_SendSpliceAck_class = NULL;
6131 static jmethodID LDKMessageSendEvent_SendSpliceAck_meth = NULL;
6132 static jclass LDKMessageSendEvent_SendSpliceLocked_class = NULL;
6133 static jmethodID LDKMessageSendEvent_SendSpliceLocked_meth = NULL;
6134 static jclass LDKMessageSendEvent_SendTxAddInput_class = NULL;
6135 static jmethodID LDKMessageSendEvent_SendTxAddInput_meth = NULL;
6136 static jclass LDKMessageSendEvent_SendTxAddOutput_class = NULL;
6137 static jmethodID LDKMessageSendEvent_SendTxAddOutput_meth = NULL;
6138 static jclass LDKMessageSendEvent_SendTxRemoveInput_class = NULL;
6139 static jmethodID LDKMessageSendEvent_SendTxRemoveInput_meth = NULL;
6140 static jclass LDKMessageSendEvent_SendTxRemoveOutput_class = NULL;
6141 static jmethodID LDKMessageSendEvent_SendTxRemoveOutput_meth = NULL;
6142 static jclass LDKMessageSendEvent_SendTxComplete_class = NULL;
6143 static jmethodID LDKMessageSendEvent_SendTxComplete_meth = NULL;
6144 static jclass LDKMessageSendEvent_SendTxSignatures_class = NULL;
6145 static jmethodID LDKMessageSendEvent_SendTxSignatures_meth = NULL;
6146 static jclass LDKMessageSendEvent_SendTxInitRbf_class = NULL;
6147 static jmethodID LDKMessageSendEvent_SendTxInitRbf_meth = NULL;
6148 static jclass LDKMessageSendEvent_SendTxAckRbf_class = NULL;
6149 static jmethodID LDKMessageSendEvent_SendTxAckRbf_meth = NULL;
6150 static jclass LDKMessageSendEvent_SendTxAbort_class = NULL;
6151 static jmethodID LDKMessageSendEvent_SendTxAbort_meth = NULL;
6152 static jclass LDKMessageSendEvent_SendChannelReady_class = NULL;
6153 static jmethodID LDKMessageSendEvent_SendChannelReady_meth = NULL;
6154 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
6155 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
6156 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
6157 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
6158 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
6159 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
6160 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
6161 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
6162 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
6163 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
6164 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
6165 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
6166 static jclass LDKMessageSendEvent_SendChannelAnnouncement_class = NULL;
6167 static jmethodID LDKMessageSendEvent_SendChannelAnnouncement_meth = NULL;
6168 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
6169 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
6170 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
6171 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
6172 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
6173 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
6174 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
6175 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
6176 static jclass LDKMessageSendEvent_HandleError_class = NULL;
6177 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
6178 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
6179 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
6180 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
6181 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
6182 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
6183 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
6184 static jclass LDKMessageSendEvent_SendGossipTimestampFilter_class = NULL;
6185 static jmethodID LDKMessageSendEvent_SendGossipTimestampFilter_meth = NULL;
6186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
6187         LDKMessageSendEvent_SendAcceptChannel_class =
6188                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
6189         CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
6190         LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
6191         CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
6192         LDKMessageSendEvent_SendAcceptChannelV2_class =
6193                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannelV2"));
6194         CHECK(LDKMessageSendEvent_SendAcceptChannelV2_class != NULL);
6195         LDKMessageSendEvent_SendAcceptChannelV2_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannelV2_class, "<init>", "([BJ)V");
6196         CHECK(LDKMessageSendEvent_SendAcceptChannelV2_meth != NULL);
6197         LDKMessageSendEvent_SendOpenChannel_class =
6198                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
6199         CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
6200         LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
6201         CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
6202         LDKMessageSendEvent_SendOpenChannelV2_class =
6203                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannelV2"));
6204         CHECK(LDKMessageSendEvent_SendOpenChannelV2_class != NULL);
6205         LDKMessageSendEvent_SendOpenChannelV2_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannelV2_class, "<init>", "([BJ)V");
6206         CHECK(LDKMessageSendEvent_SendOpenChannelV2_meth != NULL);
6207         LDKMessageSendEvent_SendFundingCreated_class =
6208                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
6209         CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
6210         LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
6211         CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
6212         LDKMessageSendEvent_SendFundingSigned_class =
6213                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
6214         CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
6215         LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
6216         CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
6217         LDKMessageSendEvent_SendStfu_class =
6218                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendStfu"));
6219         CHECK(LDKMessageSendEvent_SendStfu_class != NULL);
6220         LDKMessageSendEvent_SendStfu_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendStfu_class, "<init>", "([BJ)V");
6221         CHECK(LDKMessageSendEvent_SendStfu_meth != NULL);
6222         LDKMessageSendEvent_SendSplice_class =
6223                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendSplice"));
6224         CHECK(LDKMessageSendEvent_SendSplice_class != NULL);
6225         LDKMessageSendEvent_SendSplice_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendSplice_class, "<init>", "([BJ)V");
6226         CHECK(LDKMessageSendEvent_SendSplice_meth != NULL);
6227         LDKMessageSendEvent_SendSpliceAck_class =
6228                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendSpliceAck"));
6229         CHECK(LDKMessageSendEvent_SendSpliceAck_class != NULL);
6230         LDKMessageSendEvent_SendSpliceAck_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendSpliceAck_class, "<init>", "([BJ)V");
6231         CHECK(LDKMessageSendEvent_SendSpliceAck_meth != NULL);
6232         LDKMessageSendEvent_SendSpliceLocked_class =
6233                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendSpliceLocked"));
6234         CHECK(LDKMessageSendEvent_SendSpliceLocked_class != NULL);
6235         LDKMessageSendEvent_SendSpliceLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendSpliceLocked_class, "<init>", "([BJ)V");
6236         CHECK(LDKMessageSendEvent_SendSpliceLocked_meth != NULL);
6237         LDKMessageSendEvent_SendTxAddInput_class =
6238                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAddInput"));
6239         CHECK(LDKMessageSendEvent_SendTxAddInput_class != NULL);
6240         LDKMessageSendEvent_SendTxAddInput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAddInput_class, "<init>", "([BJ)V");
6241         CHECK(LDKMessageSendEvent_SendTxAddInput_meth != NULL);
6242         LDKMessageSendEvent_SendTxAddOutput_class =
6243                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAddOutput"));
6244         CHECK(LDKMessageSendEvent_SendTxAddOutput_class != NULL);
6245         LDKMessageSendEvent_SendTxAddOutput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAddOutput_class, "<init>", "([BJ)V");
6246         CHECK(LDKMessageSendEvent_SendTxAddOutput_meth != NULL);
6247         LDKMessageSendEvent_SendTxRemoveInput_class =
6248                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxRemoveInput"));
6249         CHECK(LDKMessageSendEvent_SendTxRemoveInput_class != NULL);
6250         LDKMessageSendEvent_SendTxRemoveInput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxRemoveInput_class, "<init>", "([BJ)V");
6251         CHECK(LDKMessageSendEvent_SendTxRemoveInput_meth != NULL);
6252         LDKMessageSendEvent_SendTxRemoveOutput_class =
6253                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxRemoveOutput"));
6254         CHECK(LDKMessageSendEvent_SendTxRemoveOutput_class != NULL);
6255         LDKMessageSendEvent_SendTxRemoveOutput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxRemoveOutput_class, "<init>", "([BJ)V");
6256         CHECK(LDKMessageSendEvent_SendTxRemoveOutput_meth != NULL);
6257         LDKMessageSendEvent_SendTxComplete_class =
6258                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxComplete"));
6259         CHECK(LDKMessageSendEvent_SendTxComplete_class != NULL);
6260         LDKMessageSendEvent_SendTxComplete_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxComplete_class, "<init>", "([BJ)V");
6261         CHECK(LDKMessageSendEvent_SendTxComplete_meth != NULL);
6262         LDKMessageSendEvent_SendTxSignatures_class =
6263                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxSignatures"));
6264         CHECK(LDKMessageSendEvent_SendTxSignatures_class != NULL);
6265         LDKMessageSendEvent_SendTxSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxSignatures_class, "<init>", "([BJ)V");
6266         CHECK(LDKMessageSendEvent_SendTxSignatures_meth != NULL);
6267         LDKMessageSendEvent_SendTxInitRbf_class =
6268                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxInitRbf"));
6269         CHECK(LDKMessageSendEvent_SendTxInitRbf_class != NULL);
6270         LDKMessageSendEvent_SendTxInitRbf_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxInitRbf_class, "<init>", "([BJ)V");
6271         CHECK(LDKMessageSendEvent_SendTxInitRbf_meth != NULL);
6272         LDKMessageSendEvent_SendTxAckRbf_class =
6273                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAckRbf"));
6274         CHECK(LDKMessageSendEvent_SendTxAckRbf_class != NULL);
6275         LDKMessageSendEvent_SendTxAckRbf_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAckRbf_class, "<init>", "([BJ)V");
6276         CHECK(LDKMessageSendEvent_SendTxAckRbf_meth != NULL);
6277         LDKMessageSendEvent_SendTxAbort_class =
6278                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAbort"));
6279         CHECK(LDKMessageSendEvent_SendTxAbort_class != NULL);
6280         LDKMessageSendEvent_SendTxAbort_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAbort_class, "<init>", "([BJ)V");
6281         CHECK(LDKMessageSendEvent_SendTxAbort_meth != NULL);
6282         LDKMessageSendEvent_SendChannelReady_class =
6283                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReady"));
6284         CHECK(LDKMessageSendEvent_SendChannelReady_class != NULL);
6285         LDKMessageSendEvent_SendChannelReady_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReady_class, "<init>", "([BJ)V");
6286         CHECK(LDKMessageSendEvent_SendChannelReady_meth != NULL);
6287         LDKMessageSendEvent_SendAnnouncementSignatures_class =
6288                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
6289         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
6290         LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
6291         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
6292         LDKMessageSendEvent_UpdateHTLCs_class =
6293                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
6294         CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
6295         LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
6296         CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
6297         LDKMessageSendEvent_SendRevokeAndACK_class =
6298                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
6299         CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
6300         LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
6301         CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
6302         LDKMessageSendEvent_SendClosingSigned_class =
6303                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
6304         CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
6305         LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
6306         CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
6307         LDKMessageSendEvent_SendShutdown_class =
6308                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
6309         CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
6310         LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
6311         CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
6312         LDKMessageSendEvent_SendChannelReestablish_class =
6313                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
6314         CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
6315         LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
6316         CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
6317         LDKMessageSendEvent_SendChannelAnnouncement_class =
6318                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelAnnouncement"));
6319         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_class != NULL);
6320         LDKMessageSendEvent_SendChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelAnnouncement_class, "<init>", "([BJJ)V");
6321         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_meth != NULL);
6322         LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
6323                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
6324         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
6325         LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
6326         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
6327         LDKMessageSendEvent_BroadcastChannelUpdate_class =
6328                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
6329         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
6330         LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
6331         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
6332         LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
6333                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
6334         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
6335         LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
6336         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
6337         LDKMessageSendEvent_SendChannelUpdate_class =
6338                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
6339         CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
6340         LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
6341         CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
6342         LDKMessageSendEvent_HandleError_class =
6343                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
6344         CHECK(LDKMessageSendEvent_HandleError_class != NULL);
6345         LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
6346         CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
6347         LDKMessageSendEvent_SendChannelRangeQuery_class =
6348                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
6349         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
6350         LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
6351         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
6352         LDKMessageSendEvent_SendShortIdsQuery_class =
6353                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
6354         CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
6355         LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
6356         CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
6357         LDKMessageSendEvent_SendReplyChannelRange_class =
6358                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
6359         CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
6360         LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
6361         CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
6362         LDKMessageSendEvent_SendGossipTimestampFilter_class =
6363                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendGossipTimestampFilter"));
6364         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_class != NULL);
6365         LDKMessageSendEvent_SendGossipTimestampFilter_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, "<init>", "([BJ)V");
6366         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_meth != NULL);
6367 }
6368 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6369         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
6370         switch(obj->tag) {
6371                 case LDKMessageSendEvent_SendAcceptChannel: {
6372                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6373                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
6374                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
6375                         int64_t msg_ref = 0;
6376                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6377                         msg_ref = tag_ptr(msg_var.inner, false);
6378                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
6379                 }
6380                 case LDKMessageSendEvent_SendAcceptChannelV2: {
6381                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6382                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel_v2.node_id.compressed_form);
6383                         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
6384                         int64_t msg_ref = 0;
6385                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6386                         msg_ref = tag_ptr(msg_var.inner, false);
6387                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannelV2_class, LDKMessageSendEvent_SendAcceptChannelV2_meth, node_id_arr, msg_ref);
6388                 }
6389                 case LDKMessageSendEvent_SendOpenChannel: {
6390                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6391                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
6392                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
6393                         int64_t msg_ref = 0;
6394                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6395                         msg_ref = tag_ptr(msg_var.inner, false);
6396                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
6397                 }
6398                 case LDKMessageSendEvent_SendOpenChannelV2: {
6399                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6400                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel_v2.node_id.compressed_form);
6401                         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
6402                         int64_t msg_ref = 0;
6403                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6404                         msg_ref = tag_ptr(msg_var.inner, false);
6405                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannelV2_class, LDKMessageSendEvent_SendOpenChannelV2_meth, node_id_arr, msg_ref);
6406                 }
6407                 case LDKMessageSendEvent_SendFundingCreated: {
6408                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6409                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
6410                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
6411                         int64_t msg_ref = 0;
6412                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6413                         msg_ref = tag_ptr(msg_var.inner, false);
6414                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
6415                 }
6416                 case LDKMessageSendEvent_SendFundingSigned: {
6417                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6418                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
6419                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
6420                         int64_t msg_ref = 0;
6421                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6422                         msg_ref = tag_ptr(msg_var.inner, false);
6423                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
6424                 }
6425                 case LDKMessageSendEvent_SendStfu: {
6426                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6427                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_stfu.node_id.compressed_form);
6428                         LDKStfu msg_var = obj->send_stfu.msg;
6429                         int64_t msg_ref = 0;
6430                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6431                         msg_ref = tag_ptr(msg_var.inner, false);
6432                         return (*env)->NewObject(env, LDKMessageSendEvent_SendStfu_class, LDKMessageSendEvent_SendStfu_meth, node_id_arr, msg_ref);
6433                 }
6434                 case LDKMessageSendEvent_SendSplice: {
6435                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6436                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_splice.node_id.compressed_form);
6437                         LDKSplice msg_var = obj->send_splice.msg;
6438                         int64_t msg_ref = 0;
6439                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6440                         msg_ref = tag_ptr(msg_var.inner, false);
6441                         return (*env)->NewObject(env, LDKMessageSendEvent_SendSplice_class, LDKMessageSendEvent_SendSplice_meth, node_id_arr, msg_ref);
6442                 }
6443                 case LDKMessageSendEvent_SendSpliceAck: {
6444                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6445                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_splice_ack.node_id.compressed_form);
6446                         LDKSpliceAck msg_var = obj->send_splice_ack.msg;
6447                         int64_t msg_ref = 0;
6448                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6449                         msg_ref = tag_ptr(msg_var.inner, false);
6450                         return (*env)->NewObject(env, LDKMessageSendEvent_SendSpliceAck_class, LDKMessageSendEvent_SendSpliceAck_meth, node_id_arr, msg_ref);
6451                 }
6452                 case LDKMessageSendEvent_SendSpliceLocked: {
6453                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6454                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_splice_locked.node_id.compressed_form);
6455                         LDKSpliceLocked msg_var = obj->send_splice_locked.msg;
6456                         int64_t msg_ref = 0;
6457                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6458                         msg_ref = tag_ptr(msg_var.inner, false);
6459                         return (*env)->NewObject(env, LDKMessageSendEvent_SendSpliceLocked_class, LDKMessageSendEvent_SendSpliceLocked_meth, node_id_arr, msg_ref);
6460                 }
6461                 case LDKMessageSendEvent_SendTxAddInput: {
6462                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6463                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_add_input.node_id.compressed_form);
6464                         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
6465                         int64_t msg_ref = 0;
6466                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6467                         msg_ref = tag_ptr(msg_var.inner, false);
6468                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAddInput_class, LDKMessageSendEvent_SendTxAddInput_meth, node_id_arr, msg_ref);
6469                 }
6470                 case LDKMessageSendEvent_SendTxAddOutput: {
6471                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6472                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_add_output.node_id.compressed_form);
6473                         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
6474                         int64_t msg_ref = 0;
6475                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6476                         msg_ref = tag_ptr(msg_var.inner, false);
6477                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAddOutput_class, LDKMessageSendEvent_SendTxAddOutput_meth, node_id_arr, msg_ref);
6478                 }
6479                 case LDKMessageSendEvent_SendTxRemoveInput: {
6480                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6481                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_remove_input.node_id.compressed_form);
6482                         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
6483                         int64_t msg_ref = 0;
6484                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6485                         msg_ref = tag_ptr(msg_var.inner, false);
6486                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxRemoveInput_class, LDKMessageSendEvent_SendTxRemoveInput_meth, node_id_arr, msg_ref);
6487                 }
6488                 case LDKMessageSendEvent_SendTxRemoveOutput: {
6489                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6490                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_remove_output.node_id.compressed_form);
6491                         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
6492                         int64_t msg_ref = 0;
6493                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6494                         msg_ref = tag_ptr(msg_var.inner, false);
6495                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxRemoveOutput_class, LDKMessageSendEvent_SendTxRemoveOutput_meth, node_id_arr, msg_ref);
6496                 }
6497                 case LDKMessageSendEvent_SendTxComplete: {
6498                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6499                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_complete.node_id.compressed_form);
6500                         LDKTxComplete msg_var = obj->send_tx_complete.msg;
6501                         int64_t msg_ref = 0;
6502                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6503                         msg_ref = tag_ptr(msg_var.inner, false);
6504                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxComplete_class, LDKMessageSendEvent_SendTxComplete_meth, node_id_arr, msg_ref);
6505                 }
6506                 case LDKMessageSendEvent_SendTxSignatures: {
6507                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6508                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_signatures.node_id.compressed_form);
6509                         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
6510                         int64_t msg_ref = 0;
6511                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6512                         msg_ref = tag_ptr(msg_var.inner, false);
6513                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxSignatures_class, LDKMessageSendEvent_SendTxSignatures_meth, node_id_arr, msg_ref);
6514                 }
6515                 case LDKMessageSendEvent_SendTxInitRbf: {
6516                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6517                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_init_rbf.node_id.compressed_form);
6518                         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
6519                         int64_t msg_ref = 0;
6520                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6521                         msg_ref = tag_ptr(msg_var.inner, false);
6522                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxInitRbf_class, LDKMessageSendEvent_SendTxInitRbf_meth, node_id_arr, msg_ref);
6523                 }
6524                 case LDKMessageSendEvent_SendTxAckRbf: {
6525                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6526                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_ack_rbf.node_id.compressed_form);
6527                         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
6528                         int64_t msg_ref = 0;
6529                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6530                         msg_ref = tag_ptr(msg_var.inner, false);
6531                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAckRbf_class, LDKMessageSendEvent_SendTxAckRbf_meth, node_id_arr, msg_ref);
6532                 }
6533                 case LDKMessageSendEvent_SendTxAbort: {
6534                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6535                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_abort.node_id.compressed_form);
6536                         LDKTxAbort msg_var = obj->send_tx_abort.msg;
6537                         int64_t msg_ref = 0;
6538                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6539                         msg_ref = tag_ptr(msg_var.inner, false);
6540                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAbort_class, LDKMessageSendEvent_SendTxAbort_meth, node_id_arr, msg_ref);
6541                 }
6542                 case LDKMessageSendEvent_SendChannelReady: {
6543                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6544                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_ready.node_id.compressed_form);
6545                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
6546                         int64_t msg_ref = 0;
6547                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6548                         msg_ref = tag_ptr(msg_var.inner, false);
6549                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReady_class, LDKMessageSendEvent_SendChannelReady_meth, node_id_arr, msg_ref);
6550                 }
6551                 case LDKMessageSendEvent_SendAnnouncementSignatures: {
6552                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6553                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
6554                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
6555                         int64_t msg_ref = 0;
6556                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6557                         msg_ref = tag_ptr(msg_var.inner, false);
6558                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
6559                 }
6560                 case LDKMessageSendEvent_UpdateHTLCs: {
6561                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6562                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
6563                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
6564                         int64_t updates_ref = 0;
6565                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
6566                         updates_ref = tag_ptr(updates_var.inner, false);
6567                         return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
6568                 }
6569                 case LDKMessageSendEvent_SendRevokeAndACK: {
6570                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6571                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
6572                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
6573                         int64_t msg_ref = 0;
6574                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6575                         msg_ref = tag_ptr(msg_var.inner, false);
6576                         return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
6577                 }
6578                 case LDKMessageSendEvent_SendClosingSigned: {
6579                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6580                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
6581                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
6582                         int64_t msg_ref = 0;
6583                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6584                         msg_ref = tag_ptr(msg_var.inner, false);
6585                         return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
6586                 }
6587                 case LDKMessageSendEvent_SendShutdown: {
6588                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6589                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
6590                         LDKShutdown msg_var = obj->send_shutdown.msg;
6591                         int64_t msg_ref = 0;
6592                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6593                         msg_ref = tag_ptr(msg_var.inner, false);
6594                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
6595                 }
6596                 case LDKMessageSendEvent_SendChannelReestablish: {
6597                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6598                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
6599                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
6600                         int64_t msg_ref = 0;
6601                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6602                         msg_ref = tag_ptr(msg_var.inner, false);
6603                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
6604                 }
6605                 case LDKMessageSendEvent_SendChannelAnnouncement: {
6606                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6607                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_announcement.node_id.compressed_form);
6608                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
6609                         int64_t msg_ref = 0;
6610                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6611                         msg_ref = tag_ptr(msg_var.inner, false);
6612                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
6613                         int64_t update_msg_ref = 0;
6614                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
6615                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
6616                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelAnnouncement_class, LDKMessageSendEvent_SendChannelAnnouncement_meth, node_id_arr, msg_ref, update_msg_ref);
6617                 }
6618                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
6619                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
6620                         int64_t msg_ref = 0;
6621                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6622                         msg_ref = tag_ptr(msg_var.inner, false);
6623                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
6624                         int64_t update_msg_ref = 0;
6625                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
6626                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
6627                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
6628                 }
6629                 case LDKMessageSendEvent_BroadcastChannelUpdate: {
6630                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
6631                         int64_t msg_ref = 0;
6632                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6633                         msg_ref = tag_ptr(msg_var.inner, false);
6634                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
6635                 }
6636                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
6637                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
6638                         int64_t msg_ref = 0;
6639                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6640                         msg_ref = tag_ptr(msg_var.inner, false);
6641                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
6642                 }
6643                 case LDKMessageSendEvent_SendChannelUpdate: {
6644                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6645                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
6646                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
6647                         int64_t msg_ref = 0;
6648                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6649                         msg_ref = tag_ptr(msg_var.inner, false);
6650                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
6651                 }
6652                 case LDKMessageSendEvent_HandleError: {
6653                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6654                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
6655                         int64_t action_ref = tag_ptr(&obj->handle_error.action, false);
6656                         return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
6657                 }
6658                 case LDKMessageSendEvent_SendChannelRangeQuery: {
6659                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6660                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
6661                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
6662                         int64_t msg_ref = 0;
6663                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6664                         msg_ref = tag_ptr(msg_var.inner, false);
6665                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
6666                 }
6667                 case LDKMessageSendEvent_SendShortIdsQuery: {
6668                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6669                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
6670                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
6671                         int64_t msg_ref = 0;
6672                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6673                         msg_ref = tag_ptr(msg_var.inner, false);
6674                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
6675                 }
6676                 case LDKMessageSendEvent_SendReplyChannelRange: {
6677                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6678                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
6679                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
6680                         int64_t msg_ref = 0;
6681                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6682                         msg_ref = tag_ptr(msg_var.inner, false);
6683                         return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
6684                 }
6685                 case LDKMessageSendEvent_SendGossipTimestampFilter: {
6686                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6687                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_gossip_timestamp_filter.node_id.compressed_form);
6688                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
6689                         int64_t msg_ref = 0;
6690                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6691                         msg_ref = tag_ptr(msg_var.inner, false);
6692                         return (*env)->NewObject(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, LDKMessageSendEvent_SendGossipTimestampFilter_meth, node_id_arr, msg_ref);
6693                 }
6694                 default: abort();
6695         }
6696 }
6697 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
6698         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
6699         for (size_t i = 0; i < ret.datalen; i++) {
6700                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
6701         }
6702         return ret;
6703 }
6704 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
6705         LDKChannelUpdateInfo ret = *owner->contents.result;
6706         ret.is_owned = false;
6707         return ret;
6708 }
6709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6710         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
6711         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
6712         int64_t ret_ref = 0;
6713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6715         return ret_ref;
6716 }
6717
6718 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
6719 CHECK(!owner->result_ok);
6720         return DecodeError_clone(&*owner->contents.err);
6721 }
6722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6723         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
6724         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6725         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
6726         int64_t ret_ref = tag_ptr(ret_copy, true);
6727         return ret_ref;
6728 }
6729
6730 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
6731         LDKChannelInfo ret = *owner->contents.result;
6732         ret.is_owned = false;
6733         return ret;
6734 }
6735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6736         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
6737         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
6738         int64_t ret_ref = 0;
6739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6741         return ret_ref;
6742 }
6743
6744 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
6745 CHECK(!owner->result_ok);
6746         return DecodeError_clone(&*owner->contents.err);
6747 }
6748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6749         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
6750         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6751         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
6752         int64_t ret_ref = tag_ptr(ret_copy, true);
6753         return ret_ref;
6754 }
6755
6756 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
6757         LDKRoutingFees ret = *owner->contents.result;
6758         ret.is_owned = false;
6759         return ret;
6760 }
6761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6762         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
6763         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
6764         int64_t ret_ref = 0;
6765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6767         return ret_ref;
6768 }
6769
6770 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
6771 CHECK(!owner->result_ok);
6772         return DecodeError_clone(&*owner->contents.err);
6773 }
6774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6775         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
6776         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6777         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
6778         int64_t ret_ref = tag_ptr(ret_copy, true);
6779         return ret_ref;
6780 }
6781
6782 static jclass LDKSocketAddress_TcpIpV4_class = NULL;
6783 static jmethodID LDKSocketAddress_TcpIpV4_meth = NULL;
6784 static jclass LDKSocketAddress_TcpIpV6_class = NULL;
6785 static jmethodID LDKSocketAddress_TcpIpV6_meth = NULL;
6786 static jclass LDKSocketAddress_OnionV2_class = NULL;
6787 static jmethodID LDKSocketAddress_OnionV2_meth = NULL;
6788 static jclass LDKSocketAddress_OnionV3_class = NULL;
6789 static jmethodID LDKSocketAddress_OnionV3_meth = NULL;
6790 static jclass LDKSocketAddress_Hostname_class = NULL;
6791 static jmethodID LDKSocketAddress_Hostname_meth = NULL;
6792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSocketAddress_init (JNIEnv *env, jclass clz) {
6793         LDKSocketAddress_TcpIpV4_class =
6794                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$TcpIpV4"));
6795         CHECK(LDKSocketAddress_TcpIpV4_class != NULL);
6796         LDKSocketAddress_TcpIpV4_meth = (*env)->GetMethodID(env, LDKSocketAddress_TcpIpV4_class, "<init>", "([BS)V");
6797         CHECK(LDKSocketAddress_TcpIpV4_meth != NULL);
6798         LDKSocketAddress_TcpIpV6_class =
6799                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$TcpIpV6"));
6800         CHECK(LDKSocketAddress_TcpIpV6_class != NULL);
6801         LDKSocketAddress_TcpIpV6_meth = (*env)->GetMethodID(env, LDKSocketAddress_TcpIpV6_class, "<init>", "([BS)V");
6802         CHECK(LDKSocketAddress_TcpIpV6_meth != NULL);
6803         LDKSocketAddress_OnionV2_class =
6804                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$OnionV2"));
6805         CHECK(LDKSocketAddress_OnionV2_class != NULL);
6806         LDKSocketAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKSocketAddress_OnionV2_class, "<init>", "([B)V");
6807         CHECK(LDKSocketAddress_OnionV2_meth != NULL);
6808         LDKSocketAddress_OnionV3_class =
6809                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$OnionV3"));
6810         CHECK(LDKSocketAddress_OnionV3_class != NULL);
6811         LDKSocketAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKSocketAddress_OnionV3_class, "<init>", "([BSBS)V");
6812         CHECK(LDKSocketAddress_OnionV3_meth != NULL);
6813         LDKSocketAddress_Hostname_class =
6814                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$Hostname"));
6815         CHECK(LDKSocketAddress_Hostname_class != NULL);
6816         LDKSocketAddress_Hostname_meth = (*env)->GetMethodID(env, LDKSocketAddress_Hostname_class, "<init>", "(JS)V");
6817         CHECK(LDKSocketAddress_Hostname_meth != NULL);
6818 }
6819 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6820         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
6821         switch(obj->tag) {
6822                 case LDKSocketAddress_TcpIpV4: {
6823                         int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
6824                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->tcp_ip_v4.addr.data);
6825                         int16_t port_conv = obj->tcp_ip_v4.port;
6826                         return (*env)->NewObject(env, LDKSocketAddress_TcpIpV4_class, LDKSocketAddress_TcpIpV4_meth, addr_arr, port_conv);
6827                 }
6828                 case LDKSocketAddress_TcpIpV6: {
6829                         int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
6830                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->tcp_ip_v6.addr.data);
6831                         int16_t port_conv = obj->tcp_ip_v6.port;
6832                         return (*env)->NewObject(env, LDKSocketAddress_TcpIpV6_class, LDKSocketAddress_TcpIpV6_meth, addr_arr, port_conv);
6833                 }
6834                 case LDKSocketAddress_OnionV2: {
6835                         int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
6836                         (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
6837                         return (*env)->NewObject(env, LDKSocketAddress_OnionV2_class, LDKSocketAddress_OnionV2_meth, onion_v2_arr);
6838                 }
6839                 case LDKSocketAddress_OnionV3: {
6840                         int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
6841                         (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
6842                         int16_t checksum_conv = obj->onion_v3.checksum;
6843                         int8_t version_conv = obj->onion_v3.version;
6844                         int16_t port_conv = obj->onion_v3.port;
6845                         return (*env)->NewObject(env, LDKSocketAddress_OnionV3_class, LDKSocketAddress_OnionV3_meth, ed25519_pubkey_arr, checksum_conv, version_conv, port_conv);
6846                 }
6847                 case LDKSocketAddress_Hostname: {
6848                         LDKHostname hostname_var = obj->hostname.hostname;
6849                         int64_t hostname_ref = 0;
6850                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
6851                         hostname_ref = tag_ptr(hostname_var.inner, false);
6852                         int16_t port_conv = obj->hostname.port;
6853                         return (*env)->NewObject(env, LDKSocketAddress_Hostname_class, LDKSocketAddress_Hostname_meth, hostname_ref, port_conv);
6854                 }
6855                 default: abort();
6856         }
6857 }
6858 static inline LDKCVec_SocketAddressZ CVec_SocketAddressZ_clone(const LDKCVec_SocketAddressZ *orig) {
6859         LDKCVec_SocketAddressZ ret = { .data = MALLOC(sizeof(LDKSocketAddress) * orig->datalen, "LDKCVec_SocketAddressZ clone bytes"), .datalen = orig->datalen };
6860         for (size_t i = 0; i < ret.datalen; i++) {
6861                 ret.data[i] = SocketAddress_clone(&orig->data[i]);
6862         }
6863         return ret;
6864 }
6865 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
6866         LDKNodeAnnouncementInfo ret = *owner->contents.result;
6867         ret.is_owned = false;
6868         return ret;
6869 }
6870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6871         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
6872         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
6873         int64_t ret_ref = 0;
6874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6876         return ret_ref;
6877 }
6878
6879 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
6880 CHECK(!owner->result_ok);
6881         return DecodeError_clone(&*owner->contents.err);
6882 }
6883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6884         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
6885         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6886         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
6887         int64_t ret_ref = tag_ptr(ret_copy, true);
6888         return ret_ref;
6889 }
6890
6891 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
6892         LDKNodeAlias ret = *owner->contents.result;
6893         ret.is_owned = false;
6894         return ret;
6895 }
6896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6897         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
6898         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
6899         int64_t ret_ref = 0;
6900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6902         return ret_ref;
6903 }
6904
6905 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
6906 CHECK(!owner->result_ok);
6907         return DecodeError_clone(&*owner->contents.err);
6908 }
6909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6910         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
6911         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6912         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
6913         int64_t ret_ref = tag_ptr(ret_copy, true);
6914         return ret_ref;
6915 }
6916
6917 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
6918         LDKNodeInfo ret = *owner->contents.result;
6919         ret.is_owned = false;
6920         return ret;
6921 }
6922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6923         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
6924         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
6925         int64_t ret_ref = 0;
6926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6928         return ret_ref;
6929 }
6930
6931 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
6932 CHECK(!owner->result_ok);
6933         return DecodeError_clone(&*owner->contents.err);
6934 }
6935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6936         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
6937         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6938         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
6939         int64_t ret_ref = tag_ptr(ret_copy, true);
6940         return ret_ref;
6941 }
6942
6943 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
6944         LDKNetworkGraph ret = *owner->contents.result;
6945         ret.is_owned = false;
6946         return ret;
6947 }
6948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6949         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
6950         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
6951         int64_t ret_ref = 0;
6952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6954         return ret_ref;
6955 }
6956
6957 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
6958 CHECK(!owner->result_ok);
6959         return DecodeError_clone(&*owner->contents.err);
6960 }
6961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6962         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
6963         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6964         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
6965         int64_t ret_ref = tag_ptr(ret_copy, true);
6966         return ret_ref;
6967 }
6968
6969 static jclass LDKCOption_CVec_SocketAddressZZ_Some_class = NULL;
6970 static jmethodID LDKCOption_CVec_SocketAddressZZ_Some_meth = NULL;
6971 static jclass LDKCOption_CVec_SocketAddressZZ_None_class = NULL;
6972 static jmethodID LDKCOption_CVec_SocketAddressZZ_None_meth = NULL;
6973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1SocketAddressZZ_init (JNIEnv *env, jclass clz) {
6974         LDKCOption_CVec_SocketAddressZZ_Some_class =
6975                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_SocketAddressZZ$Some"));
6976         CHECK(LDKCOption_CVec_SocketAddressZZ_Some_class != NULL);
6977         LDKCOption_CVec_SocketAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_SocketAddressZZ_Some_class, "<init>", "([J)V");
6978         CHECK(LDKCOption_CVec_SocketAddressZZ_Some_meth != NULL);
6979         LDKCOption_CVec_SocketAddressZZ_None_class =
6980                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_SocketAddressZZ$None"));
6981         CHECK(LDKCOption_CVec_SocketAddressZZ_None_class != NULL);
6982         LDKCOption_CVec_SocketAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_SocketAddressZZ_None_class, "<init>", "()V");
6983         CHECK(LDKCOption_CVec_SocketAddressZZ_None_meth != NULL);
6984 }
6985 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1SocketAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6986         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
6987         switch(obj->tag) {
6988                 case LDKCOption_CVec_SocketAddressZZ_Some: {
6989                         LDKCVec_SocketAddressZ some_var = obj->some;
6990                         int64_tArray some_arr = NULL;
6991                         some_arr = (*env)->NewLongArray(env, some_var.datalen);
6992                         int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
6993                         for (size_t p = 0; p < some_var.datalen; p++) {
6994                                 int64_t some_conv_15_ref = tag_ptr(&some_var.data[p], false);
6995                                 some_arr_ptr[p] = some_conv_15_ref;
6996                         }
6997                         (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
6998                         return (*env)->NewObject(env, LDKCOption_CVec_SocketAddressZZ_Some_class, LDKCOption_CVec_SocketAddressZZ_Some_meth, some_arr);
6999                 }
7000                 case LDKCOption_CVec_SocketAddressZZ_None: {
7001                         return (*env)->NewObject(env, LDKCOption_CVec_SocketAddressZZ_None_class, LDKCOption_CVec_SocketAddressZZ_None_meth);
7002                 }
7003                 default: abort();
7004         }
7005 }
7006 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
7007         LDKPendingHTLCInfo ret = *owner->contents.result;
7008         ret.is_owned = false;
7009         return ret;
7010 }
7011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7012         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
7013         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(owner_conv);
7014         int64_t ret_ref = 0;
7015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7017         return ret_ref;
7018 }
7019
7020 static inline struct LDKInboundHTLCErr CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
7021         LDKInboundHTLCErr ret = *owner->contents.err;
7022         ret.is_owned = false;
7023         return ret;
7024 }
7025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7026         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
7027         LDKInboundHTLCErr ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(owner_conv);
7028         int64_t ret_ref = 0;
7029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7031         return ret_ref;
7032 }
7033
7034 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
7035         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
7036         for (size_t i = 0; i < ret.datalen; i++) {
7037                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
7038         }
7039         return ret;
7040 }
7041 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
7042         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
7043         for (size_t i = 0; i < ret.datalen; i++) {
7044                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
7045         }
7046         return ret;
7047 }
7048 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
7049         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
7050         for (size_t i = 0; i < ret.datalen; i++) {
7051                 ret.data[i] = Utxo_clone(&orig->data[i]);
7052         }
7053         return ret;
7054 }
7055 static jclass LDKCOption_TxOutZ_Some_class = NULL;
7056 static jmethodID LDKCOption_TxOutZ_Some_meth = NULL;
7057 static jclass LDKCOption_TxOutZ_None_class = NULL;
7058 static jmethodID LDKCOption_TxOutZ_None_meth = NULL;
7059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TxOutZ_init (JNIEnv *env, jclass clz) {
7060         LDKCOption_TxOutZ_Some_class =
7061                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxOutZ$Some"));
7062         CHECK(LDKCOption_TxOutZ_Some_class != NULL);
7063         LDKCOption_TxOutZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TxOutZ_Some_class, "<init>", "(J)V");
7064         CHECK(LDKCOption_TxOutZ_Some_meth != NULL);
7065         LDKCOption_TxOutZ_None_class =
7066                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxOutZ$None"));
7067         CHECK(LDKCOption_TxOutZ_None_class != NULL);
7068         LDKCOption_TxOutZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TxOutZ_None_class, "<init>", "()V");
7069         CHECK(LDKCOption_TxOutZ_None_meth != NULL);
7070 }
7071 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TxOutZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7072         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
7073         switch(obj->tag) {
7074                 case LDKCOption_TxOutZ_Some: {
7075                         LDKTxOut* some_ref = &obj->some;
7076                         return (*env)->NewObject(env, LDKCOption_TxOutZ_Some_class, LDKCOption_TxOutZ_Some_meth, tag_ptr(some_ref, false));
7077                 }
7078                 case LDKCOption_TxOutZ_None: {
7079                         return (*env)->NewObject(env, LDKCOption_TxOutZ_None_class, LDKCOption_TxOutZ_None_meth);
7080                 }
7081                 default: abort();
7082         }
7083 }
7084 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
7085         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
7086         for (size_t i = 0; i < ret.datalen; i++) {
7087                 ret.data[i] = Input_clone(&orig->data[i]);
7088         }
7089         return ret;
7090 }
7091 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
7092         LDKCoinSelection ret = *owner->contents.result;
7093         ret.is_owned = false;
7094         return ret;
7095 }
7096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7097         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
7098         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
7099         int64_t ret_ref = 0;
7100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7102         return ret_ref;
7103 }
7104
7105 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
7106 CHECK(!owner->result_ok);
7107         return *owner->contents.err;
7108 }
7109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7110         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
7111         CResult_CoinSelectionNoneZ_get_err(owner_conv);
7112 }
7113
7114 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
7115 CHECK(owner->result_ok);
7116         return CVec_UtxoZ_clone(&*owner->contents.result);
7117 }
7118 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7119         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
7120         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
7121         int64_tArray ret_arr = NULL;
7122         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7123         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7124         for (size_t g = 0; g < ret_var.datalen; g++) {
7125                 LDKUtxo ret_conv_6_var = ret_var.data[g];
7126                 int64_t ret_conv_6_ref = 0;
7127                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
7128                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
7129                 ret_arr_ptr[g] = ret_conv_6_ref;
7130         }
7131         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7132         FREE(ret_var.data);
7133         return ret_arr;
7134 }
7135
7136 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
7137 CHECK(!owner->result_ok);
7138         return *owner->contents.err;
7139 }
7140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7141         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
7142         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
7143 }
7144
7145 static inline uint64_t C2Tuple_u64u16Z_get_a(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
7146         return owner->a;
7147 }
7148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7149         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
7150         int64_t ret_conv = C2Tuple_u64u16Z_get_a(owner_conv);
7151         return ret_conv;
7152 }
7153
7154 static inline uint16_t C2Tuple_u64u16Z_get_b(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
7155         return owner->b;
7156 }
7157 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7158         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
7159         int16_t ret_conv = C2Tuple_u64u16Z_get_b(owner_conv);
7160         return ret_conv;
7161 }
7162
7163 static jclass LDKCOption_C2Tuple_u64u16ZZ_Some_class = NULL;
7164 static jmethodID LDKCOption_C2Tuple_u64u16ZZ_Some_meth = NULL;
7165 static jclass LDKCOption_C2Tuple_u64u16ZZ_None_class = NULL;
7166 static jmethodID LDKCOption_C2Tuple_u64u16ZZ_None_meth = NULL;
7167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u16ZZ_init (JNIEnv *env, jclass clz) {
7168         LDKCOption_C2Tuple_u64u16ZZ_Some_class =
7169                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u16ZZ$Some"));
7170         CHECK(LDKCOption_C2Tuple_u64u16ZZ_Some_class != NULL);
7171         LDKCOption_C2Tuple_u64u16ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u16ZZ_Some_class, "<init>", "(J)V");
7172         CHECK(LDKCOption_C2Tuple_u64u16ZZ_Some_meth != NULL);
7173         LDKCOption_C2Tuple_u64u16ZZ_None_class =
7174                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u16ZZ$None"));
7175         CHECK(LDKCOption_C2Tuple_u64u16ZZ_None_class != NULL);
7176         LDKCOption_C2Tuple_u64u16ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u16ZZ_None_class, "<init>", "()V");
7177         CHECK(LDKCOption_C2Tuple_u64u16ZZ_None_meth != NULL);
7178 }
7179 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u16ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7180         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
7181         switch(obj->tag) {
7182                 case LDKCOption_C2Tuple_u64u16ZZ_Some: {
7183                         LDKC2Tuple_u64u16Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
7184                         *some_conv = obj->some;
7185                         *some_conv = C2Tuple_u64u16Z_clone(some_conv);
7186                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u16ZZ_Some_class, LDKCOption_C2Tuple_u64u16ZZ_Some_meth, tag_ptr(some_conv, true));
7187                 }
7188                 case LDKCOption_C2Tuple_u64u16ZZ_None: {
7189                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u16ZZ_None_class, LDKCOption_C2Tuple_u64u16ZZ_None_meth);
7190                 }
7191                 default: abort();
7192         }
7193 }
7194 static jclass LDKCOption_ChannelShutdownStateZ_Some_class = NULL;
7195 static jmethodID LDKCOption_ChannelShutdownStateZ_Some_meth = NULL;
7196 static jclass LDKCOption_ChannelShutdownStateZ_None_class = NULL;
7197 static jmethodID LDKCOption_ChannelShutdownStateZ_None_meth = NULL;
7198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ChannelShutdownStateZ_init (JNIEnv *env, jclass clz) {
7199         LDKCOption_ChannelShutdownStateZ_Some_class =
7200                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ChannelShutdownStateZ$Some"));
7201         CHECK(LDKCOption_ChannelShutdownStateZ_Some_class != NULL);
7202         LDKCOption_ChannelShutdownStateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ChannelShutdownStateZ_Some_class, "<init>", "(Lorg/ldk/enums/ChannelShutdownState;)V");
7203         CHECK(LDKCOption_ChannelShutdownStateZ_Some_meth != NULL);
7204         LDKCOption_ChannelShutdownStateZ_None_class =
7205                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ChannelShutdownStateZ$None"));
7206         CHECK(LDKCOption_ChannelShutdownStateZ_None_class != NULL);
7207         LDKCOption_ChannelShutdownStateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ChannelShutdownStateZ_None_class, "<init>", "()V");
7208         CHECK(LDKCOption_ChannelShutdownStateZ_None_meth != NULL);
7209 }
7210 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ChannelShutdownStateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7211         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
7212         switch(obj->tag) {
7213                 case LDKCOption_ChannelShutdownStateZ_Some: {
7214                         jclass some_conv = LDKChannelShutdownState_to_java(env, obj->some);
7215                         return (*env)->NewObject(env, LDKCOption_ChannelShutdownStateZ_Some_class, LDKCOption_ChannelShutdownStateZ_Some_meth, some_conv);
7216                 }
7217                 case LDKCOption_ChannelShutdownStateZ_None: {
7218                         return (*env)->NewObject(env, LDKCOption_ChannelShutdownStateZ_None_class, LDKCOption_ChannelShutdownStateZ_None_meth);
7219                 }
7220                 default: abort();
7221         }
7222 }
7223 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesAPIErrorZ_get_ok(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
7224 CHECK(owner->result_ok);
7225         return ThirtyTwoBytes_clone(&*owner->contents.result);
7226 }
7227 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7228         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
7229         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7230         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesAPIErrorZ_get_ok(owner_conv).data);
7231         return ret_arr;
7232 }
7233
7234 static inline struct LDKAPIError CResult_ThirtyTwoBytesAPIErrorZ_get_err(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
7235 CHECK(!owner->result_ok);
7236         return APIError_clone(&*owner->contents.err);
7237 }
7238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7239         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
7240         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
7241         *ret_copy = CResult_ThirtyTwoBytesAPIErrorZ_get_err(owner_conv);
7242         int64_t ret_ref = tag_ptr(ret_copy, true);
7243         return ret_ref;
7244 }
7245
7246 static jclass LDKRecentPaymentDetails_AwaitingInvoice_class = NULL;
7247 static jmethodID LDKRecentPaymentDetails_AwaitingInvoice_meth = NULL;
7248 static jclass LDKRecentPaymentDetails_Pending_class = NULL;
7249 static jmethodID LDKRecentPaymentDetails_Pending_meth = NULL;
7250 static jclass LDKRecentPaymentDetails_Fulfilled_class = NULL;
7251 static jmethodID LDKRecentPaymentDetails_Fulfilled_meth = NULL;
7252 static jclass LDKRecentPaymentDetails_Abandoned_class = NULL;
7253 static jmethodID LDKRecentPaymentDetails_Abandoned_meth = NULL;
7254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRecentPaymentDetails_init (JNIEnv *env, jclass clz) {
7255         LDKRecentPaymentDetails_AwaitingInvoice_class =
7256                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$AwaitingInvoice"));
7257         CHECK(LDKRecentPaymentDetails_AwaitingInvoice_class != NULL);
7258         LDKRecentPaymentDetails_AwaitingInvoice_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_AwaitingInvoice_class, "<init>", "([B)V");
7259         CHECK(LDKRecentPaymentDetails_AwaitingInvoice_meth != NULL);
7260         LDKRecentPaymentDetails_Pending_class =
7261                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Pending"));
7262         CHECK(LDKRecentPaymentDetails_Pending_class != NULL);
7263         LDKRecentPaymentDetails_Pending_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Pending_class, "<init>", "([B[BJ)V");
7264         CHECK(LDKRecentPaymentDetails_Pending_meth != NULL);
7265         LDKRecentPaymentDetails_Fulfilled_class =
7266                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Fulfilled"));
7267         CHECK(LDKRecentPaymentDetails_Fulfilled_class != NULL);
7268         LDKRecentPaymentDetails_Fulfilled_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Fulfilled_class, "<init>", "([BJ)V");
7269         CHECK(LDKRecentPaymentDetails_Fulfilled_meth != NULL);
7270         LDKRecentPaymentDetails_Abandoned_class =
7271                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Abandoned"));
7272         CHECK(LDKRecentPaymentDetails_Abandoned_class != NULL);
7273         LDKRecentPaymentDetails_Abandoned_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Abandoned_class, "<init>", "([B[B)V");
7274         CHECK(LDKRecentPaymentDetails_Abandoned_meth != NULL);
7275 }
7276 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRecentPaymentDetails_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7277         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
7278         switch(obj->tag) {
7279                 case LDKRecentPaymentDetails_AwaitingInvoice: {
7280                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7281                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->awaiting_invoice.payment_id.data);
7282                         return (*env)->NewObject(env, LDKRecentPaymentDetails_AwaitingInvoice_class, LDKRecentPaymentDetails_AwaitingInvoice_meth, payment_id_arr);
7283                 }
7284                 case LDKRecentPaymentDetails_Pending: {
7285                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7286                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->pending.payment_id.data);
7287                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
7288                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->pending.payment_hash.data);
7289                         int64_t total_msat_conv = obj->pending.total_msat;
7290                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Pending_class, LDKRecentPaymentDetails_Pending_meth, payment_id_arr, payment_hash_arr, total_msat_conv);
7291                 }
7292                 case LDKRecentPaymentDetails_Fulfilled: {
7293                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7294                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->fulfilled.payment_id.data);
7295                         int64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
7296                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Fulfilled_class, LDKRecentPaymentDetails_Fulfilled_meth, payment_id_arr, payment_hash_ref);
7297                 }
7298                 case LDKRecentPaymentDetails_Abandoned: {
7299                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7300                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->abandoned.payment_id.data);
7301                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
7302                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->abandoned.payment_hash.data);
7303                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Abandoned_class, LDKRecentPaymentDetails_Abandoned_meth, payment_id_arr, payment_hash_arr);
7304                 }
7305                 default: abort();
7306         }
7307 }
7308 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
7309         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
7310         for (size_t i = 0; i < ret.datalen; i++) {
7311                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
7312         }
7313         return ret;
7314 }
7315 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
7316 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
7317 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
7318 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
7319 static jclass LDKPaymentSendFailure_AllFailedResendSafe_class = NULL;
7320 static jmethodID LDKPaymentSendFailure_AllFailedResendSafe_meth = NULL;
7321 static jclass LDKPaymentSendFailure_DuplicatePayment_class = NULL;
7322 static jmethodID LDKPaymentSendFailure_DuplicatePayment_meth = NULL;
7323 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
7324 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
7325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
7326         LDKPaymentSendFailure_ParameterError_class =
7327                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
7328         CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
7329         LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
7330         CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
7331         LDKPaymentSendFailure_PathParameterError_class =
7332                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
7333         CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
7334         LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
7335         CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
7336         LDKPaymentSendFailure_AllFailedResendSafe_class =
7337                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedResendSafe"));
7338         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_class != NULL);
7339         LDKPaymentSendFailure_AllFailedResendSafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedResendSafe_class, "<init>", "([J)V");
7340         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_meth != NULL);
7341         LDKPaymentSendFailure_DuplicatePayment_class =
7342                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$DuplicatePayment"));
7343         CHECK(LDKPaymentSendFailure_DuplicatePayment_class != NULL);
7344         LDKPaymentSendFailure_DuplicatePayment_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_DuplicatePayment_class, "<init>", "()V");
7345         CHECK(LDKPaymentSendFailure_DuplicatePayment_meth != NULL);
7346         LDKPaymentSendFailure_PartialFailure_class =
7347                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
7348         CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
7349         LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
7350         CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
7351 }
7352 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7353         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
7354         switch(obj->tag) {
7355                 case LDKPaymentSendFailure_ParameterError: {
7356                         int64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
7357                         return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
7358                 }
7359                 case LDKPaymentSendFailure_PathParameterError: {
7360                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
7361                         int64_tArray path_parameter_error_arr = NULL;
7362                         path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
7363                         int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
7364                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
7365                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7366                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
7367                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
7368                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
7369                         }
7370                         (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
7371                         return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
7372                 }
7373                 case LDKPaymentSendFailure_AllFailedResendSafe: {
7374                         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
7375                         int64_tArray all_failed_resend_safe_arr = NULL;
7376                         all_failed_resend_safe_arr = (*env)->NewLongArray(env, all_failed_resend_safe_var.datalen);
7377                         int64_t *all_failed_resend_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_resend_safe_arr, NULL);
7378                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
7379                                 int64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
7380                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
7381                         }
7382                         (*env)->ReleasePrimitiveArrayCritical(env, all_failed_resend_safe_arr, all_failed_resend_safe_arr_ptr, 0);
7383                         return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedResendSafe_class, LDKPaymentSendFailure_AllFailedResendSafe_meth, all_failed_resend_safe_arr);
7384                 }
7385                 case LDKPaymentSendFailure_DuplicatePayment: {
7386                         return (*env)->NewObject(env, LDKPaymentSendFailure_DuplicatePayment_class, LDKPaymentSendFailure_DuplicatePayment_meth);
7387                 }
7388                 case LDKPaymentSendFailure_PartialFailure: {
7389                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
7390                         int64_tArray results_arr = NULL;
7391                         results_arr = (*env)->NewLongArray(env, results_var.datalen);
7392                         int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
7393                         for (size_t w = 0; w < results_var.datalen; w++) {
7394                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7395                                 *results_conv_22_conv = results_var.data[w];
7396                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
7397                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
7398                         }
7399                         (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
7400                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
7401                         int64_t failed_paths_retry_ref = 0;
7402                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
7403                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
7404                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
7405                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
7406                         return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
7407                 }
7408                 default: abort();
7409         }
7410 }
7411 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
7412 CHECK(owner->result_ok);
7413         return *owner->contents.result;
7414 }
7415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7416         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
7417         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
7418 }
7419
7420 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
7421 CHECK(!owner->result_ok);
7422         return PaymentSendFailure_clone(&*owner->contents.err);
7423 }
7424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7425         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
7426         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
7427         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
7428         int64_t ret_ref = tag_ptr(ret_copy, true);
7429         return ret_ref;
7430 }
7431
7432 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
7433 CHECK(owner->result_ok);
7434         return *owner->contents.result;
7435 }
7436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7437         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
7438         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
7439 }
7440
7441 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
7442 CHECK(!owner->result_ok);
7443         return RetryableSendFailure_clone(&*owner->contents.err);
7444 }
7445 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7446         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
7447         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
7448         return ret_conv;
7449 }
7450
7451 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
7452 CHECK(owner->result_ok);
7453         return ThirtyTwoBytes_clone(&*owner->contents.result);
7454 }
7455 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7456         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
7457         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7458         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(owner_conv).data);
7459         return ret_arr;
7460 }
7461
7462 static inline struct LDKPaymentSendFailure CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
7463 CHECK(!owner->result_ok);
7464         return PaymentSendFailure_clone(&*owner->contents.err);
7465 }
7466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7467         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
7468         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
7469         *ret_copy = CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(owner_conv);
7470         int64_t ret_ref = tag_ptr(ret_copy, true);
7471         return ret_ref;
7472 }
7473
7474 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
7475 CHECK(owner->result_ok);
7476         return ThirtyTwoBytes_clone(&*owner->contents.result);
7477 }
7478 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7479         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
7480         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7481         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(owner_conv).data);
7482         return ret_arr;
7483 }
7484
7485 static inline enum LDKRetryableSendFailure CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
7486 CHECK(!owner->result_ok);
7487         return RetryableSendFailure_clone(&*owner->contents.err);
7488 }
7489 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7490         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
7491         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(owner_conv));
7492         return ret_conv;
7493 }
7494
7495 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
7496         return ThirtyTwoBytes_clone(&owner->a);
7497 }
7498 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7499         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
7500         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7501         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(owner_conv).data);
7502         return ret_arr;
7503 }
7504
7505 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
7506         return ThirtyTwoBytes_clone(&owner->b);
7507 }
7508 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7509         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
7510         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7511         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(owner_conv).data);
7512         return ret_arr;
7513 }
7514
7515 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
7516 CHECK(owner->result_ok);
7517         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
7518 }
7519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7520         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
7521         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
7522         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(owner_conv);
7523         return tag_ptr(ret_conv, true);
7524 }
7525
7526 static inline struct LDKPaymentSendFailure CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
7527 CHECK(!owner->result_ok);
7528         return PaymentSendFailure_clone(&*owner->contents.err);
7529 }
7530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7531         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
7532         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
7533         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(owner_conv);
7534         int64_t ret_ref = tag_ptr(ret_copy, true);
7535         return ret_ref;
7536 }
7537
7538 static inline LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *orig) {
7539         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ clone bytes"), .datalen = orig->datalen };
7540         for (size_t i = 0; i < ret.datalen; i++) {
7541                 ret.data[i] = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&orig->data[i]);
7542         }
7543         return ret;
7544 }
7545 static jclass LDKProbeSendFailure_RouteNotFound_class = NULL;
7546 static jmethodID LDKProbeSendFailure_RouteNotFound_meth = NULL;
7547 static jclass LDKProbeSendFailure_SendingFailed_class = NULL;
7548 static jmethodID LDKProbeSendFailure_SendingFailed_meth = NULL;
7549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKProbeSendFailure_init (JNIEnv *env, jclass clz) {
7550         LDKProbeSendFailure_RouteNotFound_class =
7551                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbeSendFailure$RouteNotFound"));
7552         CHECK(LDKProbeSendFailure_RouteNotFound_class != NULL);
7553         LDKProbeSendFailure_RouteNotFound_meth = (*env)->GetMethodID(env, LDKProbeSendFailure_RouteNotFound_class, "<init>", "()V");
7554         CHECK(LDKProbeSendFailure_RouteNotFound_meth != NULL);
7555         LDKProbeSendFailure_SendingFailed_class =
7556                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbeSendFailure$SendingFailed"));
7557         CHECK(LDKProbeSendFailure_SendingFailed_class != NULL);
7558         LDKProbeSendFailure_SendingFailed_meth = (*env)->GetMethodID(env, LDKProbeSendFailure_SendingFailed_class, "<init>", "(J)V");
7559         CHECK(LDKProbeSendFailure_SendingFailed_meth != NULL);
7560 }
7561 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKProbeSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7562         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
7563         switch(obj->tag) {
7564                 case LDKProbeSendFailure_RouteNotFound: {
7565                         return (*env)->NewObject(env, LDKProbeSendFailure_RouteNotFound_class, LDKProbeSendFailure_RouteNotFound_meth);
7566                 }
7567                 case LDKProbeSendFailure_SendingFailed: {
7568                         int64_t sending_failed_ref = tag_ptr(&obj->sending_failed, false);
7569                         return (*env)->NewObject(env, LDKProbeSendFailure_SendingFailed_class, LDKProbeSendFailure_SendingFailed_meth, sending_failed_ref);
7570                 }
7571                 default: abort();
7572         }
7573 }
7574 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
7575 CHECK(owner->result_ok);
7576         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
7577 }
7578 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7579         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
7580         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(owner_conv);
7581         int64_tArray ret_arr = NULL;
7582         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7583         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7584         for (size_t o = 0; o < ret_var.datalen; o++) {
7585                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
7586                 *ret_conv_40_conv = ret_var.data[o];
7587                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
7588         }
7589         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7590         FREE(ret_var.data);
7591         return ret_arr;
7592 }
7593
7594 static inline struct LDKProbeSendFailure CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
7595 CHECK(!owner->result_ok);
7596         return ProbeSendFailure_clone(&*owner->contents.err);
7597 }
7598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7599         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
7600         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
7601         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(owner_conv);
7602         int64_t ret_ref = tag_ptr(ret_copy, true);
7603         return ret_ref;
7604 }
7605
7606 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
7607         return ThirtyTwoBytes_clone(&owner->a);
7608 }
7609 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7610         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
7611         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7612         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(owner_conv).data);
7613         return ret_arr;
7614 }
7615
7616 static inline struct LDKPublicKey C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner){
7617         return owner->b;
7618 }
7619 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7620         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(owner);
7621         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
7622         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(owner_conv).compressed_form);
7623         return ret_arr;
7624 }
7625
7626 static inline LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ *orig) {
7627         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ clone bytes"), .datalen = orig->datalen };
7628         for (size_t i = 0; i < ret.datalen; i++) {
7629                 ret.data[i] = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(&orig->data[i]);
7630         }
7631         return ret;
7632 }
7633 static jclass LDKCOption_StrZ_Some_class = NULL;
7634 static jmethodID LDKCOption_StrZ_Some_meth = NULL;
7635 static jclass LDKCOption_StrZ_None_class = NULL;
7636 static jmethodID LDKCOption_StrZ_None_meth = NULL;
7637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1StrZ_init (JNIEnv *env, jclass clz) {
7638         LDKCOption_StrZ_Some_class =
7639                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_StrZ$Some"));
7640         CHECK(LDKCOption_StrZ_Some_class != NULL);
7641         LDKCOption_StrZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_StrZ_Some_class, "<init>", "(Ljava/lang/String;)V");
7642         CHECK(LDKCOption_StrZ_Some_meth != NULL);
7643         LDKCOption_StrZ_None_class =
7644                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_StrZ$None"));
7645         CHECK(LDKCOption_StrZ_None_class != NULL);
7646         LDKCOption_StrZ_None_meth = (*env)->GetMethodID(env, LDKCOption_StrZ_None_class, "<init>", "()V");
7647         CHECK(LDKCOption_StrZ_None_meth != NULL);
7648 }
7649 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1StrZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7650         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
7651         switch(obj->tag) {
7652                 case LDKCOption_StrZ_Some: {
7653                         LDKStr some_str = obj->some;
7654                         jstring some_conv = str_ref_to_java(env, some_str.chars, some_str.len);
7655                         return (*env)->NewObject(env, LDKCOption_StrZ_Some_class, LDKCOption_StrZ_Some_meth, some_conv);
7656                 }
7657                 case LDKCOption_StrZ_None: {
7658                         return (*env)->NewObject(env, LDKCOption_StrZ_None_class, LDKCOption_StrZ_None_meth);
7659                 }
7660                 default: abort();
7661         }
7662 }
7663 static inline void CResult_NoneBolt12SemanticErrorZ_get_ok(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
7664 CHECK(owner->result_ok);
7665         return *owner->contents.result;
7666 }
7667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7668         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
7669         CResult_NoneBolt12SemanticErrorZ_get_ok(owner_conv);
7670 }
7671
7672 static inline enum LDKBolt12SemanticError CResult_NoneBolt12SemanticErrorZ_get_err(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
7673 CHECK(!owner->result_ok);
7674         return Bolt12SemanticError_clone(&*owner->contents.err);
7675 }
7676 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7677         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
7678         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_NoneBolt12SemanticErrorZ_get_err(owner_conv));
7679         return ret_conv;
7680 }
7681
7682 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
7683 CHECK(owner->result_ok);
7684         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
7685 }
7686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7687         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
7688         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
7689         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(owner_conv);
7690         return tag_ptr(ret_conv, true);
7691 }
7692
7693 static inline void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
7694 CHECK(!owner->result_ok);
7695         return *owner->contents.err;
7696 }
7697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7698         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
7699         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(owner_conv);
7700 }
7701
7702 static jclass LDKOffersMessage_InvoiceRequest_class = NULL;
7703 static jmethodID LDKOffersMessage_InvoiceRequest_meth = NULL;
7704 static jclass LDKOffersMessage_Invoice_class = NULL;
7705 static jmethodID LDKOffersMessage_Invoice_meth = NULL;
7706 static jclass LDKOffersMessage_InvoiceError_class = NULL;
7707 static jmethodID LDKOffersMessage_InvoiceError_meth = NULL;
7708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKOffersMessage_init (JNIEnv *env, jclass clz) {
7709         LDKOffersMessage_InvoiceRequest_class =
7710                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceRequest"));
7711         CHECK(LDKOffersMessage_InvoiceRequest_class != NULL);
7712         LDKOffersMessage_InvoiceRequest_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceRequest_class, "<init>", "(J)V");
7713         CHECK(LDKOffersMessage_InvoiceRequest_meth != NULL);
7714         LDKOffersMessage_Invoice_class =
7715                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$Invoice"));
7716         CHECK(LDKOffersMessage_Invoice_class != NULL);
7717         LDKOffersMessage_Invoice_meth = (*env)->GetMethodID(env, LDKOffersMessage_Invoice_class, "<init>", "(J)V");
7718         CHECK(LDKOffersMessage_Invoice_meth != NULL);
7719         LDKOffersMessage_InvoiceError_class =
7720                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceError"));
7721         CHECK(LDKOffersMessage_InvoiceError_class != NULL);
7722         LDKOffersMessage_InvoiceError_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceError_class, "<init>", "(J)V");
7723         CHECK(LDKOffersMessage_InvoiceError_meth != NULL);
7724 }
7725 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOffersMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7726         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
7727         switch(obj->tag) {
7728                 case LDKOffersMessage_InvoiceRequest: {
7729                         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
7730                         int64_t invoice_request_ref = 0;
7731                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
7732                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
7733                         return (*env)->NewObject(env, LDKOffersMessage_InvoiceRequest_class, LDKOffersMessage_InvoiceRequest_meth, invoice_request_ref);
7734                 }
7735                 case LDKOffersMessage_Invoice: {
7736                         LDKBolt12Invoice invoice_var = obj->invoice;
7737                         int64_t invoice_ref = 0;
7738                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
7739                         invoice_ref = tag_ptr(invoice_var.inner, false);
7740                         return (*env)->NewObject(env, LDKOffersMessage_Invoice_class, LDKOffersMessage_Invoice_meth, invoice_ref);
7741                 }
7742                 case LDKOffersMessage_InvoiceError: {
7743                         LDKInvoiceError invoice_error_var = obj->invoice_error;
7744                         int64_t invoice_error_ref = 0;
7745                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
7746                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
7747                         return (*env)->NewObject(env, LDKOffersMessage_InvoiceError_class, LDKOffersMessage_InvoiceError_meth, invoice_error_ref);
7748                 }
7749                 default: abort();
7750         }
7751 }
7752 static jclass LDKCOption_OffersMessageZ_Some_class = NULL;
7753 static jmethodID LDKCOption_OffersMessageZ_Some_meth = NULL;
7754 static jclass LDKCOption_OffersMessageZ_None_class = NULL;
7755 static jmethodID LDKCOption_OffersMessageZ_None_meth = NULL;
7756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1OffersMessageZ_init (JNIEnv *env, jclass clz) {
7757         LDKCOption_OffersMessageZ_Some_class =
7758                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$Some"));
7759         CHECK(LDKCOption_OffersMessageZ_Some_class != NULL);
7760         LDKCOption_OffersMessageZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_Some_class, "<init>", "(J)V");
7761         CHECK(LDKCOption_OffersMessageZ_Some_meth != NULL);
7762         LDKCOption_OffersMessageZ_None_class =
7763                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$None"));
7764         CHECK(LDKCOption_OffersMessageZ_None_class != NULL);
7765         LDKCOption_OffersMessageZ_None_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_None_class, "<init>", "()V");
7766         CHECK(LDKCOption_OffersMessageZ_None_meth != NULL);
7767 }
7768 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OffersMessageZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7769         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
7770         switch(obj->tag) {
7771                 case LDKCOption_OffersMessageZ_Some: {
7772                         int64_t some_ref = tag_ptr(&obj->some, false);
7773                         return (*env)->NewObject(env, LDKCOption_OffersMessageZ_Some_class, LDKCOption_OffersMessageZ_Some_meth, some_ref);
7774                 }
7775                 case LDKCOption_OffersMessageZ_None: {
7776                         return (*env)->NewObject(env, LDKCOption_OffersMessageZ_None_class, LDKCOption_OffersMessageZ_None_meth);
7777                 }
7778                 default: abort();
7779         }
7780 }
7781 static jclass LDKDestination_Node_class = NULL;
7782 static jmethodID LDKDestination_Node_meth = NULL;
7783 static jclass LDKDestination_BlindedPath_class = NULL;
7784 static jmethodID LDKDestination_BlindedPath_meth = NULL;
7785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDestination_init (JNIEnv *env, jclass clz) {
7786         LDKDestination_Node_class =
7787                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$Node"));
7788         CHECK(LDKDestination_Node_class != NULL);
7789         LDKDestination_Node_meth = (*env)->GetMethodID(env, LDKDestination_Node_class, "<init>", "([B)V");
7790         CHECK(LDKDestination_Node_meth != NULL);
7791         LDKDestination_BlindedPath_class =
7792                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$BlindedPath"));
7793         CHECK(LDKDestination_BlindedPath_class != NULL);
7794         LDKDestination_BlindedPath_meth = (*env)->GetMethodID(env, LDKDestination_BlindedPath_class, "<init>", "(J)V");
7795         CHECK(LDKDestination_BlindedPath_meth != NULL);
7796 }
7797 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7798         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
7799         switch(obj->tag) {
7800                 case LDKDestination_Node: {
7801                         int8_tArray node_arr = (*env)->NewByteArray(env, 33);
7802                         (*env)->SetByteArrayRegion(env, node_arr, 0, 33, obj->node.compressed_form);
7803                         return (*env)->NewObject(env, LDKDestination_Node_class, LDKDestination_Node_meth, node_arr);
7804                 }
7805                 case LDKDestination_BlindedPath: {
7806                         LDKBlindedPath blinded_path_var = obj->blinded_path;
7807                         int64_t blinded_path_ref = 0;
7808                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
7809                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
7810                         return (*env)->NewObject(env, LDKDestination_BlindedPath_class, LDKDestination_BlindedPath_meth, blinded_path_ref);
7811                 }
7812                 default: abort();
7813         }
7814 }
7815 static inline struct LDKOffersMessage C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
7816         return OffersMessage_clone(&owner->a);
7817 }
7818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7819         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
7820         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
7821         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(owner_conv);
7822         int64_t ret_ref = tag_ptr(ret_copy, true);
7823         return ret_ref;
7824 }
7825
7826 static inline struct LDKDestination C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
7827         return Destination_clone(&owner->b);
7828 }
7829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7830         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
7831         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
7832         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(owner_conv);
7833         int64_t ret_ref = tag_ptr(ret_copy, true);
7834         return ret_ref;
7835 }
7836
7837 static inline struct LDKBlindedPath C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
7838         LDKBlindedPath ret = owner->c;
7839         ret.is_owned = false;
7840         return ret;
7841 }
7842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
7843         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
7844         LDKBlindedPath ret_var = C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(owner_conv);
7845         int64_t ret_ref = 0;
7846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7847         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7848         return ret_ref;
7849 }
7850
7851 static inline LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ *orig) {
7852         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
7853         for (size_t i = 0; i < ret.datalen; i++) {
7854                 ret.data[i] = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(&orig->data[i]);
7855         }
7856         return ret;
7857 }
7858 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
7859         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
7860         ret.is_owned = false;
7861         return ret;
7862 }
7863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7864         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
7865         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
7866         int64_t ret_ref = 0;
7867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7869         return ret_ref;
7870 }
7871
7872 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
7873 CHECK(!owner->result_ok);
7874         return DecodeError_clone(&*owner->contents.err);
7875 }
7876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7877         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
7878         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7879         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
7880         int64_t ret_ref = tag_ptr(ret_copy, true);
7881         return ret_ref;
7882 }
7883
7884 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
7885         LDKChannelCounterparty ret = *owner->contents.result;
7886         ret.is_owned = false;
7887         return ret;
7888 }
7889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7890         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
7891         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
7892         int64_t ret_ref = 0;
7893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7895         return ret_ref;
7896 }
7897
7898 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
7899 CHECK(!owner->result_ok);
7900         return DecodeError_clone(&*owner->contents.err);
7901 }
7902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7903         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
7904         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7905         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
7906         int64_t ret_ref = tag_ptr(ret_copy, true);
7907         return ret_ref;
7908 }
7909
7910 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
7911         LDKChannelDetails ret = *owner->contents.result;
7912         ret.is_owned = false;
7913         return ret;
7914 }
7915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7916         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
7917         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
7918         int64_t ret_ref = 0;
7919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7921         return ret_ref;
7922 }
7923
7924 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
7925 CHECK(!owner->result_ok);
7926         return DecodeError_clone(&*owner->contents.err);
7927 }
7928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7929         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
7930         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7931         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
7932         int64_t ret_ref = tag_ptr(ret_copy, true);
7933         return ret_ref;
7934 }
7935
7936 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
7937         LDKPhantomRouteHints ret = *owner->contents.result;
7938         ret.is_owned = false;
7939         return ret;
7940 }
7941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7942         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
7943         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
7944         int64_t ret_ref = 0;
7945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7947         return ret_ref;
7948 }
7949
7950 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
7951 CHECK(!owner->result_ok);
7952         return DecodeError_clone(&*owner->contents.err);
7953 }
7954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7955         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
7956         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7957         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
7958         int64_t ret_ref = tag_ptr(ret_copy, true);
7959         return ret_ref;
7960 }
7961
7962 static inline struct LDKBlindedForward CResult_BlindedForwardDecodeErrorZ_get_ok(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
7963         LDKBlindedForward ret = *owner->contents.result;
7964         ret.is_owned = false;
7965         return ret;
7966 }
7967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7968         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
7969         LDKBlindedForward ret_var = CResult_BlindedForwardDecodeErrorZ_get_ok(owner_conv);
7970         int64_t ret_ref = 0;
7971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7973         return ret_ref;
7974 }
7975
7976 static inline struct LDKDecodeError CResult_BlindedForwardDecodeErrorZ_get_err(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
7977 CHECK(!owner->result_ok);
7978         return DecodeError_clone(&*owner->contents.err);
7979 }
7980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7981         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
7982         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7983         *ret_copy = CResult_BlindedForwardDecodeErrorZ_get_err(owner_conv);
7984         int64_t ret_ref = tag_ptr(ret_copy, true);
7985         return ret_ref;
7986 }
7987
7988 static jclass LDKPendingHTLCRouting_Forward_class = NULL;
7989 static jmethodID LDKPendingHTLCRouting_Forward_meth = NULL;
7990 static jclass LDKPendingHTLCRouting_Receive_class = NULL;
7991 static jmethodID LDKPendingHTLCRouting_Receive_meth = NULL;
7992 static jclass LDKPendingHTLCRouting_ReceiveKeysend_class = NULL;
7993 static jmethodID LDKPendingHTLCRouting_ReceiveKeysend_meth = NULL;
7994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPendingHTLCRouting_init (JNIEnv *env, jclass clz) {
7995         LDKPendingHTLCRouting_Forward_class =
7996                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPendingHTLCRouting$Forward"));
7997         CHECK(LDKPendingHTLCRouting_Forward_class != NULL);
7998         LDKPendingHTLCRouting_Forward_meth = (*env)->GetMethodID(env, LDKPendingHTLCRouting_Forward_class, "<init>", "(JJJ)V");
7999         CHECK(LDKPendingHTLCRouting_Forward_meth != NULL);
8000         LDKPendingHTLCRouting_Receive_class =
8001                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPendingHTLCRouting$Receive"));
8002         CHECK(LDKPendingHTLCRouting_Receive_class != NULL);
8003         LDKPendingHTLCRouting_Receive_meth = (*env)->GetMethodID(env, LDKPendingHTLCRouting_Receive_class, "<init>", "(JJI[B[JZ)V");
8004         CHECK(LDKPendingHTLCRouting_Receive_meth != NULL);
8005         LDKPendingHTLCRouting_ReceiveKeysend_class =
8006                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPendingHTLCRouting$ReceiveKeysend"));
8007         CHECK(LDKPendingHTLCRouting_ReceiveKeysend_class != NULL);
8008         LDKPendingHTLCRouting_ReceiveKeysend_meth = (*env)->GetMethodID(env, LDKPendingHTLCRouting_ReceiveKeysend_class, "<init>", "(J[BJI[J)V");
8009         CHECK(LDKPendingHTLCRouting_ReceiveKeysend_meth != NULL);
8010 }
8011 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPendingHTLCRouting_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8012         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
8013         switch(obj->tag) {
8014                 case LDKPendingHTLCRouting_Forward: {
8015                         LDKOnionPacket onion_packet_var = obj->forward.onion_packet;
8016                         int64_t onion_packet_ref = 0;
8017                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_var);
8018                         onion_packet_ref = tag_ptr(onion_packet_var.inner, false);
8019                         int64_t short_channel_id_conv = obj->forward.short_channel_id;
8020                         LDKBlindedForward blinded_var = obj->forward.blinded;
8021                         int64_t blinded_ref = 0;
8022                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
8023                         blinded_ref = tag_ptr(blinded_var.inner, false);
8024                         return (*env)->NewObject(env, LDKPendingHTLCRouting_Forward_class, LDKPendingHTLCRouting_Forward_meth, onion_packet_ref, short_channel_id_conv, blinded_ref);
8025                 }
8026                 case LDKPendingHTLCRouting_Receive: {
8027                         LDKFinalOnionHopData payment_data_var = obj->receive.payment_data;
8028                         int64_t payment_data_ref = 0;
8029                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
8030                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
8031                         int64_t payment_metadata_ref = tag_ptr(&obj->receive.payment_metadata, false);
8032                         int32_t incoming_cltv_expiry_conv = obj->receive.incoming_cltv_expiry;
8033                         int8_tArray phantom_shared_secret_arr = (*env)->NewByteArray(env, 32);
8034                         (*env)->SetByteArrayRegion(env, phantom_shared_secret_arr, 0, 32, obj->receive.phantom_shared_secret.data);
8035                         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive.custom_tlvs;
8036                         int64_tArray custom_tlvs_arr = NULL;
8037                         custom_tlvs_arr = (*env)->NewLongArray(env, custom_tlvs_var.datalen);
8038                         int64_t *custom_tlvs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, custom_tlvs_arr, NULL);
8039                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
8040                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
8041                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
8042                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
8043                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
8044                         }
8045                         (*env)->ReleasePrimitiveArrayCritical(env, custom_tlvs_arr, custom_tlvs_arr_ptr, 0);
8046                         jboolean requires_blinded_error_conv = obj->receive.requires_blinded_error;
8047                         return (*env)->NewObject(env, LDKPendingHTLCRouting_Receive_class, LDKPendingHTLCRouting_Receive_meth, payment_data_ref, payment_metadata_ref, incoming_cltv_expiry_conv, phantom_shared_secret_arr, custom_tlvs_arr, requires_blinded_error_conv);
8048                 }
8049                 case LDKPendingHTLCRouting_ReceiveKeysend: {
8050                         LDKFinalOnionHopData payment_data_var = obj->receive_keysend.payment_data;
8051                         int64_t payment_data_ref = 0;
8052                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
8053                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
8054                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
8055                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->receive_keysend.payment_preimage.data);
8056                         int64_t payment_metadata_ref = tag_ptr(&obj->receive_keysend.payment_metadata, false);
8057                         int32_t incoming_cltv_expiry_conv = obj->receive_keysend.incoming_cltv_expiry;
8058                         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive_keysend.custom_tlvs;
8059                         int64_tArray custom_tlvs_arr = NULL;
8060                         custom_tlvs_arr = (*env)->NewLongArray(env, custom_tlvs_var.datalen);
8061                         int64_t *custom_tlvs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, custom_tlvs_arr, NULL);
8062                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
8063                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
8064                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
8065                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
8066                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
8067                         }
8068                         (*env)->ReleasePrimitiveArrayCritical(env, custom_tlvs_arr, custom_tlvs_arr_ptr, 0);
8069                         return (*env)->NewObject(env, LDKPendingHTLCRouting_ReceiveKeysend_class, LDKPendingHTLCRouting_ReceiveKeysend_meth, payment_data_ref, payment_preimage_arr, payment_metadata_ref, incoming_cltv_expiry_conv, custom_tlvs_arr);
8070                 }
8071                 default: abort();
8072         }
8073 }
8074 static inline struct LDKPendingHTLCRouting CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
8075 CHECK(owner->result_ok);
8076         return PendingHTLCRouting_clone(&*owner->contents.result);
8077 }
8078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8079         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
8080         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
8081         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(owner_conv);
8082         int64_t ret_ref = tag_ptr(ret_copy, true);
8083         return ret_ref;
8084 }
8085
8086 static inline struct LDKDecodeError CResult_PendingHTLCRoutingDecodeErrorZ_get_err(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
8087 CHECK(!owner->result_ok);
8088         return DecodeError_clone(&*owner->contents.err);
8089 }
8090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8091         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
8092         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8093         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_err(owner_conv);
8094         int64_t ret_ref = tag_ptr(ret_copy, true);
8095         return ret_ref;
8096 }
8097
8098 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoDecodeErrorZ_get_ok(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
8099         LDKPendingHTLCInfo ret = *owner->contents.result;
8100         ret.is_owned = false;
8101         return ret;
8102 }
8103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8104         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
8105         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoDecodeErrorZ_get_ok(owner_conv);
8106         int64_t ret_ref = 0;
8107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8109         return ret_ref;
8110 }
8111
8112 static inline struct LDKDecodeError CResult_PendingHTLCInfoDecodeErrorZ_get_err(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
8113 CHECK(!owner->result_ok);
8114         return DecodeError_clone(&*owner->contents.err);
8115 }
8116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8117         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
8118         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8119         *ret_copy = CResult_PendingHTLCInfoDecodeErrorZ_get_err(owner_conv);
8120         int64_t ret_ref = tag_ptr(ret_copy, true);
8121         return ret_ref;
8122 }
8123
8124 static inline enum LDKBlindedFailure CResult_BlindedFailureDecodeErrorZ_get_ok(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
8125 CHECK(owner->result_ok);
8126         return BlindedFailure_clone(&*owner->contents.result);
8127 }
8128 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8129         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
8130         jclass ret_conv = LDKBlindedFailure_to_java(env, CResult_BlindedFailureDecodeErrorZ_get_ok(owner_conv));
8131         return ret_conv;
8132 }
8133
8134 static inline struct LDKDecodeError CResult_BlindedFailureDecodeErrorZ_get_err(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
8135 CHECK(!owner->result_ok);
8136         return DecodeError_clone(&*owner->contents.err);
8137 }
8138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8139         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
8140         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8141         *ret_copy = CResult_BlindedFailureDecodeErrorZ_get_err(owner_conv);
8142         int64_t ret_ref = tag_ptr(ret_copy, true);
8143         return ret_ref;
8144 }
8145
8146 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
8147 CHECK(owner->result_ok);
8148         return ChannelShutdownState_clone(&*owner->contents.result);
8149 }
8150 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8151         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
8152         jclass ret_conv = LDKChannelShutdownState_to_java(env, CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
8153         return ret_conv;
8154 }
8155
8156 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
8157 CHECK(!owner->result_ok);
8158         return DecodeError_clone(&*owner->contents.err);
8159 }
8160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8161         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
8162         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8163         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
8164         int64_t ret_ref = tag_ptr(ret_copy, true);
8165         return ret_ref;
8166 }
8167
8168 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
8169         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
8170         for (size_t i = 0; i < ret.datalen; i++) {
8171                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
8172         }
8173         return ret;
8174 }
8175 typedef struct LDKWatch_JCalls {
8176         atomic_size_t refcnt;
8177         JavaVM *vm;
8178         jweak o;
8179         jmethodID watch_channel_meth;
8180         jmethodID update_channel_meth;
8181         jmethodID release_pending_monitor_events_meth;
8182 } LDKWatch_JCalls;
8183 static void LDKWatch_JCalls_free(void* this_arg) {
8184         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
8185         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8186                 JNIEnv *env;
8187                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8188                 if (get_jenv_res == JNI_EDETACHED) {
8189                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8190                 } else {
8191                         DO_ASSERT(get_jenv_res == JNI_OK);
8192                 }
8193                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8194                 if (get_jenv_res == JNI_EDETACHED) {
8195                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8196                 }
8197                 FREE(j_calls);
8198         }
8199 }
8200 LDKCResult_ChannelMonitorUpdateStatusNoneZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
8201         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
8202         JNIEnv *env;
8203         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8204         if (get_jenv_res == JNI_EDETACHED) {
8205                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8206         } else {
8207                 DO_ASSERT(get_jenv_res == JNI_OK);
8208         }
8209         LDKOutPoint funding_txo_var = funding_txo;
8210         int64_t funding_txo_ref = 0;
8211         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
8212         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
8213         LDKChannelMonitor monitor_var = monitor;
8214         int64_t monitor_ref = 0;
8215         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
8216         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
8217         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8218         CHECK(obj != NULL);
8219         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
8220         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8221                 (*env)->ExceptionDescribe(env);
8222                 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
8223         }
8224         void* ret_ptr = untag_ptr(ret);
8225         CHECK_ACCESS(ret_ptr);
8226         LDKCResult_ChannelMonitorUpdateStatusNoneZ ret_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(ret_ptr);
8227         FREE(untag_ptr(ret));
8228         if (get_jenv_res == JNI_EDETACHED) {
8229                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8230         }
8231         return ret_conv;
8232 }
8233 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
8234         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
8235         JNIEnv *env;
8236         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8237         if (get_jenv_res == JNI_EDETACHED) {
8238                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8239         } else {
8240                 DO_ASSERT(get_jenv_res == JNI_OK);
8241         }
8242         LDKOutPoint funding_txo_var = funding_txo;
8243         int64_t funding_txo_ref = 0;
8244         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
8245         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
8246         LDKChannelMonitorUpdate update_var = *update;
8247         int64_t update_ref = 0;
8248         update_var = ChannelMonitorUpdate_clone(&update_var);
8249         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
8250         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
8251         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8252         CHECK(obj != NULL);
8253         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
8254         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8255                 (*env)->ExceptionDescribe(env);
8256                 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
8257         }
8258         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
8259         if (get_jenv_res == JNI_EDETACHED) {
8260                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8261         }
8262         return ret_conv;
8263 }
8264 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
8265         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
8266         JNIEnv *env;
8267         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8268         if (get_jenv_res == JNI_EDETACHED) {
8269                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8270         } else {
8271                 DO_ASSERT(get_jenv_res == JNI_OK);
8272         }
8273         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8274         CHECK(obj != NULL);
8275         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
8276         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8277                 (*env)->ExceptionDescribe(env);
8278                 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
8279         }
8280         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
8281         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
8282         if (ret_constr.datalen > 0)
8283                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
8284         else
8285                 ret_constr.data = NULL;
8286         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
8287         for (size_t x = 0; x < ret_constr.datalen; x++) {
8288                 int64_t ret_conv_49 = ret_vals[x];
8289                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
8290                 CHECK_ACCESS(ret_conv_49_ptr);
8291                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
8292                 FREE(untag_ptr(ret_conv_49));
8293                 ret_constr.data[x] = ret_conv_49_conv;
8294         }
8295         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
8296         if (get_jenv_res == JNI_EDETACHED) {
8297                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8298         }
8299         return ret_constr;
8300 }
8301 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
8302         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
8303         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8304 }
8305 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
8306         jclass c = (*env)->GetObjectClass(env, o);
8307         CHECK(c != NULL);
8308         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
8309         atomic_init(&calls->refcnt, 1);
8310         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8311         calls->o = (*env)->NewWeakGlobalRef(env, o);
8312         calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
8313         CHECK(calls->watch_channel_meth != NULL);
8314         calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
8315         CHECK(calls->update_channel_meth != NULL);
8316         calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
8317         CHECK(calls->release_pending_monitor_events_meth != NULL);
8318
8319         LDKWatch ret = {
8320                 .this_arg = (void*) calls,
8321                 .watch_channel = watch_channel_LDKWatch_jcall,
8322                 .update_channel = update_channel_LDKWatch_jcall,
8323                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
8324                 .free = LDKWatch_JCalls_free,
8325         };
8326         return ret;
8327 }
8328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
8329         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
8330         *res_ptr = LDKWatch_init(env, clz, o);
8331         return tag_ptr(res_ptr, true);
8332 }
8333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Watch_1watch_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t monitor) {
8334         void* this_arg_ptr = untag_ptr(this_arg);
8335         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8336         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
8337         LDKOutPoint funding_txo_conv;
8338         funding_txo_conv.inner = untag_ptr(funding_txo);
8339         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
8340         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
8341         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
8342         LDKChannelMonitor monitor_conv;
8343         monitor_conv.inner = untag_ptr(monitor);
8344         monitor_conv.is_owned = ptr_is_owned(monitor);
8345         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
8346         monitor_conv = ChannelMonitor_clone(&monitor_conv);
8347         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
8348         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
8349         return tag_ptr(ret_conv, true);
8350 }
8351
8352 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t update) {
8353         void* this_arg_ptr = untag_ptr(this_arg);
8354         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8355         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
8356         LDKOutPoint funding_txo_conv;
8357         funding_txo_conv.inner = untag_ptr(funding_txo);
8358         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
8359         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
8360         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
8361         LDKChannelMonitorUpdate update_conv;
8362         update_conv.inner = untag_ptr(update);
8363         update_conv.is_owned = ptr_is_owned(update);
8364         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
8365         update_conv.is_owned = false;
8366         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
8367         return ret_conv;
8368 }
8369
8370 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
8371         void* this_arg_ptr = untag_ptr(this_arg);
8372         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8373         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
8374         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
8375         int64_tArray ret_arr = NULL;
8376         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8377         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8378         for (size_t x = 0; x < ret_var.datalen; x++) {
8379                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
8380                 *ret_conv_49_conv = ret_var.data[x];
8381                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
8382         }
8383         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8384         FREE(ret_var.data);
8385         return ret_arr;
8386 }
8387
8388 typedef struct LDKBroadcasterInterface_JCalls {
8389         atomic_size_t refcnt;
8390         JavaVM *vm;
8391         jweak o;
8392         jmethodID broadcast_transactions_meth;
8393 } LDKBroadcasterInterface_JCalls;
8394 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
8395         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
8396         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8397                 JNIEnv *env;
8398                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8399                 if (get_jenv_res == JNI_EDETACHED) {
8400                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8401                 } else {
8402                         DO_ASSERT(get_jenv_res == JNI_OK);
8403                 }
8404                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8405                 if (get_jenv_res == JNI_EDETACHED) {
8406                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8407                 }
8408                 FREE(j_calls);
8409         }
8410 }
8411 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
8412         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
8413         JNIEnv *env;
8414         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8415         if (get_jenv_res == JNI_EDETACHED) {
8416                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8417         } else {
8418                 DO_ASSERT(get_jenv_res == JNI_OK);
8419         }
8420         LDKCVec_TransactionZ txs_var = txs;
8421         jobjectArray txs_arr = NULL;
8422         txs_arr = (*env)->NewObjectArray(env, txs_var.datalen, arr_of_B_clz, NULL);
8423         ;
8424         for (size_t i = 0; i < txs_var.datalen; i++) {
8425                 LDKTransaction txs_conv_8_var = txs_var.data[i];
8426                 int8_tArray txs_conv_8_arr = (*env)->NewByteArray(env, txs_conv_8_var.datalen);
8427                 (*env)->SetByteArrayRegion(env, txs_conv_8_arr, 0, txs_conv_8_var.datalen, txs_conv_8_var.data);
8428                 Transaction_free(txs_conv_8_var);
8429                 (*env)->SetObjectArrayElement(env, txs_arr, i, txs_conv_8_arr);
8430         }
8431         
8432         FREE(txs_var.data);
8433         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8434         CHECK(obj != NULL);
8435         (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transactions_meth, txs_arr);
8436         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8437                 (*env)->ExceptionDescribe(env);
8438                 (*env)->FatalError(env, "A call to broadcast_transactions in LDKBroadcasterInterface from rust threw an exception.");
8439         }
8440         if (get_jenv_res == JNI_EDETACHED) {
8441                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8442         }
8443 }
8444 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
8445         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
8446         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8447 }
8448 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
8449         jclass c = (*env)->GetObjectClass(env, o);
8450         CHECK(c != NULL);
8451         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
8452         atomic_init(&calls->refcnt, 1);
8453         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8454         calls->o = (*env)->NewWeakGlobalRef(env, o);
8455         calls->broadcast_transactions_meth = (*env)->GetMethodID(env, c, "broadcast_transactions", "([[B)V");
8456         CHECK(calls->broadcast_transactions_meth != NULL);
8457
8458         LDKBroadcasterInterface ret = {
8459                 .this_arg = (void*) calls,
8460                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
8461                 .free = LDKBroadcasterInterface_JCalls_free,
8462         };
8463         return ret;
8464 }
8465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
8466         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
8467         *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
8468         return tag_ptr(res_ptr, true);
8469 }
8470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transactions(JNIEnv *env, jclass clz, int64_t this_arg, jobjectArray txs) {
8471         void* this_arg_ptr = untag_ptr(this_arg);
8472         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8473         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
8474         LDKCVec_TransactionZ txs_constr;
8475         txs_constr.datalen = (*env)->GetArrayLength(env, txs);
8476         if (txs_constr.datalen > 0)
8477                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
8478         else
8479                 txs_constr.data = NULL;
8480         for (size_t i = 0; i < txs_constr.datalen; i++) {
8481                 int8_tArray txs_conv_8 = (*env)->GetObjectArrayElement(env, txs, i);
8482                 LDKTransaction txs_conv_8_ref;
8483                 txs_conv_8_ref.datalen = (*env)->GetArrayLength(env, txs_conv_8);
8484                 txs_conv_8_ref.data = MALLOC(txs_conv_8_ref.datalen, "LDKTransaction Bytes");
8485                 (*env)->GetByteArrayRegion(env, txs_conv_8, 0, txs_conv_8_ref.datalen, txs_conv_8_ref.data);
8486                 txs_conv_8_ref.data_is_owned = true;
8487                 txs_constr.data[i] = txs_conv_8_ref;
8488         }
8489         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
8490 }
8491
8492 typedef struct LDKEntropySource_JCalls {
8493         atomic_size_t refcnt;
8494         JavaVM *vm;
8495         jweak o;
8496         jmethodID get_secure_random_bytes_meth;
8497 } LDKEntropySource_JCalls;
8498 static void LDKEntropySource_JCalls_free(void* this_arg) {
8499         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
8500         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8501                 JNIEnv *env;
8502                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8503                 if (get_jenv_res == JNI_EDETACHED) {
8504                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8505                 } else {
8506                         DO_ASSERT(get_jenv_res == JNI_OK);
8507                 }
8508                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8509                 if (get_jenv_res == JNI_EDETACHED) {
8510                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8511                 }
8512                 FREE(j_calls);
8513         }
8514 }
8515 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
8516         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
8517         JNIEnv *env;
8518         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8519         if (get_jenv_res == JNI_EDETACHED) {
8520                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8521         } else {
8522                 DO_ASSERT(get_jenv_res == JNI_OK);
8523         }
8524         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8525         CHECK(obj != NULL);
8526         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
8527         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8528                 (*env)->ExceptionDescribe(env);
8529                 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKEntropySource from rust threw an exception.");
8530         }
8531         LDKThirtyTwoBytes ret_ref;
8532         CHECK((*env)->GetArrayLength(env, ret) == 32);
8533         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
8534         if (get_jenv_res == JNI_EDETACHED) {
8535                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8536         }
8537         return ret_ref;
8538 }
8539 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
8540         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
8541         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8542 }
8543 static inline LDKEntropySource LDKEntropySource_init (JNIEnv *env, jclass clz, jobject o) {
8544         jclass c = (*env)->GetObjectClass(env, o);
8545         CHECK(c != NULL);
8546         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
8547         atomic_init(&calls->refcnt, 1);
8548         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8549         calls->o = (*env)->NewWeakGlobalRef(env, o);
8550         calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
8551         CHECK(calls->get_secure_random_bytes_meth != NULL);
8552
8553         LDKEntropySource ret = {
8554                 .this_arg = (void*) calls,
8555                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
8556                 .free = LDKEntropySource_JCalls_free,
8557         };
8558         return ret;
8559 }
8560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEntropySource_1new(JNIEnv *env, jclass clz, jobject o) {
8561         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
8562         *res_ptr = LDKEntropySource_init(env, clz, o);
8563         return tag_ptr(res_ptr, true);
8564 }
8565 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_EntropySource_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
8566         void* this_arg_ptr = untag_ptr(this_arg);
8567         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8568         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
8569         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8570         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
8571         return ret_arr;
8572 }
8573
8574 static jclass LDKUnsignedGossipMessage_ChannelAnnouncement_class = NULL;
8575 static jmethodID LDKUnsignedGossipMessage_ChannelAnnouncement_meth = NULL;
8576 static jclass LDKUnsignedGossipMessage_ChannelUpdate_class = NULL;
8577 static jmethodID LDKUnsignedGossipMessage_ChannelUpdate_meth = NULL;
8578 static jclass LDKUnsignedGossipMessage_NodeAnnouncement_class = NULL;
8579 static jmethodID LDKUnsignedGossipMessage_NodeAnnouncement_meth = NULL;
8580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUnsignedGossipMessage_init (JNIEnv *env, jclass clz) {
8581         LDKUnsignedGossipMessage_ChannelAnnouncement_class =
8582                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelAnnouncement"));
8583         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_class != NULL);
8584         LDKUnsignedGossipMessage_ChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, "<init>", "(J)V");
8585         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_meth != NULL);
8586         LDKUnsignedGossipMessage_ChannelUpdate_class =
8587                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelUpdate"));
8588         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_class != NULL);
8589         LDKUnsignedGossipMessage_ChannelUpdate_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelUpdate_class, "<init>", "(J)V");
8590         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_meth != NULL);
8591         LDKUnsignedGossipMessage_NodeAnnouncement_class =
8592                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$NodeAnnouncement"));
8593         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_class != NULL);
8594         LDKUnsignedGossipMessage_NodeAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, "<init>", "(J)V");
8595         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_meth != NULL);
8596 }
8597 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUnsignedGossipMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8598         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
8599         switch(obj->tag) {
8600                 case LDKUnsignedGossipMessage_ChannelAnnouncement: {
8601                         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
8602                         int64_t channel_announcement_ref = 0;
8603                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
8604                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
8605                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, LDKUnsignedGossipMessage_ChannelAnnouncement_meth, channel_announcement_ref);
8606                 }
8607                 case LDKUnsignedGossipMessage_ChannelUpdate: {
8608                         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
8609                         int64_t channel_update_ref = 0;
8610                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
8611                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
8612                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelUpdate_class, LDKUnsignedGossipMessage_ChannelUpdate_meth, channel_update_ref);
8613                 }
8614                 case LDKUnsignedGossipMessage_NodeAnnouncement: {
8615                         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
8616                         int64_t node_announcement_ref = 0;
8617                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
8618                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
8619                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, LDKUnsignedGossipMessage_NodeAnnouncement_meth, node_announcement_ref);
8620                 }
8621                 default: abort();
8622         }
8623 }
8624 typedef struct LDKNodeSigner_JCalls {
8625         atomic_size_t refcnt;
8626         JavaVM *vm;
8627         jweak o;
8628         jmethodID get_inbound_payment_key_material_meth;
8629         jmethodID get_node_id_meth;
8630         jmethodID ecdh_meth;
8631         jmethodID sign_invoice_meth;
8632         jmethodID sign_bolt12_invoice_request_meth;
8633         jmethodID sign_bolt12_invoice_meth;
8634         jmethodID sign_gossip_message_meth;
8635 } LDKNodeSigner_JCalls;
8636 static void LDKNodeSigner_JCalls_free(void* this_arg) {
8637         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8638         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8639                 JNIEnv *env;
8640                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8641                 if (get_jenv_res == JNI_EDETACHED) {
8642                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8643                 } else {
8644                         DO_ASSERT(get_jenv_res == JNI_OK);
8645                 }
8646                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8647                 if (get_jenv_res == JNI_EDETACHED) {
8648                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8649                 }
8650                 FREE(j_calls);
8651         }
8652 }
8653 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
8654         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8655         JNIEnv *env;
8656         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8657         if (get_jenv_res == JNI_EDETACHED) {
8658                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8659         } else {
8660                 DO_ASSERT(get_jenv_res == JNI_OK);
8661         }
8662         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8663         CHECK(obj != NULL);
8664         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
8665         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8666                 (*env)->ExceptionDescribe(env);
8667                 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKNodeSigner from rust threw an exception.");
8668         }
8669         LDKThirtyTwoBytes ret_ref;
8670         CHECK((*env)->GetArrayLength(env, ret) == 32);
8671         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
8672         if (get_jenv_res == JNI_EDETACHED) {
8673                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8674         }
8675         return ret_ref;
8676 }
8677 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
8678         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8679         JNIEnv *env;
8680         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8681         if (get_jenv_res == JNI_EDETACHED) {
8682                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8683         } else {
8684                 DO_ASSERT(get_jenv_res == JNI_OK);
8685         }
8686         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
8687         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8688         CHECK(obj != NULL);
8689         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_id_meth, recipient_conv);
8690         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8691                 (*env)->ExceptionDescribe(env);
8692                 (*env)->FatalError(env, "A call to get_node_id in LDKNodeSigner from rust threw an exception.");
8693         }
8694         void* ret_ptr = untag_ptr(ret);
8695         CHECK_ACCESS(ret_ptr);
8696         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
8697         FREE(untag_ptr(ret));
8698         if (get_jenv_res == JNI_EDETACHED) {
8699                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8700         }
8701         return ret_conv;
8702 }
8703 LDKCResult_ThirtyTwoBytesNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_BigEndianScalarZ tweak) {
8704         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8705         JNIEnv *env;
8706         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8707         if (get_jenv_res == JNI_EDETACHED) {
8708                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8709         } else {
8710                 DO_ASSERT(get_jenv_res == JNI_OK);
8711         }
8712         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
8713         int8_tArray other_key_arr = (*env)->NewByteArray(env, 33);
8714         (*env)->SetByteArrayRegion(env, other_key_arr, 0, 33, other_key.compressed_form);
8715         LDKCOption_BigEndianScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
8716         *tweak_copy = tweak;
8717         int64_t tweak_ref = tag_ptr(tweak_copy, true);
8718         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8719         CHECK(obj != NULL);
8720         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->ecdh_meth, recipient_conv, other_key_arr, tweak_ref);
8721         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8722                 (*env)->ExceptionDescribe(env);
8723                 (*env)->FatalError(env, "A call to ecdh in LDKNodeSigner from rust threw an exception.");
8724         }
8725         void* ret_ptr = untag_ptr(ret);
8726         CHECK_ACCESS(ret_ptr);
8727         LDKCResult_ThirtyTwoBytesNoneZ ret_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(ret_ptr);
8728         FREE(untag_ptr(ret));
8729         if (get_jenv_res == JNI_EDETACHED) {
8730                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8731         }
8732         return ret_conv;
8733 }
8734 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
8735         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8736         JNIEnv *env;
8737         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8738         if (get_jenv_res == JNI_EDETACHED) {
8739                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8740         } else {
8741                 DO_ASSERT(get_jenv_res == JNI_OK);
8742         }
8743         LDKu8slice hrp_bytes_var = hrp_bytes;
8744         int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
8745         (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
8746         LDKCVec_U5Z invoice_data_var = invoice_data;
8747         jobjectArray invoice_data_arr = NULL;
8748         invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
8749         int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
8750         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
8751                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
8752                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
8753         }
8754         (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
8755         FREE(invoice_data_var.data);
8756         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
8757         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8758         CHECK(obj != NULL);
8759         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, recipient_conv);
8760         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8761                 (*env)->ExceptionDescribe(env);
8762                 (*env)->FatalError(env, "A call to sign_invoice in LDKNodeSigner from rust threw an exception.");
8763         }
8764         void* ret_ptr = untag_ptr(ret);
8765         CHECK_ACCESS(ret_ptr);
8766         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
8767         FREE(untag_ptr(ret));
8768         if (get_jenv_res == JNI_EDETACHED) {
8769                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8770         }
8771         return ret_conv;
8772 }
8773 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * invoice_request) {
8774         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8775         JNIEnv *env;
8776         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8777         if (get_jenv_res == JNI_EDETACHED) {
8778                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8779         } else {
8780                 DO_ASSERT(get_jenv_res == JNI_OK);
8781         }
8782         LDKUnsignedInvoiceRequest invoice_request_var = *invoice_request;
8783         int64_t invoice_request_ref = 0;
8784         // WARNING: we may need a move here but no clone is available for LDKUnsignedInvoiceRequest
8785         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
8786         invoice_request_ref = tag_ptr(invoice_request_var.inner, invoice_request_var.is_owned);
8787         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8788         CHECK(obj != NULL);
8789         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_bolt12_invoice_request_meth, invoice_request_ref);
8790         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8791                 (*env)->ExceptionDescribe(env);
8792                 (*env)->FatalError(env, "A call to sign_bolt12_invoice_request in LDKNodeSigner from rust threw an exception.");
8793         }
8794         void* ret_ptr = untag_ptr(ret);
8795         CHECK_ACCESS(ret_ptr);
8796         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
8797         FREE(untag_ptr(ret));
8798         if (get_jenv_res == JNI_EDETACHED) {
8799                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8800         }
8801         return ret_conv;
8802 }
8803 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * invoice) {
8804         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8805         JNIEnv *env;
8806         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8807         if (get_jenv_res == JNI_EDETACHED) {
8808                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8809         } else {
8810                 DO_ASSERT(get_jenv_res == JNI_OK);
8811         }
8812         LDKUnsignedBolt12Invoice invoice_var = *invoice;
8813         int64_t invoice_ref = 0;
8814         // WARNING: we may need a move here but no clone is available for LDKUnsignedBolt12Invoice
8815         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
8816         invoice_ref = tag_ptr(invoice_var.inner, invoice_var.is_owned);
8817         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8818         CHECK(obj != NULL);
8819         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_bolt12_invoice_meth, invoice_ref);
8820         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8821                 (*env)->ExceptionDescribe(env);
8822                 (*env)->FatalError(env, "A call to sign_bolt12_invoice in LDKNodeSigner from rust threw an exception.");
8823         }
8824         void* ret_ptr = untag_ptr(ret);
8825         CHECK_ACCESS(ret_ptr);
8826         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
8827         FREE(untag_ptr(ret));
8828         if (get_jenv_res == JNI_EDETACHED) {
8829                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8830         }
8831         return ret_conv;
8832 }
8833 LDKCResult_ECDSASignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
8834         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
8835         JNIEnv *env;
8836         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8837         if (get_jenv_res == JNI_EDETACHED) {
8838                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8839         } else {
8840                 DO_ASSERT(get_jenv_res == JNI_OK);
8841         }
8842         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
8843         *msg_copy = msg;
8844         int64_t msg_ref = tag_ptr(msg_copy, true);
8845         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8846         CHECK(obj != NULL);
8847         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_gossip_message_meth, msg_ref);
8848         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8849                 (*env)->ExceptionDescribe(env);
8850                 (*env)->FatalError(env, "A call to sign_gossip_message in LDKNodeSigner from rust threw an exception.");
8851         }
8852         void* ret_ptr = untag_ptr(ret);
8853         CHECK_ACCESS(ret_ptr);
8854         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
8855         FREE(untag_ptr(ret));
8856         if (get_jenv_res == JNI_EDETACHED) {
8857                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8858         }
8859         return ret_conv;
8860 }
8861 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
8862         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
8863         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8864 }
8865 static inline LDKNodeSigner LDKNodeSigner_init (JNIEnv *env, jclass clz, jobject o) {
8866         jclass c = (*env)->GetObjectClass(env, o);
8867         CHECK(c != NULL);
8868         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
8869         atomic_init(&calls->refcnt, 1);
8870         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8871         calls->o = (*env)->NewWeakGlobalRef(env, o);
8872         calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
8873         CHECK(calls->get_inbound_payment_key_material_meth != NULL);
8874         calls->get_node_id_meth = (*env)->GetMethodID(env, c, "get_node_id", "(Lorg/ldk/enums/Recipient;)J");
8875         CHECK(calls->get_node_id_meth != NULL);
8876         calls->ecdh_meth = (*env)->GetMethodID(env, c, "ecdh", "(Lorg/ldk/enums/Recipient;[BJ)J");
8877         CHECK(calls->ecdh_meth != NULL);
8878         calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
8879         CHECK(calls->sign_invoice_meth != NULL);
8880         calls->sign_bolt12_invoice_request_meth = (*env)->GetMethodID(env, c, "sign_bolt12_invoice_request", "(J)J");
8881         CHECK(calls->sign_bolt12_invoice_request_meth != NULL);
8882         calls->sign_bolt12_invoice_meth = (*env)->GetMethodID(env, c, "sign_bolt12_invoice", "(J)J");
8883         CHECK(calls->sign_bolt12_invoice_meth != NULL);
8884         calls->sign_gossip_message_meth = (*env)->GetMethodID(env, c, "sign_gossip_message", "(J)J");
8885         CHECK(calls->sign_gossip_message_meth != NULL);
8886
8887         LDKNodeSigner ret = {
8888                 .this_arg = (void*) calls,
8889                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
8890                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
8891                 .ecdh = ecdh_LDKNodeSigner_jcall,
8892                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
8893                 .sign_bolt12_invoice_request = sign_bolt12_invoice_request_LDKNodeSigner_jcall,
8894                 .sign_bolt12_invoice = sign_bolt12_invoice_LDKNodeSigner_jcall,
8895                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
8896                 .free = LDKNodeSigner_JCalls_free,
8897         };
8898         return ret;
8899 }
8900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKNodeSigner_1new(JNIEnv *env, jclass clz, jobject o) {
8901         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
8902         *res_ptr = LDKNodeSigner_init(env, clz, o);
8903         return tag_ptr(res_ptr, true);
8904 }
8905 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
8906         void* this_arg_ptr = untag_ptr(this_arg);
8907         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8908         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8909         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8910         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
8911         return ret_arr;
8912 }
8913
8914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
8915         void* this_arg_ptr = untag_ptr(this_arg);
8916         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8917         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8918         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
8919         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
8920         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
8921         return tag_ptr(ret_conv, true);
8922 }
8923
8924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1ecdh(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient, int8_tArray other_key, int64_t tweak) {
8925         void* this_arg_ptr = untag_ptr(this_arg);
8926         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8927         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8928         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
8929         LDKPublicKey other_key_ref;
8930         CHECK((*env)->GetArrayLength(env, other_key) == 33);
8931         (*env)->GetByteArrayRegion(env, other_key, 0, 33, other_key_ref.compressed_form);
8932         void* tweak_ptr = untag_ptr(tweak);
8933         CHECK_ACCESS(tweak_ptr);
8934         LDKCOption_BigEndianScalarZ tweak_conv = *(LDKCOption_BigEndianScalarZ*)(tweak_ptr);
8935         tweak_conv = COption_BigEndianScalarZ_clone((LDKCOption_BigEndianScalarZ*)untag_ptr(tweak));
8936         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
8937         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
8938         return tag_ptr(ret_conv, true);
8939 }
8940
8941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray hrp_bytes, jobjectArray invoice_data, jclass recipient) {
8942         void* this_arg_ptr = untag_ptr(this_arg);
8943         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8944         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8945         LDKu8slice hrp_bytes_ref;
8946         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
8947         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
8948         LDKCVec_U5Z invoice_data_constr;
8949         invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
8950         if (invoice_data_constr.datalen > 0)
8951                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
8952         else
8953                 invoice_data_constr.data = NULL;
8954         int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
8955         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
8956                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
8957                 
8958                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
8959         }
8960         (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
8961         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
8962         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
8963         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
8964         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
8965         return tag_ptr(ret_conv, true);
8966 }
8967
8968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1bolt12_1invoice_1request(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice_request) {
8969         void* this_arg_ptr = untag_ptr(this_arg);
8970         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8971         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8972         LDKUnsignedInvoiceRequest invoice_request_conv;
8973         invoice_request_conv.inner = untag_ptr(invoice_request);
8974         invoice_request_conv.is_owned = ptr_is_owned(invoice_request);
8975         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_conv);
8976         invoice_request_conv.is_owned = false;
8977         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
8978         *ret_conv = (this_arg_conv->sign_bolt12_invoice_request)(this_arg_conv->this_arg, &invoice_request_conv);
8979         return tag_ptr(ret_conv, true);
8980 }
8981
8982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1bolt12_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
8983         void* this_arg_ptr = untag_ptr(this_arg);
8984         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8985         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
8986         LDKUnsignedBolt12Invoice invoice_conv;
8987         invoice_conv.inner = untag_ptr(invoice);
8988         invoice_conv.is_owned = ptr_is_owned(invoice);
8989         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
8990         invoice_conv.is_owned = false;
8991         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
8992         *ret_conv = (this_arg_conv->sign_bolt12_invoice)(this_arg_conv->this_arg, &invoice_conv);
8993         return tag_ptr(ret_conv, true);
8994 }
8995
8996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1gossip_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8997         void* this_arg_ptr = untag_ptr(this_arg);
8998         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8999         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
9000         void* msg_ptr = untag_ptr(msg);
9001         CHECK_ACCESS(msg_ptr);
9002         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
9003         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
9004         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
9005         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
9006         return tag_ptr(ret_conv, true);
9007 }
9008
9009 typedef struct LDKSignerProvider_JCalls {
9010         atomic_size_t refcnt;
9011         JavaVM *vm;
9012         jweak o;
9013         jmethodID generate_channel_keys_id_meth;
9014         jmethodID derive_channel_signer_meth;
9015         jmethodID read_chan_signer_meth;
9016         jmethodID get_destination_script_meth;
9017         jmethodID get_shutdown_scriptpubkey_meth;
9018 } LDKSignerProvider_JCalls;
9019 static void LDKSignerProvider_JCalls_free(void* this_arg) {
9020         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9021         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9022                 JNIEnv *env;
9023                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9024                 if (get_jenv_res == JNI_EDETACHED) {
9025                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9026                 } else {
9027                         DO_ASSERT(get_jenv_res == JNI_OK);
9028                 }
9029                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9030                 if (get_jenv_res == JNI_EDETACHED) {
9031                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9032                 }
9033                 FREE(j_calls);
9034         }
9035 }
9036 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
9037         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9038         JNIEnv *env;
9039         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9040         if (get_jenv_res == JNI_EDETACHED) {
9041                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9042         } else {
9043                 DO_ASSERT(get_jenv_res == JNI_OK);
9044         }
9045         jboolean inbound_conv = inbound;
9046         int64_t channel_value_satoshis_conv = channel_value_satoshis;
9047         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
9048         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, user_channel_id.le_bytes);
9049         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9050         CHECK(obj != NULL);
9051         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->generate_channel_keys_id_meth, inbound_conv, channel_value_satoshis_conv, user_channel_id_arr);
9052         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9053                 (*env)->ExceptionDescribe(env);
9054                 (*env)->FatalError(env, "A call to generate_channel_keys_id in LDKSignerProvider from rust threw an exception.");
9055         }
9056         LDKThirtyTwoBytes ret_ref;
9057         CHECK((*env)->GetArrayLength(env, ret) == 32);
9058         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
9059         if (get_jenv_res == JNI_EDETACHED) {
9060                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9061         }
9062         return ret_ref;
9063 }
9064 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
9065         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9066         JNIEnv *env;
9067         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9068         if (get_jenv_res == JNI_EDETACHED) {
9069                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9070         } else {
9071                 DO_ASSERT(get_jenv_res == JNI_OK);
9072         }
9073         int64_t channel_value_satoshis_conv = channel_value_satoshis;
9074         int8_tArray channel_keys_id_arr = (*env)->NewByteArray(env, 32);
9075         (*env)->SetByteArrayRegion(env, channel_keys_id_arr, 0, 32, channel_keys_id.data);
9076         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9077         CHECK(obj != NULL);
9078         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->derive_channel_signer_meth, channel_value_satoshis_conv, channel_keys_id_arr);
9079         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9080                 (*env)->ExceptionDescribe(env);
9081                 (*env)->FatalError(env, "A call to derive_channel_signer in LDKSignerProvider from rust threw an exception.");
9082         }
9083         void* ret_ptr = untag_ptr(ret);
9084         CHECK_ACCESS(ret_ptr);
9085         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
9086         FREE(untag_ptr(ret));
9087         if (get_jenv_res == JNI_EDETACHED) {
9088                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9089         }
9090         return ret_conv;
9091 }
9092 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
9093         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9094         JNIEnv *env;
9095         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9096         if (get_jenv_res == JNI_EDETACHED) {
9097                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9098         } else {
9099                 DO_ASSERT(get_jenv_res == JNI_OK);
9100         }
9101         LDKu8slice reader_var = reader;
9102         int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
9103         (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
9104         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9105         CHECK(obj != NULL);
9106         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
9107         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9108                 (*env)->ExceptionDescribe(env);
9109                 (*env)->FatalError(env, "A call to read_chan_signer in LDKSignerProvider from rust threw an exception.");
9110         }
9111         void* ret_ptr = untag_ptr(ret);
9112         CHECK_ACCESS(ret_ptr);
9113         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
9114         FREE(untag_ptr(ret));
9115         if (get_jenv_res == JNI_EDETACHED) {
9116                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9117         }
9118         return ret_conv;
9119 }
9120 LDKCResult_CVec_u8ZNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg, LDKThirtyTwoBytes channel_keys_id) {
9121         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9122         JNIEnv *env;
9123         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9124         if (get_jenv_res == JNI_EDETACHED) {
9125                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9126         } else {
9127                 DO_ASSERT(get_jenv_res == JNI_OK);
9128         }
9129         int8_tArray channel_keys_id_arr = (*env)->NewByteArray(env, 32);
9130         (*env)->SetByteArrayRegion(env, channel_keys_id_arr, 0, 32, channel_keys_id.data);
9131         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9132         CHECK(obj != NULL);
9133         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_destination_script_meth, channel_keys_id_arr);
9134         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9135                 (*env)->ExceptionDescribe(env);
9136                 (*env)->FatalError(env, "A call to get_destination_script in LDKSignerProvider from rust threw an exception.");
9137         }
9138         void* ret_ptr = untag_ptr(ret);
9139         CHECK_ACCESS(ret_ptr);
9140         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
9141         FREE(untag_ptr(ret));
9142         if (get_jenv_res == JNI_EDETACHED) {
9143                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9144         }
9145         return ret_conv;
9146 }
9147 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
9148         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9149         JNIEnv *env;
9150         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9151         if (get_jenv_res == JNI_EDETACHED) {
9152                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9153         } else {
9154                 DO_ASSERT(get_jenv_res == JNI_OK);
9155         }
9156         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9157         CHECK(obj != NULL);
9158         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
9159         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9160                 (*env)->ExceptionDescribe(env);
9161                 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKSignerProvider from rust threw an exception.");
9162         }
9163         void* ret_ptr = untag_ptr(ret);
9164         CHECK_ACCESS(ret_ptr);
9165         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
9166         FREE(untag_ptr(ret));
9167         if (get_jenv_res == JNI_EDETACHED) {
9168                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9169         }
9170         return ret_conv;
9171 }
9172 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
9173         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
9174         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9175 }
9176 static inline LDKSignerProvider LDKSignerProvider_init (JNIEnv *env, jclass clz, jobject o) {
9177         jclass c = (*env)->GetObjectClass(env, o);
9178         CHECK(c != NULL);
9179         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
9180         atomic_init(&calls->refcnt, 1);
9181         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9182         calls->o = (*env)->NewWeakGlobalRef(env, o);
9183         calls->generate_channel_keys_id_meth = (*env)->GetMethodID(env, c, "generate_channel_keys_id", "(ZJ[B)[B");
9184         CHECK(calls->generate_channel_keys_id_meth != NULL);
9185         calls->derive_channel_signer_meth = (*env)->GetMethodID(env, c, "derive_channel_signer", "(J[B)J");
9186         CHECK(calls->derive_channel_signer_meth != NULL);
9187         calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
9188         CHECK(calls->read_chan_signer_meth != NULL);
9189         calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "([B)J");
9190         CHECK(calls->get_destination_script_meth != NULL);
9191         calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
9192         CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
9193
9194         LDKSignerProvider ret = {
9195                 .this_arg = (void*) calls,
9196                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
9197                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
9198                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
9199                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
9200                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
9201                 .free = LDKSignerProvider_JCalls_free,
9202         };
9203         return ret;
9204 }
9205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSignerProvider_1new(JNIEnv *env, jclass clz, jobject o) {
9206         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
9207         *res_ptr = LDKSignerProvider_init(env, clz, o);
9208         return tag_ptr(res_ptr, true);
9209 }
9210 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignerProvider_1generate_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis, int8_tArray user_channel_id) {
9211         void* this_arg_ptr = untag_ptr(this_arg);
9212         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9213         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
9214         LDKU128 user_channel_id_ref;
9215         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
9216         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
9217         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9218         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->generate_channel_keys_id)(this_arg_conv->this_arg, inbound, channel_value_satoshis, user_channel_id_ref).data);
9219         return ret_arr;
9220 }
9221
9222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1derive_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int8_tArray channel_keys_id) {
9223         void* this_arg_ptr = untag_ptr(this_arg);
9224         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9225         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
9226         LDKThirtyTwoBytes channel_keys_id_ref;
9227         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
9228         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
9229         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
9230         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
9231         return tag_ptr(ret_ret, true);
9232 }
9233
9234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
9235         void* this_arg_ptr = untag_ptr(this_arg);
9236         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9237         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
9238         LDKu8slice reader_ref;
9239         reader_ref.datalen = (*env)->GetArrayLength(env, reader);
9240         reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
9241         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
9242         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
9243         (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
9244         return tag_ptr(ret_conv, true);
9245 }
9246
9247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_keys_id) {
9248         void* this_arg_ptr = untag_ptr(this_arg);
9249         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9250         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
9251         LDKThirtyTwoBytes channel_keys_id_ref;
9252         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
9253         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
9254         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
9255         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg, channel_keys_id_ref);
9256         return tag_ptr(ret_conv, true);
9257 }
9258
9259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
9260         void* this_arg_ptr = untag_ptr(this_arg);
9261         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9262         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
9263         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
9264         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
9265         return tag_ptr(ret_conv, true);
9266 }
9267
9268 typedef struct LDKFeeEstimator_JCalls {
9269         atomic_size_t refcnt;
9270         JavaVM *vm;
9271         jweak o;
9272         jmethodID get_est_sat_per_1000_weight_meth;
9273 } LDKFeeEstimator_JCalls;
9274 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
9275         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
9276         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9277                 JNIEnv *env;
9278                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9279                 if (get_jenv_res == JNI_EDETACHED) {
9280                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9281                 } else {
9282                         DO_ASSERT(get_jenv_res == JNI_OK);
9283                 }
9284                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9285                 if (get_jenv_res == JNI_EDETACHED) {
9286                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9287                 }
9288                 FREE(j_calls);
9289         }
9290 }
9291 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
9292         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
9293         JNIEnv *env;
9294         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9295         if (get_jenv_res == JNI_EDETACHED) {
9296                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9297         } else {
9298                 DO_ASSERT(get_jenv_res == JNI_OK);
9299         }
9300         jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
9301         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9302         CHECK(obj != NULL);
9303         int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
9304         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9305                 (*env)->ExceptionDescribe(env);
9306                 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
9307         }
9308         if (get_jenv_res == JNI_EDETACHED) {
9309                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9310         }
9311         return ret;
9312 }
9313 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
9314         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
9315         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9316 }
9317 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
9318         jclass c = (*env)->GetObjectClass(env, o);
9319         CHECK(c != NULL);
9320         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
9321         atomic_init(&calls->refcnt, 1);
9322         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9323         calls->o = (*env)->NewWeakGlobalRef(env, o);
9324         calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
9325         CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
9326
9327         LDKFeeEstimator ret = {
9328                 .this_arg = (void*) calls,
9329                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
9330                 .free = LDKFeeEstimator_JCalls_free,
9331         };
9332         return ret;
9333 }
9334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
9335         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
9336         *res_ptr = LDKFeeEstimator_init(env, clz, o);
9337         return tag_ptr(res_ptr, true);
9338 }
9339 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1get_1est_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_arg, jclass confirmation_target) {
9340         void* this_arg_ptr = untag_ptr(this_arg);
9341         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9342         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
9343         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
9344         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
9345         return ret_conv;
9346 }
9347
9348 typedef struct LDKMessageRouter_JCalls {
9349         atomic_size_t refcnt;
9350         JavaVM *vm;
9351         jweak o;
9352         jmethodID find_path_meth;
9353         jmethodID create_blinded_paths_meth;
9354 } LDKMessageRouter_JCalls;
9355 static void LDKMessageRouter_JCalls_free(void* this_arg) {
9356         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
9357         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9358                 JNIEnv *env;
9359                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9360                 if (get_jenv_res == JNI_EDETACHED) {
9361                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9362                 } else {
9363                         DO_ASSERT(get_jenv_res == JNI_OK);
9364                 }
9365                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9366                 if (get_jenv_res == JNI_EDETACHED) {
9367                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9368                 }
9369                 FREE(j_calls);
9370         }
9371 }
9372 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
9373         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
9374         JNIEnv *env;
9375         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9376         if (get_jenv_res == JNI_EDETACHED) {
9377                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9378         } else {
9379                 DO_ASSERT(get_jenv_res == JNI_OK);
9380         }
9381         int8_tArray sender_arr = (*env)->NewByteArray(env, 33);
9382         (*env)->SetByteArrayRegion(env, sender_arr, 0, 33, sender.compressed_form);
9383         LDKCVec_PublicKeyZ peers_var = peers;
9384         jobjectArray peers_arr = NULL;
9385         peers_arr = (*env)->NewObjectArray(env, peers_var.datalen, arr_of_B_clz, NULL);
9386         ;
9387         for (size_t i = 0; i < peers_var.datalen; i++) {
9388                 int8_tArray peers_conv_8_arr = (*env)->NewByteArray(env, 33);
9389                 (*env)->SetByteArrayRegion(env, peers_conv_8_arr, 0, 33, peers_var.data[i].compressed_form);
9390                 (*env)->SetObjectArrayElement(env, peers_arr, i, peers_conv_8_arr);
9391         }
9392         
9393         FREE(peers_var.data);
9394         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
9395         *destination_copy = destination;
9396         int64_t destination_ref = tag_ptr(destination_copy, true);
9397         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9398         CHECK(obj != NULL);
9399         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_path_meth, sender_arr, peers_arr, destination_ref);
9400         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9401                 (*env)->ExceptionDescribe(env);
9402                 (*env)->FatalError(env, "A call to find_path in LDKMessageRouter from rust threw an exception.");
9403         }
9404         void* ret_ptr = untag_ptr(ret);
9405         CHECK_ACCESS(ret_ptr);
9406         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
9407         FREE(untag_ptr(ret));
9408         if (get_jenv_res == JNI_EDETACHED) {
9409                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9410         }
9411         return ret_conv;
9412 }
9413 LDKCResult_CVec_BlindedPathZNoneZ create_blinded_paths_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey recipient, LDKCVec_PublicKeyZ peers) {
9414         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
9415         JNIEnv *env;
9416         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9417         if (get_jenv_res == JNI_EDETACHED) {
9418                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9419         } else {
9420                 DO_ASSERT(get_jenv_res == JNI_OK);
9421         }
9422         int8_tArray recipient_arr = (*env)->NewByteArray(env, 33);
9423         (*env)->SetByteArrayRegion(env, recipient_arr, 0, 33, recipient.compressed_form);
9424         LDKCVec_PublicKeyZ peers_var = peers;
9425         jobjectArray peers_arr = NULL;
9426         peers_arr = (*env)->NewObjectArray(env, peers_var.datalen, arr_of_B_clz, NULL);
9427         ;
9428         for (size_t i = 0; i < peers_var.datalen; i++) {
9429                 int8_tArray peers_conv_8_arr = (*env)->NewByteArray(env, 33);
9430                 (*env)->SetByteArrayRegion(env, peers_conv_8_arr, 0, 33, peers_var.data[i].compressed_form);
9431                 (*env)->SetObjectArrayElement(env, peers_arr, i, peers_conv_8_arr);
9432         }
9433         
9434         FREE(peers_var.data);
9435         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9436         CHECK(obj != NULL);
9437         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->create_blinded_paths_meth, recipient_arr, peers_arr);
9438         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9439                 (*env)->ExceptionDescribe(env);
9440                 (*env)->FatalError(env, "A call to create_blinded_paths in LDKMessageRouter from rust threw an exception.");
9441         }
9442         void* ret_ptr = untag_ptr(ret);
9443         CHECK_ACCESS(ret_ptr);
9444         LDKCResult_CVec_BlindedPathZNoneZ ret_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(ret_ptr);
9445         FREE(untag_ptr(ret));
9446         if (get_jenv_res == JNI_EDETACHED) {
9447                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9448         }
9449         return ret_conv;
9450 }
9451 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
9452         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
9453         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9454 }
9455 static inline LDKMessageRouter LDKMessageRouter_init (JNIEnv *env, jclass clz, jobject o) {
9456         jclass c = (*env)->GetObjectClass(env, o);
9457         CHECK(c != NULL);
9458         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
9459         atomic_init(&calls->refcnt, 1);
9460         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9461         calls->o = (*env)->NewWeakGlobalRef(env, o);
9462         calls->find_path_meth = (*env)->GetMethodID(env, c, "find_path", "([B[[BJ)J");
9463         CHECK(calls->find_path_meth != NULL);
9464         calls->create_blinded_paths_meth = (*env)->GetMethodID(env, c, "create_blinded_paths", "([B[[B)J");
9465         CHECK(calls->create_blinded_paths_meth != NULL);
9466
9467         LDKMessageRouter ret = {
9468                 .this_arg = (void*) calls,
9469                 .find_path = find_path_LDKMessageRouter_jcall,
9470                 .create_blinded_paths = create_blinded_paths_LDKMessageRouter_jcall,
9471                 .free = LDKMessageRouter_JCalls_free,
9472         };
9473         return ret;
9474 }
9475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageRouter_1new(JNIEnv *env, jclass clz, jobject o) {
9476         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
9477         *res_ptr = LDKMessageRouter_init(env, clz, o);
9478         return tag_ptr(res_ptr, true);
9479 }
9480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageRouter_1find_1path(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray sender, jobjectArray peers, int64_t destination) {
9481         void* this_arg_ptr = untag_ptr(this_arg);
9482         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9483         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
9484         LDKPublicKey sender_ref;
9485         CHECK((*env)->GetArrayLength(env, sender) == 33);
9486         (*env)->GetByteArrayRegion(env, sender, 0, 33, sender_ref.compressed_form);
9487         LDKCVec_PublicKeyZ peers_constr;
9488         peers_constr.datalen = (*env)->GetArrayLength(env, peers);
9489         if (peers_constr.datalen > 0)
9490                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
9491         else
9492                 peers_constr.data = NULL;
9493         for (size_t i = 0; i < peers_constr.datalen; i++) {
9494                 int8_tArray peers_conv_8 = (*env)->GetObjectArrayElement(env, peers, i);
9495                 LDKPublicKey peers_conv_8_ref;
9496                 CHECK((*env)->GetArrayLength(env, peers_conv_8) == 33);
9497                 (*env)->GetByteArrayRegion(env, peers_conv_8, 0, 33, peers_conv_8_ref.compressed_form);
9498                 peers_constr.data[i] = peers_conv_8_ref;
9499         }
9500         void* destination_ptr = untag_ptr(destination);
9501         CHECK_ACCESS(destination_ptr);
9502         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
9503         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
9504         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
9505         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
9506         return tag_ptr(ret_conv, true);
9507 }
9508
9509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageRouter_1create_1blinded_1paths(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray recipient, jobjectArray peers) {
9510         void* this_arg_ptr = untag_ptr(this_arg);
9511         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9512         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
9513         LDKPublicKey recipient_ref;
9514         CHECK((*env)->GetArrayLength(env, recipient) == 33);
9515         (*env)->GetByteArrayRegion(env, recipient, 0, 33, recipient_ref.compressed_form);
9516         LDKCVec_PublicKeyZ peers_constr;
9517         peers_constr.datalen = (*env)->GetArrayLength(env, peers);
9518         if (peers_constr.datalen > 0)
9519                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
9520         else
9521                 peers_constr.data = NULL;
9522         for (size_t i = 0; i < peers_constr.datalen; i++) {
9523                 int8_tArray peers_conv_8 = (*env)->GetObjectArrayElement(env, peers, i);
9524                 LDKPublicKey peers_conv_8_ref;
9525                 CHECK((*env)->GetArrayLength(env, peers_conv_8) == 33);
9526                 (*env)->GetByteArrayRegion(env, peers_conv_8, 0, 33, peers_conv_8_ref.compressed_form);
9527                 peers_constr.data[i] = peers_conv_8_ref;
9528         }
9529         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
9530         *ret_conv = (this_arg_conv->create_blinded_paths)(this_arg_conv->this_arg, recipient_ref, peers_constr);
9531         return tag_ptr(ret_conv, true);
9532 }
9533
9534 typedef struct LDKRouter_JCalls {
9535         atomic_size_t refcnt;
9536         JavaVM *vm;
9537         jweak o;
9538         LDKMessageRouter_JCalls* MessageRouter;
9539         jmethodID find_route_meth;
9540         jmethodID find_route_with_id_meth;
9541         jmethodID create_blinded_payment_paths_meth;
9542 } LDKRouter_JCalls;
9543 static void LDKRouter_JCalls_free(void* this_arg) {
9544         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
9545         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9546                 JNIEnv *env;
9547                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9548                 if (get_jenv_res == JNI_EDETACHED) {
9549                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9550                 } else {
9551                         DO_ASSERT(get_jenv_res == JNI_OK);
9552                 }
9553                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9554                 if (get_jenv_res == JNI_EDETACHED) {
9555                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9556                 }
9557                 FREE(j_calls);
9558         }
9559 }
9560 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
9561         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
9562         JNIEnv *env;
9563         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9564         if (get_jenv_res == JNI_EDETACHED) {
9565                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9566         } else {
9567                 DO_ASSERT(get_jenv_res == JNI_OK);
9568         }
9569         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
9570         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
9571         LDKRouteParameters route_params_var = *route_params;
9572         int64_t route_params_ref = 0;
9573         route_params_var = RouteParameters_clone(&route_params_var);
9574         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
9575         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
9576         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
9577         int64_tArray first_hops_arr = NULL;
9578         if (first_hops != NULL) {
9579                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
9580                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
9581                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
9582                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
9583                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
9584                         int64_t first_hops_conv_16_ref = 0;
9585                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
9586                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
9587                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
9588                 }
9589                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
9590         }
9591         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
9592         int64_t inflight_htlcs_ref = 0;
9593         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
9594         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
9595         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9596         CHECK(obj != NULL);
9597         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, route_params_ref, first_hops_arr, inflight_htlcs_ref);
9598         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9599                 (*env)->ExceptionDescribe(env);
9600                 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
9601         }
9602         void* ret_ptr = untag_ptr(ret);
9603         CHECK_ACCESS(ret_ptr);
9604         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
9605         FREE(untag_ptr(ret));
9606         if (get_jenv_res == JNI_EDETACHED) {
9607                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9608         }
9609         return ret_conv;
9610 }
9611 LDKCResult_RouteLightningErrorZ find_route_with_id_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs, LDKThirtyTwoBytes _payment_hash, LDKThirtyTwoBytes _payment_id) {
9612         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
9613         JNIEnv *env;
9614         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9615         if (get_jenv_res == JNI_EDETACHED) {
9616                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9617         } else {
9618                 DO_ASSERT(get_jenv_res == JNI_OK);
9619         }
9620         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
9621         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
9622         LDKRouteParameters route_params_var = *route_params;
9623         int64_t route_params_ref = 0;
9624         route_params_var = RouteParameters_clone(&route_params_var);
9625         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
9626         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
9627         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
9628         int64_tArray first_hops_arr = NULL;
9629         if (first_hops != NULL) {
9630                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
9631                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
9632                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
9633                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
9634                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
9635                         int64_t first_hops_conv_16_ref = 0;
9636                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
9637                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
9638                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
9639                 }
9640                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
9641         }
9642         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
9643         int64_t inflight_htlcs_ref = 0;
9644         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
9645         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
9646         int8_tArray _payment_hash_arr = (*env)->NewByteArray(env, 32);
9647         (*env)->SetByteArrayRegion(env, _payment_hash_arr, 0, 32, _payment_hash.data);
9648         int8_tArray _payment_id_arr = (*env)->NewByteArray(env, 32);
9649         (*env)->SetByteArrayRegion(env, _payment_id_arr, 0, 32, _payment_id.data);
9650         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9651         CHECK(obj != NULL);
9652         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_with_id_meth, payer_arr, route_params_ref, first_hops_arr, inflight_htlcs_ref, _payment_hash_arr, _payment_id_arr);
9653         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9654                 (*env)->ExceptionDescribe(env);
9655                 (*env)->FatalError(env, "A call to find_route_with_id in LDKRouter from rust threw an exception.");
9656         }
9657         void* ret_ptr = untag_ptr(ret);
9658         CHECK_ACCESS(ret_ptr);
9659         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
9660         FREE(untag_ptr(ret));
9661         if (get_jenv_res == JNI_EDETACHED) {
9662                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9663         }
9664         return ret_conv;
9665 }
9666 LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ create_blinded_payment_paths_LDKRouter_jcall(const void* this_arg, LDKPublicKey recipient, LDKCVec_ChannelDetailsZ first_hops, LDKReceiveTlvs tlvs, uint64_t amount_msats) {
9667         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
9668         JNIEnv *env;
9669         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9670         if (get_jenv_res == JNI_EDETACHED) {
9671                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9672         } else {
9673                 DO_ASSERT(get_jenv_res == JNI_OK);
9674         }
9675         int8_tArray recipient_arr = (*env)->NewByteArray(env, 33);
9676         (*env)->SetByteArrayRegion(env, recipient_arr, 0, 33, recipient.compressed_form);
9677         LDKCVec_ChannelDetailsZ first_hops_var = first_hops;
9678         int64_tArray first_hops_arr = NULL;
9679         first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
9680         int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
9681         for (size_t q = 0; q < first_hops_var.datalen; q++) {
9682                 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
9683                 int64_t first_hops_conv_16_ref = 0;
9684                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
9685                 first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
9686                 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
9687         }
9688         (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
9689         FREE(first_hops_var.data);
9690         LDKReceiveTlvs tlvs_var = tlvs;
9691         int64_t tlvs_ref = 0;
9692         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_var);
9693         tlvs_ref = tag_ptr(tlvs_var.inner, tlvs_var.is_owned);
9694         int64_t amount_msats_conv = amount_msats;
9695         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9696         CHECK(obj != NULL);
9697         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->create_blinded_payment_paths_meth, recipient_arr, first_hops_arr, tlvs_ref, amount_msats_conv);
9698         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9699                 (*env)->ExceptionDescribe(env);
9700                 (*env)->FatalError(env, "A call to create_blinded_payment_paths in LDKRouter from rust threw an exception.");
9701         }
9702         void* ret_ptr = untag_ptr(ret);
9703         CHECK_ACCESS(ret_ptr);
9704         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ ret_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(ret_ptr);
9705         FREE(untag_ptr(ret));
9706         if (get_jenv_res == JNI_EDETACHED) {
9707                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9708         }
9709         return ret_conv;
9710 }
9711 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
9712         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
9713         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9714         atomic_fetch_add_explicit(&j_calls->MessageRouter->refcnt, 1, memory_order_release);
9715 }
9716 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o, jobject MessageRouter) {
9717         jclass c = (*env)->GetObjectClass(env, o);
9718         CHECK(c != NULL);
9719         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
9720         atomic_init(&calls->refcnt, 1);
9721         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9722         calls->o = (*env)->NewWeakGlobalRef(env, o);
9723         calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[JJ)J");
9724         CHECK(calls->find_route_meth != NULL);
9725         calls->find_route_with_id_meth = (*env)->GetMethodID(env, c, "find_route_with_id", "([BJ[JJ[B[B)J");
9726         CHECK(calls->find_route_with_id_meth != NULL);
9727         calls->create_blinded_payment_paths_meth = (*env)->GetMethodID(env, c, "create_blinded_payment_paths", "([B[JJJ)J");
9728         CHECK(calls->create_blinded_payment_paths_meth != NULL);
9729
9730         LDKRouter ret = {
9731                 .this_arg = (void*) calls,
9732                 .find_route = find_route_LDKRouter_jcall,
9733                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
9734                 .create_blinded_payment_paths = create_blinded_payment_paths_LDKRouter_jcall,
9735                 .free = LDKRouter_JCalls_free,
9736                 .MessageRouter = LDKMessageRouter_init(env, clz, MessageRouter),
9737         };
9738         calls->MessageRouter = ret.MessageRouter.this_arg;
9739         return ret;
9740 }
9741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageRouter) {
9742         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
9743         *res_ptr = LDKRouter_init(env, clz, o, MessageRouter);
9744         return tag_ptr(res_ptr, true);
9745 }
9746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1get_1MessageRouter(JNIEnv *env, jclass clz, int64_t arg) {
9747         LDKRouter *inp = (LDKRouter *)untag_ptr(arg);
9748         return tag_ptr(&inp->MessageRouter, false);
9749 }
9750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer, int64_t route_params, int64_tArray first_hops, int64_t inflight_htlcs) {
9751         void* this_arg_ptr = untag_ptr(this_arg);
9752         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9753         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
9754         LDKPublicKey payer_ref;
9755         CHECK((*env)->GetArrayLength(env, payer) == 33);
9756         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
9757         LDKRouteParameters route_params_conv;
9758         route_params_conv.inner = untag_ptr(route_params);
9759         route_params_conv.is_owned = ptr_is_owned(route_params);
9760         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
9761         route_params_conv.is_owned = false;
9762         LDKCVec_ChannelDetailsZ first_hops_constr;
9763         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
9764         if (first_hops != NULL) {
9765                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
9766                 if (first_hops_constr.datalen > 0)
9767                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9768                 else
9769                         first_hops_constr.data = NULL;
9770                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
9771                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
9772                         int64_t first_hops_conv_16 = first_hops_vals[q];
9773                         LDKChannelDetails first_hops_conv_16_conv;
9774                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
9775                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
9776                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
9777                         first_hops_conv_16_conv.is_owned = false;
9778                         first_hops_constr.data[q] = first_hops_conv_16_conv;
9779                 }
9780                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
9781                 first_hops_ptr = &first_hops_constr;
9782         }
9783         LDKInFlightHtlcs inflight_htlcs_conv;
9784         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
9785         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
9786         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
9787         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
9788         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9789         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
9790         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
9791         return tag_ptr(ret_conv, true);
9792 }
9793
9794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route_1with_1id(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer, int64_t route_params, int64_tArray first_hops, int64_t inflight_htlcs, int8_tArray _payment_hash, int8_tArray _payment_id) {
9795         void* this_arg_ptr = untag_ptr(this_arg);
9796         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9797         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
9798         LDKPublicKey payer_ref;
9799         CHECK((*env)->GetArrayLength(env, payer) == 33);
9800         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
9801         LDKRouteParameters route_params_conv;
9802         route_params_conv.inner = untag_ptr(route_params);
9803         route_params_conv.is_owned = ptr_is_owned(route_params);
9804         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
9805         route_params_conv.is_owned = false;
9806         LDKCVec_ChannelDetailsZ first_hops_constr;
9807         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
9808         if (first_hops != NULL) {
9809                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
9810                 if (first_hops_constr.datalen > 0)
9811                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9812                 else
9813                         first_hops_constr.data = NULL;
9814                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
9815                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
9816                         int64_t first_hops_conv_16 = first_hops_vals[q];
9817                         LDKChannelDetails first_hops_conv_16_conv;
9818                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
9819                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
9820                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
9821                         first_hops_conv_16_conv.is_owned = false;
9822                         first_hops_constr.data[q] = first_hops_conv_16_conv;
9823                 }
9824                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
9825                 first_hops_ptr = &first_hops_constr;
9826         }
9827         LDKInFlightHtlcs inflight_htlcs_conv;
9828         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
9829         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
9830         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
9831         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
9832         LDKThirtyTwoBytes _payment_hash_ref;
9833         CHECK((*env)->GetArrayLength(env, _payment_hash) == 32);
9834         (*env)->GetByteArrayRegion(env, _payment_hash, 0, 32, _payment_hash_ref.data);
9835         LDKThirtyTwoBytes _payment_id_ref;
9836         CHECK((*env)->GetArrayLength(env, _payment_id) == 32);
9837         (*env)->GetByteArrayRegion(env, _payment_id, 0, 32, _payment_id_ref.data);
9838         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9839         *ret_conv = (this_arg_conv->find_route_with_id)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv, _payment_hash_ref, _payment_id_ref);
9840         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
9841         return tag_ptr(ret_conv, true);
9842 }
9843
9844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1create_1blinded_1payment_1paths(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray recipient, int64_tArray first_hops, int64_t tlvs, int64_t amount_msats) {
9845         void* this_arg_ptr = untag_ptr(this_arg);
9846         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9847         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
9848         LDKPublicKey recipient_ref;
9849         CHECK((*env)->GetArrayLength(env, recipient) == 33);
9850         (*env)->GetByteArrayRegion(env, recipient, 0, 33, recipient_ref.compressed_form);
9851         LDKCVec_ChannelDetailsZ first_hops_constr;
9852         first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
9853         if (first_hops_constr.datalen > 0)
9854                 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9855         else
9856                 first_hops_constr.data = NULL;
9857         int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
9858         for (size_t q = 0; q < first_hops_constr.datalen; q++) {
9859                 int64_t first_hops_conv_16 = first_hops_vals[q];
9860                 LDKChannelDetails first_hops_conv_16_conv;
9861                 first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
9862                 first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
9863                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
9864                 first_hops_conv_16_conv = ChannelDetails_clone(&first_hops_conv_16_conv);
9865                 first_hops_constr.data[q] = first_hops_conv_16_conv;
9866         }
9867         (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
9868         LDKReceiveTlvs tlvs_conv;
9869         tlvs_conv.inner = untag_ptr(tlvs);
9870         tlvs_conv.is_owned = ptr_is_owned(tlvs);
9871         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_conv);
9872         tlvs_conv = ReceiveTlvs_clone(&tlvs_conv);
9873         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
9874         *ret_conv = (this_arg_conv->create_blinded_payment_paths)(this_arg_conv->this_arg, recipient_ref, first_hops_constr, tlvs_conv, amount_msats);
9875         return tag_ptr(ret_conv, true);
9876 }
9877
9878 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
9879         return ThirtyTwoBytes_clone(&owner->a);
9880 }
9881 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9882         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
9883         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9884         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(owner_conv).data);
9885         return ret_arr;
9886 }
9887
9888 static inline struct LDKChannelManager C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
9889         LDKChannelManager ret = owner->b;
9890         ret.is_owned = false;
9891         return ret;
9892 }
9893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9894         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
9895         LDKChannelManager ret_var = C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(owner_conv);
9896         int64_t ret_ref = 0;
9897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9899         return ret_ref;
9900 }
9901
9902 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
9903 CHECK(owner->result_ok);
9904         return &*owner->contents.result;
9905 }
9906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9907         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
9908         int64_t ret_ret = tag_ptr(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
9909         return ret_ret;
9910 }
9911
9912 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
9913 CHECK(!owner->result_ok);
9914         return DecodeError_clone(&*owner->contents.err);
9915 }
9916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9917         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
9918         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9919         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(owner_conv);
9920         int64_t ret_ref = tag_ptr(ret_copy, true);
9921         return ret_ref;
9922 }
9923
9924 static jclass LDKMaxDustHTLCExposure_FixedLimitMsat_class = NULL;
9925 static jmethodID LDKMaxDustHTLCExposure_FixedLimitMsat_meth = NULL;
9926 static jclass LDKMaxDustHTLCExposure_FeeRateMultiplier_class = NULL;
9927 static jmethodID LDKMaxDustHTLCExposure_FeeRateMultiplier_meth = NULL;
9928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMaxDustHTLCExposure_init (JNIEnv *env, jclass clz) {
9929         LDKMaxDustHTLCExposure_FixedLimitMsat_class =
9930                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMaxDustHTLCExposure$FixedLimitMsat"));
9931         CHECK(LDKMaxDustHTLCExposure_FixedLimitMsat_class != NULL);
9932         LDKMaxDustHTLCExposure_FixedLimitMsat_meth = (*env)->GetMethodID(env, LDKMaxDustHTLCExposure_FixedLimitMsat_class, "<init>", "(J)V");
9933         CHECK(LDKMaxDustHTLCExposure_FixedLimitMsat_meth != NULL);
9934         LDKMaxDustHTLCExposure_FeeRateMultiplier_class =
9935                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMaxDustHTLCExposure$FeeRateMultiplier"));
9936         CHECK(LDKMaxDustHTLCExposure_FeeRateMultiplier_class != NULL);
9937         LDKMaxDustHTLCExposure_FeeRateMultiplier_meth = (*env)->GetMethodID(env, LDKMaxDustHTLCExposure_FeeRateMultiplier_class, "<init>", "(J)V");
9938         CHECK(LDKMaxDustHTLCExposure_FeeRateMultiplier_meth != NULL);
9939 }
9940 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMaxDustHTLCExposure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9941         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
9942         switch(obj->tag) {
9943                 case LDKMaxDustHTLCExposure_FixedLimitMsat: {
9944                         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
9945                         return (*env)->NewObject(env, LDKMaxDustHTLCExposure_FixedLimitMsat_class, LDKMaxDustHTLCExposure_FixedLimitMsat_meth, fixed_limit_msat_conv);
9946                 }
9947                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: {
9948                         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
9949                         return (*env)->NewObject(env, LDKMaxDustHTLCExposure_FeeRateMultiplier_class, LDKMaxDustHTLCExposure_FeeRateMultiplier_meth, fee_rate_multiplier_conv);
9950                 }
9951                 default: abort();
9952         }
9953 }
9954 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
9955 CHECK(owner->result_ok);
9956         return MaxDustHTLCExposure_clone(&*owner->contents.result);
9957 }
9958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9959         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
9960         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
9961         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
9962         int64_t ret_ref = tag_ptr(ret_copy, true);
9963         return ret_ref;
9964 }
9965
9966 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
9967 CHECK(!owner->result_ok);
9968         return DecodeError_clone(&*owner->contents.err);
9969 }
9970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9971         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
9972         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9973         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
9974         int64_t ret_ref = tag_ptr(ret_copy, true);
9975         return ret_ref;
9976 }
9977
9978 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
9979         LDKChannelConfig ret = *owner->contents.result;
9980         ret.is_owned = false;
9981         return ret;
9982 }
9983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9984         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
9985         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
9986         int64_t ret_ref = 0;
9987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9989         return ret_ref;
9990 }
9991
9992 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
9993 CHECK(!owner->result_ok);
9994         return DecodeError_clone(&*owner->contents.err);
9995 }
9996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9997         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
9998         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9999         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
10000         int64_t ret_ref = tag_ptr(ret_copy, true);
10001         return ret_ref;
10002 }
10003
10004 static jclass LDKCOption_MaxDustHTLCExposureZ_Some_class = NULL;
10005 static jmethodID LDKCOption_MaxDustHTLCExposureZ_Some_meth = NULL;
10006 static jclass LDKCOption_MaxDustHTLCExposureZ_None_class = NULL;
10007 static jmethodID LDKCOption_MaxDustHTLCExposureZ_None_meth = NULL;
10008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MaxDustHTLCExposureZ_init (JNIEnv *env, jclass clz) {
10009         LDKCOption_MaxDustHTLCExposureZ_Some_class =
10010                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MaxDustHTLCExposureZ$Some"));
10011         CHECK(LDKCOption_MaxDustHTLCExposureZ_Some_class != NULL);
10012         LDKCOption_MaxDustHTLCExposureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MaxDustHTLCExposureZ_Some_class, "<init>", "(J)V");
10013         CHECK(LDKCOption_MaxDustHTLCExposureZ_Some_meth != NULL);
10014         LDKCOption_MaxDustHTLCExposureZ_None_class =
10015                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MaxDustHTLCExposureZ$None"));
10016         CHECK(LDKCOption_MaxDustHTLCExposureZ_None_class != NULL);
10017         LDKCOption_MaxDustHTLCExposureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MaxDustHTLCExposureZ_None_class, "<init>", "()V");
10018         CHECK(LDKCOption_MaxDustHTLCExposureZ_None_meth != NULL);
10019 }
10020 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MaxDustHTLCExposureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10021         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
10022         switch(obj->tag) {
10023                 case LDKCOption_MaxDustHTLCExposureZ_Some: {
10024                         int64_t some_ref = tag_ptr(&obj->some, false);
10025                         return (*env)->NewObject(env, LDKCOption_MaxDustHTLCExposureZ_Some_class, LDKCOption_MaxDustHTLCExposureZ_Some_meth, some_ref);
10026                 }
10027                 case LDKCOption_MaxDustHTLCExposureZ_None: {
10028                         return (*env)->NewObject(env, LDKCOption_MaxDustHTLCExposureZ_None_class, LDKCOption_MaxDustHTLCExposureZ_None_meth);
10029                 }
10030                 default: abort();
10031         }
10032 }
10033 static jclass LDKCOption_APIErrorZ_Some_class = NULL;
10034 static jmethodID LDKCOption_APIErrorZ_Some_meth = NULL;
10035 static jclass LDKCOption_APIErrorZ_None_class = NULL;
10036 static jmethodID LDKCOption_APIErrorZ_None_meth = NULL;
10037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1APIErrorZ_init (JNIEnv *env, jclass clz) {
10038         LDKCOption_APIErrorZ_Some_class =
10039                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$Some"));
10040         CHECK(LDKCOption_APIErrorZ_Some_class != NULL);
10041         LDKCOption_APIErrorZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_Some_class, "<init>", "(J)V");
10042         CHECK(LDKCOption_APIErrorZ_Some_meth != NULL);
10043         LDKCOption_APIErrorZ_None_class =
10044                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$None"));
10045         CHECK(LDKCOption_APIErrorZ_None_class != NULL);
10046         LDKCOption_APIErrorZ_None_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_None_class, "<init>", "()V");
10047         CHECK(LDKCOption_APIErrorZ_None_meth != NULL);
10048 }
10049 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1APIErrorZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10050         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
10051         switch(obj->tag) {
10052                 case LDKCOption_APIErrorZ_Some: {
10053                         int64_t some_ref = tag_ptr(&obj->some, false);
10054                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_Some_class, LDKCOption_APIErrorZ_Some_meth, some_ref);
10055                 }
10056                 case LDKCOption_APIErrorZ_None: {
10057                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_None_class, LDKCOption_APIErrorZ_None_meth);
10058                 }
10059                 default: abort();
10060         }
10061 }
10062 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
10063 CHECK(owner->result_ok);
10064         return COption_APIErrorZ_clone(&*owner->contents.result);
10065 }
10066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10067         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
10068         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
10069         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
10070         int64_t ret_ref = tag_ptr(ret_copy, true);
10071         return ret_ref;
10072 }
10073
10074 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
10075 CHECK(!owner->result_ok);
10076         return DecodeError_clone(&*owner->contents.err);
10077 }
10078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10079         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
10080         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10081         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
10082         int64_t ret_ref = tag_ptr(ret_copy, true);
10083         return ret_ref;
10084 }
10085
10086 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
10087         LDKChannelMonitorUpdate ret = *owner->contents.result;
10088         ret.is_owned = false;
10089         return ret;
10090 }
10091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10092         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
10093         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
10094         int64_t ret_ref = 0;
10095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10097         return ret_ref;
10098 }
10099
10100 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
10101 CHECK(!owner->result_ok);
10102         return DecodeError_clone(&*owner->contents.err);
10103 }
10104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10105         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
10106         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10107         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
10108         int64_t ret_ref = tag_ptr(ret_copy, true);
10109         return ret_ref;
10110 }
10111
10112 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
10113 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
10114 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
10115 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
10116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
10117         LDKCOption_MonitorEventZ_Some_class =
10118                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
10119         CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
10120         LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
10121         CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
10122         LDKCOption_MonitorEventZ_None_class =
10123                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
10124         CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
10125         LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
10126         CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
10127 }
10128 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10129         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
10130         switch(obj->tag) {
10131                 case LDKCOption_MonitorEventZ_Some: {
10132                         int64_t some_ref = tag_ptr(&obj->some, false);
10133                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
10134                 }
10135                 case LDKCOption_MonitorEventZ_None: {
10136                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
10137                 }
10138                 default: abort();
10139         }
10140 }
10141 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
10142 CHECK(owner->result_ok);
10143         return COption_MonitorEventZ_clone(&*owner->contents.result);
10144 }
10145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10146         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
10147         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
10148         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
10149         int64_t ret_ref = tag_ptr(ret_copy, true);
10150         return ret_ref;
10151 }
10152
10153 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
10154 CHECK(!owner->result_ok);
10155         return DecodeError_clone(&*owner->contents.err);
10156 }
10157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10158         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
10159         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10160         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
10161         int64_t ret_ref = tag_ptr(ret_copy, true);
10162         return ret_ref;
10163 }
10164
10165 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
10166         LDKHTLCUpdate ret = *owner->contents.result;
10167         ret.is_owned = false;
10168         return ret;
10169 }
10170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10171         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
10172         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
10173         int64_t ret_ref = 0;
10174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10176         return ret_ref;
10177 }
10178
10179 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
10180 CHECK(!owner->result_ok);
10181         return DecodeError_clone(&*owner->contents.err);
10182 }
10183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10184         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
10185         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10186         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
10187         int64_t ret_ref = tag_ptr(ret_copy, true);
10188         return ret_ref;
10189 }
10190
10191 static inline struct LDKOutPoint C2Tuple_OutPointCVec_u8ZZ_get_a(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
10192         LDKOutPoint ret = owner->a;
10193         ret.is_owned = false;
10194         return ret;
10195 }
10196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10197         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
10198         LDKOutPoint ret_var = C2Tuple_OutPointCVec_u8ZZ_get_a(owner_conv);
10199         int64_t ret_ref = 0;
10200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10202         return ret_ref;
10203 }
10204
10205 static inline struct LDKCVec_u8Z C2Tuple_OutPointCVec_u8ZZ_get_b(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
10206         return CVec_u8Z_clone(&owner->b);
10207 }
10208 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10209         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
10210         LDKCVec_u8Z ret_var = C2Tuple_OutPointCVec_u8ZZ_get_b(owner_conv);
10211         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10212         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10213         CVec_u8Z_free(ret_var);
10214         return ret_arr;
10215 }
10216
10217 static inline uint32_t C2Tuple_u32CVec_u8ZZ_get_a(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
10218         return owner->a;
10219 }
10220 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10221         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
10222         int32_t ret_conv = C2Tuple_u32CVec_u8ZZ_get_a(owner_conv);
10223         return ret_conv;
10224 }
10225
10226 static inline struct LDKCVec_u8Z C2Tuple_u32CVec_u8ZZ_get_b(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
10227         return CVec_u8Z_clone(&owner->b);
10228 }
10229 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10230         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
10231         LDKCVec_u8Z ret_var = C2Tuple_u32CVec_u8ZZ_get_b(owner_conv);
10232         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10233         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10234         CVec_u8Z_free(ret_var);
10235         return ret_arr;
10236 }
10237
10238 static inline LDKCVec_C2Tuple_u32CVec_u8ZZZ CVec_C2Tuple_u32CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u32CVec_u8ZZZ *orig) {
10239         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u32CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
10240         for (size_t i = 0; i < ret.datalen; i++) {
10241                 ret.data[i] = C2Tuple_u32CVec_u8ZZ_clone(&orig->data[i]);
10242         }
10243         return ret;
10244 }
10245 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
10246         return ThirtyTwoBytes_clone(&owner->a);
10247 }
10248 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10249         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
10250         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10251         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(owner_conv).data);
10252         return ret_arr;
10253 }
10254
10255 static inline struct LDKCVec_C2Tuple_u32CVec_u8ZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
10256         return CVec_C2Tuple_u32CVec_u8ZZZ_clone(&owner->b);
10257 }
10258 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10259         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
10260         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(owner_conv);
10261         int64_tArray ret_arr = NULL;
10262         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10263         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10264         for (size_t x = 0; x < ret_var.datalen; x++) {
10265                 LDKC2Tuple_u32CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
10266                 *ret_conv_23_conv = ret_var.data[x];
10267                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
10268         }
10269         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10270         FREE(ret_var.data);
10271         return ret_arr;
10272 }
10273
10274 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ *orig) {
10275         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ clone bytes"), .datalen = orig->datalen };
10276         for (size_t i = 0; i < ret.datalen; i++) {
10277                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(&orig->data[i]);
10278         }
10279         return ret;
10280 }
10281 static inline LDKCVec_CommitmentTransactionZ CVec_CommitmentTransactionZ_clone(const LDKCVec_CommitmentTransactionZ *orig) {
10282         LDKCVec_CommitmentTransactionZ ret = { .data = MALLOC(sizeof(LDKCommitmentTransaction) * orig->datalen, "LDKCVec_CommitmentTransactionZ clone bytes"), .datalen = orig->datalen };
10283         for (size_t i = 0; i < ret.datalen; i++) {
10284                 ret.data[i] = CommitmentTransaction_clone(&orig->data[i]);
10285         }
10286         return ret;
10287 }
10288 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
10289         return owner->a;
10290 }
10291 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10292         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
10293         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
10294         return ret_conv;
10295 }
10296
10297 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
10298         return TxOut_clone(&owner->b);
10299 }
10300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10301         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
10302         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10303         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
10304         return tag_ptr(ret_ref, true);
10305 }
10306
10307 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
10308         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
10309         for (size_t i = 0; i < ret.datalen; i++) {
10310                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
10311         }
10312         return ret;
10313 }
10314 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
10315         return ThirtyTwoBytes_clone(&owner->a);
10316 }
10317 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10318         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
10319         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10320         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
10321         return ret_arr;
10322 }
10323
10324 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
10325         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
10326 }
10327 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10328         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
10329         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
10330         int64_tArray ret_arr = NULL;
10331         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10332         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10333         for (size_t u = 0; u < ret_var.datalen; u++) {
10334                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
10335                 *ret_conv_20_conv = ret_var.data[u];
10336                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
10337         }
10338         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10339         FREE(ret_var.data);
10340         return ret_arr;
10341 }
10342
10343 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ *orig) {
10344         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ clone bytes"), .datalen = orig->datalen };
10345         for (size_t i = 0; i < ret.datalen; i++) {
10346                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
10347         }
10348         return ret;
10349 }
10350 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
10351 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
10352 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
10353 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
10354 static jclass LDKBalance_ContentiousClaimable_class = NULL;
10355 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
10356 static jclass LDKBalance_MaybeTimeoutClaimableHTLC_class = NULL;
10357 static jmethodID LDKBalance_MaybeTimeoutClaimableHTLC_meth = NULL;
10358 static jclass LDKBalance_MaybePreimageClaimableHTLC_class = NULL;
10359 static jmethodID LDKBalance_MaybePreimageClaimableHTLC_meth = NULL;
10360 static jclass LDKBalance_CounterpartyRevokedOutputClaimable_class = NULL;
10361 static jmethodID LDKBalance_CounterpartyRevokedOutputClaimable_meth = NULL;
10362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
10363         LDKBalance_ClaimableOnChannelClose_class =
10364                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
10365         CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
10366         LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
10367         CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
10368         LDKBalance_ClaimableAwaitingConfirmations_class =
10369                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
10370         CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
10371         LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
10372         CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
10373         LDKBalance_ContentiousClaimable_class =
10374                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
10375         CHECK(LDKBalance_ContentiousClaimable_class != NULL);
10376         LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI[B[B)V");
10377         CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
10378         LDKBalance_MaybeTimeoutClaimableHTLC_class =
10379                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeTimeoutClaimableHTLC"));
10380         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_class != NULL);
10381         LDKBalance_MaybeTimeoutClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, "<init>", "(JI[B)V");
10382         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_meth != NULL);
10383         LDKBalance_MaybePreimageClaimableHTLC_class =
10384                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybePreimageClaimableHTLC"));
10385         CHECK(LDKBalance_MaybePreimageClaimableHTLC_class != NULL);
10386         LDKBalance_MaybePreimageClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybePreimageClaimableHTLC_class, "<init>", "(JI[B)V");
10387         CHECK(LDKBalance_MaybePreimageClaimableHTLC_meth != NULL);
10388         LDKBalance_CounterpartyRevokedOutputClaimable_class =
10389                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$CounterpartyRevokedOutputClaimable"));
10390         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_class != NULL);
10391         LDKBalance_CounterpartyRevokedOutputClaimable_meth = (*env)->GetMethodID(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, "<init>", "(J)V");
10392         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_meth != NULL);
10393 }
10394 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10395         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
10396         switch(obj->tag) {
10397                 case LDKBalance_ClaimableOnChannelClose: {
10398                         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
10399                         return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, amount_satoshis_conv);
10400                 }
10401                 case LDKBalance_ClaimableAwaitingConfirmations: {
10402                         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
10403                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
10404                         return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, amount_satoshis_conv, confirmation_height_conv);
10405                 }
10406                 case LDKBalance_ContentiousClaimable: {
10407                         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
10408                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
10409                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
10410                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->contentious_claimable.payment_hash.data);
10411                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
10412                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->contentious_claimable.payment_preimage.data);
10413                         return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, amount_satoshis_conv, timeout_height_conv, payment_hash_arr, payment_preimage_arr);
10414                 }
10415                 case LDKBalance_MaybeTimeoutClaimableHTLC: {
10416                         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
10417                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
10418                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
10419                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->maybe_timeout_claimable_htlc.payment_hash.data);
10420                         return (*env)->NewObject(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, LDKBalance_MaybeTimeoutClaimableHTLC_meth, amount_satoshis_conv, claimable_height_conv, payment_hash_arr);
10421                 }
10422                 case LDKBalance_MaybePreimageClaimableHTLC: {
10423                         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
10424                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
10425                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
10426                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->maybe_preimage_claimable_htlc.payment_hash.data);
10427                         return (*env)->NewObject(env, LDKBalance_MaybePreimageClaimableHTLC_class, LDKBalance_MaybePreimageClaimableHTLC_meth, amount_satoshis_conv, expiry_height_conv, payment_hash_arr);
10428                 }
10429                 case LDKBalance_CounterpartyRevokedOutputClaimable: {
10430                         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
10431                         return (*env)->NewObject(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, LDKBalance_CounterpartyRevokedOutputClaimable_meth, amount_satoshis_conv);
10432                 }
10433                 default: abort();
10434         }
10435 }
10436 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
10437         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
10438         for (size_t i = 0; i < ret.datalen; i++) {
10439                 ret.data[i] = Balance_clone(&orig->data[i]);
10440         }
10441         return ret;
10442 }
10443 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
10444         return ThirtyTwoBytes_clone(&owner->a);
10445 }
10446 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10447         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
10448         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10449         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(owner_conv).data);
10450         return ret_arr;
10451 }
10452
10453 static inline struct LDKChannelMonitor C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
10454         LDKChannelMonitor ret = owner->b;
10455         ret.is_owned = false;
10456         return ret;
10457 }
10458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10459         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
10460         LDKChannelMonitor ret_var = C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(owner_conv);
10461         int64_t ret_ref = 0;
10462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10464         return ret_ref;
10465 }
10466
10467 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
10468 CHECK(owner->result_ok);
10469         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
10470 }
10471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10472         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
10473         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
10474         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
10475         return tag_ptr(ret_conv, true);
10476 }
10477
10478 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
10479 CHECK(!owner->result_ok);
10480         return DecodeError_clone(&*owner->contents.err);
10481 }
10482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10483         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
10484         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10485         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(owner_conv);
10486         int64_t ret_ref = tag_ptr(ret_copy, true);
10487         return ret_ref;
10488 }
10489
10490 typedef struct LDKType_JCalls {
10491         atomic_size_t refcnt;
10492         JavaVM *vm;
10493         jweak o;
10494         jmethodID type_id_meth;
10495         jmethodID debug_str_meth;
10496         jmethodID write_meth;
10497 } LDKType_JCalls;
10498 static void LDKType_JCalls_free(void* this_arg) {
10499         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
10500         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10501                 JNIEnv *env;
10502                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10503                 if (get_jenv_res == JNI_EDETACHED) {
10504                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10505                 } else {
10506                         DO_ASSERT(get_jenv_res == JNI_OK);
10507                 }
10508                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10509                 if (get_jenv_res == JNI_EDETACHED) {
10510                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10511                 }
10512                 FREE(j_calls);
10513         }
10514 }
10515 uint16_t type_id_LDKType_jcall(const void* this_arg) {
10516         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
10517         JNIEnv *env;
10518         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10519         if (get_jenv_res == JNI_EDETACHED) {
10520                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10521         } else {
10522                 DO_ASSERT(get_jenv_res == JNI_OK);
10523         }
10524         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10525         CHECK(obj != NULL);
10526         int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
10527         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10528                 (*env)->ExceptionDescribe(env);
10529                 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
10530         }
10531         if (get_jenv_res == JNI_EDETACHED) {
10532                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10533         }
10534         return ret;
10535 }
10536 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
10537         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
10538         JNIEnv *env;
10539         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10540         if (get_jenv_res == JNI_EDETACHED) {
10541                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10542         } else {
10543                 DO_ASSERT(get_jenv_res == JNI_OK);
10544         }
10545         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10546         CHECK(obj != NULL);
10547         jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
10548         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10549                 (*env)->ExceptionDescribe(env);
10550                 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
10551         }
10552         LDKStr ret_conv = java_to_owned_str(env, ret);
10553         if (get_jenv_res == JNI_EDETACHED) {
10554                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10555         }
10556         return ret_conv;
10557 }
10558 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
10559         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
10560         JNIEnv *env;
10561         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10562         if (get_jenv_res == JNI_EDETACHED) {
10563                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10564         } else {
10565                 DO_ASSERT(get_jenv_res == JNI_OK);
10566         }
10567         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10568         CHECK(obj != NULL);
10569         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
10570         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10571                 (*env)->ExceptionDescribe(env);
10572                 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
10573         }
10574         LDKCVec_u8Z ret_ref;
10575         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
10576         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
10577         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
10578         if (get_jenv_res == JNI_EDETACHED) {
10579                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10580         }
10581         return ret_ref;
10582 }
10583 static void LDKType_JCalls_cloned(LDKType* new_obj) {
10584         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
10585         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10586 }
10587 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
10588         jclass c = (*env)->GetObjectClass(env, o);
10589         CHECK(c != NULL);
10590         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
10591         atomic_init(&calls->refcnt, 1);
10592         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10593         calls->o = (*env)->NewWeakGlobalRef(env, o);
10594         calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
10595         CHECK(calls->type_id_meth != NULL);
10596         calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
10597         CHECK(calls->debug_str_meth != NULL);
10598         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
10599         CHECK(calls->write_meth != NULL);
10600
10601         LDKType ret = {
10602                 .this_arg = (void*) calls,
10603                 .type_id = type_id_LDKType_jcall,
10604                 .debug_str = debug_str_LDKType_jcall,
10605                 .write = write_LDKType_jcall,
10606                 .cloned = LDKType_JCalls_cloned,
10607                 .free = LDKType_JCalls_free,
10608         };
10609         return ret;
10610 }
10611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
10612         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
10613         *res_ptr = LDKType_init(env, clz, o);
10614         return tag_ptr(res_ptr, true);
10615 }
10616 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
10617         void* this_arg_ptr = untag_ptr(this_arg);
10618         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10619         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
10620         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
10621         return ret_conv;
10622 }
10623
10624 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
10625         void* this_arg_ptr = untag_ptr(this_arg);
10626         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10627         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
10628         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
10629         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
10630         Str_free(ret_str);
10631         return ret_conv;
10632 }
10633
10634 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
10635         void* this_arg_ptr = untag_ptr(this_arg);
10636         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10637         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
10638         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
10639         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10640         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10641         CVec_u8Z_free(ret_var);
10642         return ret_arr;
10643 }
10644
10645 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
10646         return owner->a;
10647 }
10648 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10649         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
10650         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
10651         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
10652         return ret_arr;
10653 }
10654
10655 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
10656         return Type_clone(&owner->b);
10657 }
10658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10659         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
10660         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
10661         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
10662         return tag_ptr(ret_ret, true);
10663 }
10664
10665 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
10666         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
10667         for (size_t i = 0; i < ret.datalen; i++) {
10668                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
10669         }
10670         return ret;
10671 }
10672 static inline struct LDKPublicKey C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
10673         return owner->a;
10674 }
10675 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10676         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
10677         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
10678         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(owner_conv).compressed_form);
10679         return ret_arr;
10680 }
10681
10682 static inline struct LDKCVec_SocketAddressZ C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
10683         return CVec_SocketAddressZ_clone(&owner->b);
10684 }
10685 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10686         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
10687         LDKCVec_SocketAddressZ ret_var = C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(owner_conv);
10688         int64_tArray ret_arr = NULL;
10689         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10690         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10691         for (size_t p = 0; p < ret_var.datalen; p++) {
10692                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
10693                 *ret_conv_15_copy = ret_var.data[p];
10694                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
10695                 ret_arr_ptr[p] = ret_conv_15_ref;
10696         }
10697         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10698         FREE(ret_var.data);
10699         return ret_arr;
10700 }
10701
10702 static inline LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ *orig) {
10703         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
10704         for (size_t i = 0; i < ret.datalen; i++) {
10705                 ret.data[i] = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(&orig->data[i]);
10706         }
10707         return ret;
10708 }
10709 typedef struct LDKOnionMessageContents_JCalls {
10710         atomic_size_t refcnt;
10711         JavaVM *vm;
10712         jweak o;
10713         jmethodID tlv_type_meth;
10714         jmethodID write_meth;
10715         jmethodID debug_str_meth;
10716 } LDKOnionMessageContents_JCalls;
10717 static void LDKOnionMessageContents_JCalls_free(void* this_arg) {
10718         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
10719         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10720                 JNIEnv *env;
10721                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10722                 if (get_jenv_res == JNI_EDETACHED) {
10723                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10724                 } else {
10725                         DO_ASSERT(get_jenv_res == JNI_OK);
10726                 }
10727                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10728                 if (get_jenv_res == JNI_EDETACHED) {
10729                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10730                 }
10731                 FREE(j_calls);
10732         }
10733 }
10734 uint64_t tlv_type_LDKOnionMessageContents_jcall(const void* this_arg) {
10735         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
10736         JNIEnv *env;
10737         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10738         if (get_jenv_res == JNI_EDETACHED) {
10739                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10740         } else {
10741                 DO_ASSERT(get_jenv_res == JNI_OK);
10742         }
10743         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10744         CHECK(obj != NULL);
10745         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->tlv_type_meth);
10746         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10747                 (*env)->ExceptionDescribe(env);
10748                 (*env)->FatalError(env, "A call to tlv_type in LDKOnionMessageContents from rust threw an exception.");
10749         }
10750         if (get_jenv_res == JNI_EDETACHED) {
10751                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10752         }
10753         return ret;
10754 }
10755 LDKCVec_u8Z write_LDKOnionMessageContents_jcall(const void* this_arg) {
10756         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
10757         JNIEnv *env;
10758         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10759         if (get_jenv_res == JNI_EDETACHED) {
10760                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10761         } else {
10762                 DO_ASSERT(get_jenv_res == JNI_OK);
10763         }
10764         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10765         CHECK(obj != NULL);
10766         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
10767         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10768                 (*env)->ExceptionDescribe(env);
10769                 (*env)->FatalError(env, "A call to write in LDKOnionMessageContents from rust threw an exception.");
10770         }
10771         LDKCVec_u8Z ret_ref;
10772         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
10773         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
10774         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
10775         if (get_jenv_res == JNI_EDETACHED) {
10776                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10777         }
10778         return ret_ref;
10779 }
10780 LDKStr debug_str_LDKOnionMessageContents_jcall(const void* this_arg) {
10781         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
10782         JNIEnv *env;
10783         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10784         if (get_jenv_res == JNI_EDETACHED) {
10785                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10786         } else {
10787                 DO_ASSERT(get_jenv_res == JNI_OK);
10788         }
10789         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10790         CHECK(obj != NULL);
10791         jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
10792         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10793                 (*env)->ExceptionDescribe(env);
10794                 (*env)->FatalError(env, "A call to debug_str in LDKOnionMessageContents from rust threw an exception.");
10795         }
10796         LDKStr ret_conv = java_to_owned_str(env, ret);
10797         if (get_jenv_res == JNI_EDETACHED) {
10798                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10799         }
10800         return ret_conv;
10801 }
10802 static void LDKOnionMessageContents_JCalls_cloned(LDKOnionMessageContents* new_obj) {
10803         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) new_obj->this_arg;
10804         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10805 }
10806 static inline LDKOnionMessageContents LDKOnionMessageContents_init (JNIEnv *env, jclass clz, jobject o) {
10807         jclass c = (*env)->GetObjectClass(env, o);
10808         CHECK(c != NULL);
10809         LDKOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKOnionMessageContents_JCalls), "LDKOnionMessageContents_JCalls");
10810         atomic_init(&calls->refcnt, 1);
10811         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10812         calls->o = (*env)->NewWeakGlobalRef(env, o);
10813         calls->tlv_type_meth = (*env)->GetMethodID(env, c, "tlv_type", "()J");
10814         CHECK(calls->tlv_type_meth != NULL);
10815         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
10816         CHECK(calls->write_meth != NULL);
10817         calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
10818         CHECK(calls->debug_str_meth != NULL);
10819
10820         LDKOnionMessageContents ret = {
10821                 .this_arg = (void*) calls,
10822                 .tlv_type = tlv_type_LDKOnionMessageContents_jcall,
10823                 .write = write_LDKOnionMessageContents_jcall,
10824                 .debug_str = debug_str_LDKOnionMessageContents_jcall,
10825                 .cloned = LDKOnionMessageContents_JCalls_cloned,
10826                 .free = LDKOnionMessageContents_JCalls_free,
10827         };
10828         return ret;
10829 }
10830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageContents_1new(JNIEnv *env, jclass clz, jobject o) {
10831         LDKOnionMessageContents *res_ptr = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
10832         *res_ptr = LDKOnionMessageContents_init(env, clz, o);
10833         return tag_ptr(res_ptr, true);
10834 }
10835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1tlv_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
10836         void* this_arg_ptr = untag_ptr(this_arg);
10837         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10838         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
10839         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
10840         return ret_conv;
10841 }
10842
10843 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
10844         void* this_arg_ptr = untag_ptr(this_arg);
10845         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10846         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
10847         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
10848         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10849         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10850         CVec_u8Z_free(ret_var);
10851         return ret_arr;
10852 }
10853
10854 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
10855         void* this_arg_ptr = untag_ptr(this_arg);
10856         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10857         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
10858         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
10859         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
10860         Str_free(ret_str);
10861         return ret_conv;
10862 }
10863
10864 static jclass LDKCOption_OnionMessageContentsZ_Some_class = NULL;
10865 static jmethodID LDKCOption_OnionMessageContentsZ_Some_meth = NULL;
10866 static jclass LDKCOption_OnionMessageContentsZ_None_class = NULL;
10867 static jmethodID LDKCOption_OnionMessageContentsZ_None_meth = NULL;
10868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1OnionMessageContentsZ_init (JNIEnv *env, jclass clz) {
10869         LDKCOption_OnionMessageContentsZ_Some_class =
10870                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OnionMessageContentsZ$Some"));
10871         CHECK(LDKCOption_OnionMessageContentsZ_Some_class != NULL);
10872         LDKCOption_OnionMessageContentsZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_OnionMessageContentsZ_Some_class, "<init>", "(J)V");
10873         CHECK(LDKCOption_OnionMessageContentsZ_Some_meth != NULL);
10874         LDKCOption_OnionMessageContentsZ_None_class =
10875                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OnionMessageContentsZ$None"));
10876         CHECK(LDKCOption_OnionMessageContentsZ_None_class != NULL);
10877         LDKCOption_OnionMessageContentsZ_None_meth = (*env)->GetMethodID(env, LDKCOption_OnionMessageContentsZ_None_class, "<init>", "()V");
10878         CHECK(LDKCOption_OnionMessageContentsZ_None_meth != NULL);
10879 }
10880 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OnionMessageContentsZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10881         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
10882         switch(obj->tag) {
10883                 case LDKCOption_OnionMessageContentsZ_Some: {
10884                         LDKOnionMessageContents* some_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
10885                         *some_ret = OnionMessageContents_clone(&obj->some);
10886                         return (*env)->NewObject(env, LDKCOption_OnionMessageContentsZ_Some_class, LDKCOption_OnionMessageContentsZ_Some_meth, tag_ptr(some_ret, true));
10887                 }
10888                 case LDKCOption_OnionMessageContentsZ_None: {
10889                         return (*env)->NewObject(env, LDKCOption_OnionMessageContentsZ_None_class, LDKCOption_OnionMessageContentsZ_None_meth);
10890                 }
10891                 default: abort();
10892         }
10893 }
10894 static inline struct LDKCOption_OnionMessageContentsZ CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
10895 CHECK(owner->result_ok);
10896         return COption_OnionMessageContentsZ_clone(&*owner->contents.result);
10897 }
10898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10899         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
10900         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
10901         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
10902         int64_t ret_ref = tag_ptr(ret_copy, true);
10903         return ret_ref;
10904 }
10905
10906 static inline struct LDKDecodeError CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
10907 CHECK(!owner->result_ok);
10908         return DecodeError_clone(&*owner->contents.err);
10909 }
10910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10911         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
10912         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10913         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
10914         int64_t ret_ref = tag_ptr(ret_copy, true);
10915         return ret_ref;
10916 }
10917
10918 static inline struct LDKOnionMessageContents C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
10919         return OnionMessageContents_clone(&owner->a);
10920 }
10921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10922         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
10923         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
10924         *ret_ret = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(owner_conv);
10925         return tag_ptr(ret_ret, true);
10926 }
10927
10928 static inline struct LDKDestination C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
10929         return Destination_clone(&owner->b);
10930 }
10931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10932         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
10933         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
10934         *ret_copy = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(owner_conv);
10935         int64_t ret_ref = tag_ptr(ret_copy, true);
10936         return ret_ref;
10937 }
10938
10939 static inline struct LDKBlindedPath C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
10940         LDKBlindedPath ret = owner->c;
10941         ret.is_owned = false;
10942         return ret;
10943 }
10944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
10945         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
10946         LDKBlindedPath ret_var = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(owner_conv);
10947         int64_t ret_ref = 0;
10948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10950         return ret_ref;
10951 }
10952
10953 static inline LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ *orig) {
10954         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
10955         for (size_t i = 0; i < ret.datalen; i++) {
10956                 ret.data[i] = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(&orig->data[i]);
10957         }
10958         return ret;
10959 }
10960 static jclass LDKCOption_TypeZ_Some_class = NULL;
10961 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
10962 static jclass LDKCOption_TypeZ_None_class = NULL;
10963 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
10964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
10965         LDKCOption_TypeZ_Some_class =
10966                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
10967         CHECK(LDKCOption_TypeZ_Some_class != NULL);
10968         LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
10969         CHECK(LDKCOption_TypeZ_Some_meth != NULL);
10970         LDKCOption_TypeZ_None_class =
10971                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
10972         CHECK(LDKCOption_TypeZ_None_class != NULL);
10973         LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
10974         CHECK(LDKCOption_TypeZ_None_meth != NULL);
10975 }
10976 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10977         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
10978         switch(obj->tag) {
10979                 case LDKCOption_TypeZ_Some: {
10980                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
10981                         *some_ret = Type_clone(&obj->some);
10982                         return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, tag_ptr(some_ret, true));
10983                 }
10984                 case LDKCOption_TypeZ_None: {
10985                         return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
10986                 }
10987                 default: abort();
10988         }
10989 }
10990 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
10991 CHECK(owner->result_ok);
10992         return COption_TypeZ_clone(&*owner->contents.result);
10993 }
10994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10995         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
10996         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
10997         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
10998         int64_t ret_ref = tag_ptr(ret_copy, true);
10999         return ret_ref;
11000 }
11001
11002 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
11003 CHECK(!owner->result_ok);
11004         return DecodeError_clone(&*owner->contents.err);
11005 }
11006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11007         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
11008         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11009         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
11010         int64_t ret_ref = tag_ptr(ret_copy, true);
11011         return ret_ref;
11012 }
11013
11014 static jclass LDKCOption_SocketAddressZ_Some_class = NULL;
11015 static jmethodID LDKCOption_SocketAddressZ_Some_meth = NULL;
11016 static jclass LDKCOption_SocketAddressZ_None_class = NULL;
11017 static jmethodID LDKCOption_SocketAddressZ_None_meth = NULL;
11018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1SocketAddressZ_init (JNIEnv *env, jclass clz) {
11019         LDKCOption_SocketAddressZ_Some_class =
11020                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SocketAddressZ$Some"));
11021         CHECK(LDKCOption_SocketAddressZ_Some_class != NULL);
11022         LDKCOption_SocketAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_SocketAddressZ_Some_class, "<init>", "(J)V");
11023         CHECK(LDKCOption_SocketAddressZ_Some_meth != NULL);
11024         LDKCOption_SocketAddressZ_None_class =
11025                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SocketAddressZ$None"));
11026         CHECK(LDKCOption_SocketAddressZ_None_class != NULL);
11027         LDKCOption_SocketAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_SocketAddressZ_None_class, "<init>", "()V");
11028         CHECK(LDKCOption_SocketAddressZ_None_meth != NULL);
11029 }
11030 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1SocketAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11031         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
11032         switch(obj->tag) {
11033                 case LDKCOption_SocketAddressZ_Some: {
11034                         int64_t some_ref = tag_ptr(&obj->some, false);
11035                         return (*env)->NewObject(env, LDKCOption_SocketAddressZ_Some_class, LDKCOption_SocketAddressZ_Some_meth, some_ref);
11036                 }
11037                 case LDKCOption_SocketAddressZ_None: {
11038                         return (*env)->NewObject(env, LDKCOption_SocketAddressZ_None_class, LDKCOption_SocketAddressZ_None_meth);
11039                 }
11040                 default: abort();
11041         }
11042 }
11043 static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
11044         return owner->a;
11045 }
11046 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11047         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
11048         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
11049         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyCOption_SocketAddressZZ_get_a(owner_conv).compressed_form);
11050         return ret_arr;
11051 }
11052
11053 static inline struct LDKCOption_SocketAddressZ C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR owner){
11054         return COption_SocketAddressZ_clone(&owner->b);
11055 }
11056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11057         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(owner);
11058         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
11059         *ret_copy = C2Tuple_PublicKeyCOption_SocketAddressZZ_get_b(owner_conv);
11060         int64_t ret_ref = tag_ptr(ret_copy, true);
11061         return ret_ref;
11062 }
11063
11064 static inline LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ *orig) {
11065         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
11066         for (size_t i = 0; i < ret.datalen; i++) {
11067                 ret.data[i] = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(&orig->data[i]);
11068         }
11069         return ret;
11070 }
11071 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
11072 CHECK(owner->result_ok);
11073         return CVec_u8Z_clone(&*owner->contents.result);
11074 }
11075 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11076         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
11077         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
11078         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11079         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11080         CVec_u8Z_free(ret_var);
11081         return ret_arr;
11082 }
11083
11084 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
11085         LDKPeerHandleError ret = *owner->contents.err;
11086         ret.is_owned = false;
11087         return ret;
11088 }
11089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11090         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
11091         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
11092         int64_t ret_ref = 0;
11093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11095         return ret_ref;
11096 }
11097
11098 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
11099 CHECK(owner->result_ok);
11100         return *owner->contents.result;
11101 }
11102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11103         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
11104         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
11105 }
11106
11107 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
11108         LDKPeerHandleError ret = *owner->contents.err;
11109         ret.is_owned = false;
11110         return ret;
11111 }
11112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11113         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
11114         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
11115         int64_t ret_ref = 0;
11116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11118         return ret_ref;
11119 }
11120
11121 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
11122 CHECK(owner->result_ok);
11123         return *owner->contents.result;
11124 }
11125 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11126         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
11127         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
11128         return ret_conv;
11129 }
11130
11131 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
11132         LDKPeerHandleError ret = *owner->contents.err;
11133         ret.is_owned = false;
11134         return ret;
11135 }
11136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11137         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
11138         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
11139         int64_t ret_ref = 0;
11140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11142         return ret_ref;
11143 }
11144
11145 static jclass LDKGraphSyncError_DecodeError_class = NULL;
11146 static jmethodID LDKGraphSyncError_DecodeError_meth = NULL;
11147 static jclass LDKGraphSyncError_LightningError_class = NULL;
11148 static jmethodID LDKGraphSyncError_LightningError_meth = NULL;
11149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGraphSyncError_init (JNIEnv *env, jclass clz) {
11150         LDKGraphSyncError_DecodeError_class =
11151                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$DecodeError"));
11152         CHECK(LDKGraphSyncError_DecodeError_class != NULL);
11153         LDKGraphSyncError_DecodeError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_DecodeError_class, "<init>", "(J)V");
11154         CHECK(LDKGraphSyncError_DecodeError_meth != NULL);
11155         LDKGraphSyncError_LightningError_class =
11156                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$LightningError"));
11157         CHECK(LDKGraphSyncError_LightningError_class != NULL);
11158         LDKGraphSyncError_LightningError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_LightningError_class, "<init>", "(J)V");
11159         CHECK(LDKGraphSyncError_LightningError_meth != NULL);
11160 }
11161 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGraphSyncError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11162         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
11163         switch(obj->tag) {
11164                 case LDKGraphSyncError_DecodeError: {
11165                         int64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
11166                         return (*env)->NewObject(env, LDKGraphSyncError_DecodeError_class, LDKGraphSyncError_DecodeError_meth, decode_error_ref);
11167                 }
11168                 case LDKGraphSyncError_LightningError: {
11169                         LDKLightningError lightning_error_var = obj->lightning_error;
11170                         int64_t lightning_error_ref = 0;
11171                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
11172                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
11173                         return (*env)->NewObject(env, LDKGraphSyncError_LightningError_class, LDKGraphSyncError_LightningError_meth, lightning_error_ref);
11174                 }
11175                 default: abort();
11176         }
11177 }
11178 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
11179 CHECK(owner->result_ok);
11180         return *owner->contents.result;
11181 }
11182 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11183         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
11184         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
11185         return ret_conv;
11186 }
11187
11188 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
11189 CHECK(!owner->result_ok);
11190         return GraphSyncError_clone(&*owner->contents.err);
11191 }
11192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11193         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
11194         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
11195         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
11196         int64_t ret_ref = tag_ptr(ret_copy, true);
11197         return ret_ref;
11198 }
11199
11200 static inline struct LDKCVec_u8Z CResult_CVec_u8ZIOErrorZ_get_ok(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
11201 CHECK(owner->result_ok);
11202         return CVec_u8Z_clone(&*owner->contents.result);
11203 }
11204 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11205         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
11206         LDKCVec_u8Z ret_var = CResult_CVec_u8ZIOErrorZ_get_ok(owner_conv);
11207         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11208         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11209         CVec_u8Z_free(ret_var);
11210         return ret_arr;
11211 }
11212
11213 static inline enum LDKIOError CResult_CVec_u8ZIOErrorZ_get_err(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
11214 CHECK(!owner->result_ok);
11215         return *owner->contents.err;
11216 }
11217 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11218         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
11219         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_u8ZIOErrorZ_get_err(owner_conv));
11220         return ret_conv;
11221 }
11222
11223 static inline struct LDKCVec_StrZ CResult_CVec_StrZIOErrorZ_get_ok(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
11224 CHECK(owner->result_ok);
11225         return *owner->contents.result;
11226 }
11227 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11228         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
11229         LDKCVec_StrZ ret_var = CResult_CVec_StrZIOErrorZ_get_ok(owner_conv);
11230         jobjectArray ret_arr = NULL;
11231         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, String_clz, NULL);
11232         ;
11233         jstring *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11234         for (size_t i = 0; i < ret_var.datalen; i++) {
11235                 LDKStr ret_conv_8_str = ret_var.data[i];
11236                 jstring ret_conv_8_conv = str_ref_to_java(env, ret_conv_8_str.chars, ret_conv_8_str.len);
11237                 ret_arr_ptr[i] = ret_conv_8_conv;
11238         }
11239         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11240         return ret_arr;
11241 }
11242
11243 static inline enum LDKIOError CResult_CVec_StrZIOErrorZ_get_err(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
11244 CHECK(!owner->result_ok);
11245         return *owner->contents.err;
11246 }
11247 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11248         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
11249         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_StrZIOErrorZ_get_err(owner_conv));
11250         return ret_conv;
11251 }
11252
11253 static inline LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *orig) {
11254         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
11255         for (size_t i = 0; i < ret.datalen; i++) {
11256                 ret.data[i] = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&orig->data[i]);
11257         }
11258         return ret;
11259 }
11260 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
11261 CHECK(owner->result_ok);
11262         return CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(&*owner->contents.result);
11263 }
11264 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11265         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
11266         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(owner_conv);
11267         int64_tArray ret_arr = NULL;
11268         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11269         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11270         for (size_t o = 0; o < ret_var.datalen; o++) {
11271                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
11272                 *ret_conv_40_conv = ret_var.data[o];
11273                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
11274         }
11275         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11276         FREE(ret_var.data);
11277         return ret_arr;
11278 }
11279
11280 static inline enum LDKIOError CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
11281 CHECK(!owner->result_ok);
11282         return *owner->contents.err;
11283 }
11284 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11285         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
11286         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(owner_conv));
11287         return ret_conv;
11288 }
11289
11290 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
11291 CHECK(owner->result_ok);
11292         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
11293 }
11294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11295         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
11296         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
11297         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(owner_conv);
11298         return tag_ptr(ret_conv, true);
11299 }
11300
11301 static inline enum LDKIOError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
11302 CHECK(!owner->result_ok);
11303         return *owner->contents.err;
11304 }
11305 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11306         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
11307         jclass ret_conv = LDKIOError_to_java(env, CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(owner_conv));
11308         return ret_conv;
11309 }
11310
11311 static jclass LDKCOption_SecretKeyZ_Some_class = NULL;
11312 static jmethodID LDKCOption_SecretKeyZ_Some_meth = NULL;
11313 static jclass LDKCOption_SecretKeyZ_None_class = NULL;
11314 static jmethodID LDKCOption_SecretKeyZ_None_meth = NULL;
11315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1SecretKeyZ_init (JNIEnv *env, jclass clz) {
11316         LDKCOption_SecretKeyZ_Some_class =
11317                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SecretKeyZ$Some"));
11318         CHECK(LDKCOption_SecretKeyZ_Some_class != NULL);
11319         LDKCOption_SecretKeyZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_SecretKeyZ_Some_class, "<init>", "([B)V");
11320         CHECK(LDKCOption_SecretKeyZ_Some_meth != NULL);
11321         LDKCOption_SecretKeyZ_None_class =
11322                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SecretKeyZ$None"));
11323         CHECK(LDKCOption_SecretKeyZ_None_class != NULL);
11324         LDKCOption_SecretKeyZ_None_meth = (*env)->GetMethodID(env, LDKCOption_SecretKeyZ_None_class, "<init>", "()V");
11325         CHECK(LDKCOption_SecretKeyZ_None_meth != NULL);
11326 }
11327 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1SecretKeyZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11328         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
11329         switch(obj->tag) {
11330                 case LDKCOption_SecretKeyZ_Some: {
11331                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
11332                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.bytes);
11333                         return (*env)->NewObject(env, LDKCOption_SecretKeyZ_Some_class, LDKCOption_SecretKeyZ_Some_meth, some_arr);
11334                 }
11335                 case LDKCOption_SecretKeyZ_None: {
11336                         return (*env)->NewObject(env, LDKCOption_SecretKeyZ_None_class, LDKCOption_SecretKeyZ_None_meth);
11337                 }
11338                 default: abort();
11339         }
11340 }
11341 static inline struct LDKVerifiedInvoiceRequest CResult_VerifiedInvoiceRequestNoneZ_get_ok(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
11342         LDKVerifiedInvoiceRequest ret = *owner->contents.result;
11343         ret.is_owned = false;
11344         return ret;
11345 }
11346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11347         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
11348         LDKVerifiedInvoiceRequest ret_var = CResult_VerifiedInvoiceRequestNoneZ_get_ok(owner_conv);
11349         int64_t ret_ref = 0;
11350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11352         return ret_ref;
11353 }
11354
11355 static inline void CResult_VerifiedInvoiceRequestNoneZ_get_err(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
11356 CHECK(!owner->result_ok);
11357         return *owner->contents.err;
11358 }
11359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11360         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
11361         CResult_VerifiedInvoiceRequestNoneZ_get_err(owner_conv);
11362 }
11363
11364 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
11365         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
11366         for (size_t i = 0; i < ret.datalen; i++) {
11367                 ret.data[i] = Witness_clone(&orig->data[i]);
11368         }
11369         return ret;
11370 }
11371 static jclass LDKCOption_i64Z_Some_class = NULL;
11372 static jmethodID LDKCOption_i64Z_Some_meth = NULL;
11373 static jclass LDKCOption_i64Z_None_class = NULL;
11374 static jmethodID LDKCOption_i64Z_None_meth = NULL;
11375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1i64Z_init (JNIEnv *env, jclass clz) {
11376         LDKCOption_i64Z_Some_class =
11377                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_i64Z$Some"));
11378         CHECK(LDKCOption_i64Z_Some_class != NULL);
11379         LDKCOption_i64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_i64Z_Some_class, "<init>", "(J)V");
11380         CHECK(LDKCOption_i64Z_Some_meth != NULL);
11381         LDKCOption_i64Z_None_class =
11382                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_i64Z$None"));
11383         CHECK(LDKCOption_i64Z_None_class != NULL);
11384         LDKCOption_i64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_i64Z_None_class, "<init>", "()V");
11385         CHECK(LDKCOption_i64Z_None_meth != NULL);
11386 }
11387 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1i64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11388         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
11389         switch(obj->tag) {
11390                 case LDKCOption_i64Z_Some: {
11391                         int64_t some_conv = obj->some;
11392                         return (*env)->NewObject(env, LDKCOption_i64Z_Some_class, LDKCOption_i64Z_Some_meth, some_conv);
11393                 }
11394                 case LDKCOption_i64Z_None: {
11395                         return (*env)->NewObject(env, LDKCOption_i64Z_None_class, LDKCOption_i64Z_None_meth);
11396                 }
11397                 default: abort();
11398         }
11399 }
11400 static inline struct LDKSocketAddress CResult_SocketAddressDecodeErrorZ_get_ok(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
11401 CHECK(owner->result_ok);
11402         return SocketAddress_clone(&*owner->contents.result);
11403 }
11404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11405         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
11406         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
11407         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_ok(owner_conv);
11408         int64_t ret_ref = tag_ptr(ret_copy, true);
11409         return ret_ref;
11410 }
11411
11412 static inline struct LDKDecodeError CResult_SocketAddressDecodeErrorZ_get_err(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
11413 CHECK(!owner->result_ok);
11414         return DecodeError_clone(&*owner->contents.err);
11415 }
11416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11417         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
11418         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11419         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_err(owner_conv);
11420         int64_t ret_ref = tag_ptr(ret_copy, true);
11421         return ret_ref;
11422 }
11423
11424 static inline struct LDKSocketAddress CResult_SocketAddressSocketAddressParseErrorZ_get_ok(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
11425 CHECK(owner->result_ok);
11426         return SocketAddress_clone(&*owner->contents.result);
11427 }
11428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11429         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
11430         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
11431         *ret_copy = CResult_SocketAddressSocketAddressParseErrorZ_get_ok(owner_conv);
11432         int64_t ret_ref = tag_ptr(ret_copy, true);
11433         return ret_ref;
11434 }
11435
11436 static inline enum LDKSocketAddressParseError CResult_SocketAddressSocketAddressParseErrorZ_get_err(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
11437 CHECK(!owner->result_ok);
11438         return SocketAddressParseError_clone(&*owner->contents.err);
11439 }
11440 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11441         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
11442         jclass ret_conv = LDKSocketAddressParseError_to_java(env, CResult_SocketAddressSocketAddressParseErrorZ_get_err(owner_conv));
11443         return ret_conv;
11444 }
11445
11446 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
11447         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
11448         for (size_t i = 0; i < ret.datalen; i++) {
11449                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
11450         }
11451         return ret;
11452 }
11453 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
11454         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
11455         for (size_t i = 0; i < ret.datalen; i++) {
11456                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
11457         }
11458         return ret;
11459 }
11460 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
11461         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
11462         for (size_t i = 0; i < ret.datalen; i++) {
11463                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
11464         }
11465         return ret;
11466 }
11467 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
11468         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
11469         for (size_t i = 0; i < ret.datalen; i++) {
11470                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
11471         }
11472         return ret;
11473 }
11474 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
11475         LDKAcceptChannel ret = *owner->contents.result;
11476         ret.is_owned = false;
11477         return ret;
11478 }
11479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11480         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
11481         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
11482         int64_t ret_ref = 0;
11483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11485         return ret_ref;
11486 }
11487
11488 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
11489 CHECK(!owner->result_ok);
11490         return DecodeError_clone(&*owner->contents.err);
11491 }
11492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11493         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
11494         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11495         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
11496         int64_t ret_ref = tag_ptr(ret_copy, true);
11497         return ret_ref;
11498 }
11499
11500 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
11501         LDKAcceptChannelV2 ret = *owner->contents.result;
11502         ret.is_owned = false;
11503         return ret;
11504 }
11505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11506         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
11507         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
11508         int64_t ret_ref = 0;
11509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11511         return ret_ref;
11512 }
11513
11514 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
11515 CHECK(!owner->result_ok);
11516         return DecodeError_clone(&*owner->contents.err);
11517 }
11518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11519         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
11520         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11521         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
11522         int64_t ret_ref = tag_ptr(ret_copy, true);
11523         return ret_ref;
11524 }
11525
11526 static inline struct LDKStfu CResult_StfuDecodeErrorZ_get_ok(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
11527         LDKStfu ret = *owner->contents.result;
11528         ret.is_owned = false;
11529         return ret;
11530 }
11531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11532         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
11533         LDKStfu ret_var = CResult_StfuDecodeErrorZ_get_ok(owner_conv);
11534         int64_t ret_ref = 0;
11535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11537         return ret_ref;
11538 }
11539
11540 static inline struct LDKDecodeError CResult_StfuDecodeErrorZ_get_err(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
11541 CHECK(!owner->result_ok);
11542         return DecodeError_clone(&*owner->contents.err);
11543 }
11544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11545         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
11546         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11547         *ret_copy = CResult_StfuDecodeErrorZ_get_err(owner_conv);
11548         int64_t ret_ref = tag_ptr(ret_copy, true);
11549         return ret_ref;
11550 }
11551
11552 static inline struct LDKSplice CResult_SpliceDecodeErrorZ_get_ok(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
11553         LDKSplice ret = *owner->contents.result;
11554         ret.is_owned = false;
11555         return ret;
11556 }
11557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11558         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
11559         LDKSplice ret_var = CResult_SpliceDecodeErrorZ_get_ok(owner_conv);
11560         int64_t ret_ref = 0;
11561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11563         return ret_ref;
11564 }
11565
11566 static inline struct LDKDecodeError CResult_SpliceDecodeErrorZ_get_err(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
11567 CHECK(!owner->result_ok);
11568         return DecodeError_clone(&*owner->contents.err);
11569 }
11570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11571         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
11572         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11573         *ret_copy = CResult_SpliceDecodeErrorZ_get_err(owner_conv);
11574         int64_t ret_ref = tag_ptr(ret_copy, true);
11575         return ret_ref;
11576 }
11577
11578 static inline struct LDKSpliceAck CResult_SpliceAckDecodeErrorZ_get_ok(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
11579         LDKSpliceAck ret = *owner->contents.result;
11580         ret.is_owned = false;
11581         return ret;
11582 }
11583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11584         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
11585         LDKSpliceAck ret_var = CResult_SpliceAckDecodeErrorZ_get_ok(owner_conv);
11586         int64_t ret_ref = 0;
11587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11589         return ret_ref;
11590 }
11591
11592 static inline struct LDKDecodeError CResult_SpliceAckDecodeErrorZ_get_err(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
11593 CHECK(!owner->result_ok);
11594         return DecodeError_clone(&*owner->contents.err);
11595 }
11596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11597         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
11598         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11599         *ret_copy = CResult_SpliceAckDecodeErrorZ_get_err(owner_conv);
11600         int64_t ret_ref = tag_ptr(ret_copy, true);
11601         return ret_ref;
11602 }
11603
11604 static inline struct LDKSpliceLocked CResult_SpliceLockedDecodeErrorZ_get_ok(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
11605         LDKSpliceLocked ret = *owner->contents.result;
11606         ret.is_owned = false;
11607         return ret;
11608 }
11609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11610         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
11611         LDKSpliceLocked ret_var = CResult_SpliceLockedDecodeErrorZ_get_ok(owner_conv);
11612         int64_t ret_ref = 0;
11613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11615         return ret_ref;
11616 }
11617
11618 static inline struct LDKDecodeError CResult_SpliceLockedDecodeErrorZ_get_err(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
11619 CHECK(!owner->result_ok);
11620         return DecodeError_clone(&*owner->contents.err);
11621 }
11622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11623         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
11624         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11625         *ret_copy = CResult_SpliceLockedDecodeErrorZ_get_err(owner_conv);
11626         int64_t ret_ref = tag_ptr(ret_copy, true);
11627         return ret_ref;
11628 }
11629
11630 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
11631         LDKTxAddInput ret = *owner->contents.result;
11632         ret.is_owned = false;
11633         return ret;
11634 }
11635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11636         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
11637         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
11638         int64_t ret_ref = 0;
11639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11641         return ret_ref;
11642 }
11643
11644 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
11645 CHECK(!owner->result_ok);
11646         return DecodeError_clone(&*owner->contents.err);
11647 }
11648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11649         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
11650         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11651         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
11652         int64_t ret_ref = tag_ptr(ret_copy, true);
11653         return ret_ref;
11654 }
11655
11656 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
11657         LDKTxAddOutput ret = *owner->contents.result;
11658         ret.is_owned = false;
11659         return ret;
11660 }
11661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11662         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
11663         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
11664         int64_t ret_ref = 0;
11665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11667         return ret_ref;
11668 }
11669
11670 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
11671 CHECK(!owner->result_ok);
11672         return DecodeError_clone(&*owner->contents.err);
11673 }
11674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11675         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
11676         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11677         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
11678         int64_t ret_ref = tag_ptr(ret_copy, true);
11679         return ret_ref;
11680 }
11681
11682 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
11683         LDKTxRemoveInput ret = *owner->contents.result;
11684         ret.is_owned = false;
11685         return ret;
11686 }
11687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11688         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
11689         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
11690         int64_t ret_ref = 0;
11691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11693         return ret_ref;
11694 }
11695
11696 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
11697 CHECK(!owner->result_ok);
11698         return DecodeError_clone(&*owner->contents.err);
11699 }
11700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11701         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
11702         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11703         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
11704         int64_t ret_ref = tag_ptr(ret_copy, true);
11705         return ret_ref;
11706 }
11707
11708 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
11709         LDKTxRemoveOutput ret = *owner->contents.result;
11710         ret.is_owned = false;
11711         return ret;
11712 }
11713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11714         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
11715         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
11716         int64_t ret_ref = 0;
11717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11719         return ret_ref;
11720 }
11721
11722 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
11723 CHECK(!owner->result_ok);
11724         return DecodeError_clone(&*owner->contents.err);
11725 }
11726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11727         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
11728         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11729         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
11730         int64_t ret_ref = tag_ptr(ret_copy, true);
11731         return ret_ref;
11732 }
11733
11734 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
11735         LDKTxComplete ret = *owner->contents.result;
11736         ret.is_owned = false;
11737         return ret;
11738 }
11739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11740         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
11741         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
11742         int64_t ret_ref = 0;
11743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11745         return ret_ref;
11746 }
11747
11748 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
11749 CHECK(!owner->result_ok);
11750         return DecodeError_clone(&*owner->contents.err);
11751 }
11752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11753         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
11754         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11755         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
11756         int64_t ret_ref = tag_ptr(ret_copy, true);
11757         return ret_ref;
11758 }
11759
11760 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
11761         LDKTxSignatures ret = *owner->contents.result;
11762         ret.is_owned = false;
11763         return ret;
11764 }
11765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11766         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
11767         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
11768         int64_t ret_ref = 0;
11769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11771         return ret_ref;
11772 }
11773
11774 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
11775 CHECK(!owner->result_ok);
11776         return DecodeError_clone(&*owner->contents.err);
11777 }
11778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11779         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
11780         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11781         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
11782         int64_t ret_ref = tag_ptr(ret_copy, true);
11783         return ret_ref;
11784 }
11785
11786 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
11787         LDKTxInitRbf ret = *owner->contents.result;
11788         ret.is_owned = false;
11789         return ret;
11790 }
11791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11792         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
11793         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
11794         int64_t ret_ref = 0;
11795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11797         return ret_ref;
11798 }
11799
11800 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
11801 CHECK(!owner->result_ok);
11802         return DecodeError_clone(&*owner->contents.err);
11803 }
11804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11805         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
11806         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11807         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
11808         int64_t ret_ref = tag_ptr(ret_copy, true);
11809         return ret_ref;
11810 }
11811
11812 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
11813         LDKTxAckRbf ret = *owner->contents.result;
11814         ret.is_owned = false;
11815         return ret;
11816 }
11817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11818         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
11819         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
11820         int64_t ret_ref = 0;
11821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11823         return ret_ref;
11824 }
11825
11826 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
11827 CHECK(!owner->result_ok);
11828         return DecodeError_clone(&*owner->contents.err);
11829 }
11830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11831         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
11832         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11833         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
11834         int64_t ret_ref = tag_ptr(ret_copy, true);
11835         return ret_ref;
11836 }
11837
11838 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
11839         LDKTxAbort ret = *owner->contents.result;
11840         ret.is_owned = false;
11841         return ret;
11842 }
11843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11844         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
11845         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
11846         int64_t ret_ref = 0;
11847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11849         return ret_ref;
11850 }
11851
11852 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
11853 CHECK(!owner->result_ok);
11854         return DecodeError_clone(&*owner->contents.err);
11855 }
11856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11857         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
11858         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11859         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
11860         int64_t ret_ref = tag_ptr(ret_copy, true);
11861         return ret_ref;
11862 }
11863
11864 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
11865         LDKAnnouncementSignatures ret = *owner->contents.result;
11866         ret.is_owned = false;
11867         return ret;
11868 }
11869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11870         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
11871         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
11872         int64_t ret_ref = 0;
11873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11874         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11875         return ret_ref;
11876 }
11877
11878 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
11879 CHECK(!owner->result_ok);
11880         return DecodeError_clone(&*owner->contents.err);
11881 }
11882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11883         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
11884         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11885         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
11886         int64_t ret_ref = tag_ptr(ret_copy, true);
11887         return ret_ref;
11888 }
11889
11890 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
11891         LDKChannelReestablish ret = *owner->contents.result;
11892         ret.is_owned = false;
11893         return ret;
11894 }
11895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11896         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
11897         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
11898         int64_t ret_ref = 0;
11899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11901         return ret_ref;
11902 }
11903
11904 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
11905 CHECK(!owner->result_ok);
11906         return DecodeError_clone(&*owner->contents.err);
11907 }
11908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11909         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
11910         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11911         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
11912         int64_t ret_ref = tag_ptr(ret_copy, true);
11913         return ret_ref;
11914 }
11915
11916 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
11917         LDKClosingSigned ret = *owner->contents.result;
11918         ret.is_owned = false;
11919         return ret;
11920 }
11921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11922         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
11923         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
11924         int64_t ret_ref = 0;
11925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11927         return ret_ref;
11928 }
11929
11930 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
11931 CHECK(!owner->result_ok);
11932         return DecodeError_clone(&*owner->contents.err);
11933 }
11934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11935         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
11936         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11937         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
11938         int64_t ret_ref = tag_ptr(ret_copy, true);
11939         return ret_ref;
11940 }
11941
11942 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
11943         LDKClosingSignedFeeRange ret = *owner->contents.result;
11944         ret.is_owned = false;
11945         return ret;
11946 }
11947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11948         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
11949         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
11950         int64_t ret_ref = 0;
11951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11953         return ret_ref;
11954 }
11955
11956 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
11957 CHECK(!owner->result_ok);
11958         return DecodeError_clone(&*owner->contents.err);
11959 }
11960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11961         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
11962         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11963         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
11964         int64_t ret_ref = tag_ptr(ret_copy, true);
11965         return ret_ref;
11966 }
11967
11968 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
11969         LDKCommitmentSigned ret = *owner->contents.result;
11970         ret.is_owned = false;
11971         return ret;
11972 }
11973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11974         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
11975         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
11976         int64_t ret_ref = 0;
11977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11979         return ret_ref;
11980 }
11981
11982 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
11983 CHECK(!owner->result_ok);
11984         return DecodeError_clone(&*owner->contents.err);
11985 }
11986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11987         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
11988         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11989         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
11990         int64_t ret_ref = tag_ptr(ret_copy, true);
11991         return ret_ref;
11992 }
11993
11994 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
11995         LDKFundingCreated ret = *owner->contents.result;
11996         ret.is_owned = false;
11997         return ret;
11998 }
11999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12000         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
12001         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
12002         int64_t ret_ref = 0;
12003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12005         return ret_ref;
12006 }
12007
12008 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
12009 CHECK(!owner->result_ok);
12010         return DecodeError_clone(&*owner->contents.err);
12011 }
12012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12013         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
12014         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12015         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
12016         int64_t ret_ref = tag_ptr(ret_copy, true);
12017         return ret_ref;
12018 }
12019
12020 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
12021         LDKFundingSigned ret = *owner->contents.result;
12022         ret.is_owned = false;
12023         return ret;
12024 }
12025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12026         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
12027         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
12028         int64_t ret_ref = 0;
12029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12031         return ret_ref;
12032 }
12033
12034 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
12035 CHECK(!owner->result_ok);
12036         return DecodeError_clone(&*owner->contents.err);
12037 }
12038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12039         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
12040         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12041         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
12042         int64_t ret_ref = tag_ptr(ret_copy, true);
12043         return ret_ref;
12044 }
12045
12046 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
12047         LDKChannelReady ret = *owner->contents.result;
12048         ret.is_owned = false;
12049         return ret;
12050 }
12051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12052         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
12053         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
12054         int64_t ret_ref = 0;
12055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12057         return ret_ref;
12058 }
12059
12060 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
12061 CHECK(!owner->result_ok);
12062         return DecodeError_clone(&*owner->contents.err);
12063 }
12064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12065         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
12066         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12067         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
12068         int64_t ret_ref = tag_ptr(ret_copy, true);
12069         return ret_ref;
12070 }
12071
12072 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
12073         LDKInit ret = *owner->contents.result;
12074         ret.is_owned = false;
12075         return ret;
12076 }
12077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12078         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
12079         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
12080         int64_t ret_ref = 0;
12081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12083         return ret_ref;
12084 }
12085
12086 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
12087 CHECK(!owner->result_ok);
12088         return DecodeError_clone(&*owner->contents.err);
12089 }
12090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12091         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
12092         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12093         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
12094         int64_t ret_ref = tag_ptr(ret_copy, true);
12095         return ret_ref;
12096 }
12097
12098 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
12099         LDKOpenChannel ret = *owner->contents.result;
12100         ret.is_owned = false;
12101         return ret;
12102 }
12103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12104         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
12105         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
12106         int64_t ret_ref = 0;
12107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12109         return ret_ref;
12110 }
12111
12112 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
12113 CHECK(!owner->result_ok);
12114         return DecodeError_clone(&*owner->contents.err);
12115 }
12116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12117         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
12118         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12119         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
12120         int64_t ret_ref = tag_ptr(ret_copy, true);
12121         return ret_ref;
12122 }
12123
12124 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
12125         LDKOpenChannelV2 ret = *owner->contents.result;
12126         ret.is_owned = false;
12127         return ret;
12128 }
12129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12130         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
12131         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
12132         int64_t ret_ref = 0;
12133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12135         return ret_ref;
12136 }
12137
12138 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
12139 CHECK(!owner->result_ok);
12140         return DecodeError_clone(&*owner->contents.err);
12141 }
12142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12143         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
12144         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12145         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
12146         int64_t ret_ref = tag_ptr(ret_copy, true);
12147         return ret_ref;
12148 }
12149
12150 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
12151         LDKRevokeAndACK ret = *owner->contents.result;
12152         ret.is_owned = false;
12153         return ret;
12154 }
12155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12156         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
12157         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
12158         int64_t ret_ref = 0;
12159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12161         return ret_ref;
12162 }
12163
12164 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
12165 CHECK(!owner->result_ok);
12166         return DecodeError_clone(&*owner->contents.err);
12167 }
12168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12169         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
12170         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12171         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
12172         int64_t ret_ref = tag_ptr(ret_copy, true);
12173         return ret_ref;
12174 }
12175
12176 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
12177         LDKShutdown ret = *owner->contents.result;
12178         ret.is_owned = false;
12179         return ret;
12180 }
12181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12182         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
12183         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
12184         int64_t ret_ref = 0;
12185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12187         return ret_ref;
12188 }
12189
12190 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
12191 CHECK(!owner->result_ok);
12192         return DecodeError_clone(&*owner->contents.err);
12193 }
12194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12195         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
12196         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12197         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
12198         int64_t ret_ref = tag_ptr(ret_copy, true);
12199         return ret_ref;
12200 }
12201
12202 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
12203         LDKUpdateFailHTLC ret = *owner->contents.result;
12204         ret.is_owned = false;
12205         return ret;
12206 }
12207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12208         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
12209         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
12210         int64_t ret_ref = 0;
12211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12213         return ret_ref;
12214 }
12215
12216 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
12217 CHECK(!owner->result_ok);
12218         return DecodeError_clone(&*owner->contents.err);
12219 }
12220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12221         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
12222         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12223         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
12224         int64_t ret_ref = tag_ptr(ret_copy, true);
12225         return ret_ref;
12226 }
12227
12228 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
12229         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
12230         ret.is_owned = false;
12231         return ret;
12232 }
12233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12234         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
12235         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
12236         int64_t ret_ref = 0;
12237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12239         return ret_ref;
12240 }
12241
12242 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
12243 CHECK(!owner->result_ok);
12244         return DecodeError_clone(&*owner->contents.err);
12245 }
12246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12247         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
12248         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12249         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
12250         int64_t ret_ref = tag_ptr(ret_copy, true);
12251         return ret_ref;
12252 }
12253
12254 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
12255         LDKUpdateFee ret = *owner->contents.result;
12256         ret.is_owned = false;
12257         return ret;
12258 }
12259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12260         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
12261         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
12262         int64_t ret_ref = 0;
12263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12265         return ret_ref;
12266 }
12267
12268 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
12269 CHECK(!owner->result_ok);
12270         return DecodeError_clone(&*owner->contents.err);
12271 }
12272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12273         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
12274         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12275         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
12276         int64_t ret_ref = tag_ptr(ret_copy, true);
12277         return ret_ref;
12278 }
12279
12280 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
12281         LDKUpdateFulfillHTLC ret = *owner->contents.result;
12282         ret.is_owned = false;
12283         return ret;
12284 }
12285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12286         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
12287         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
12288         int64_t ret_ref = 0;
12289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12291         return ret_ref;
12292 }
12293
12294 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
12295 CHECK(!owner->result_ok);
12296         return DecodeError_clone(&*owner->contents.err);
12297 }
12298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12299         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
12300         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12301         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
12302         int64_t ret_ref = tag_ptr(ret_copy, true);
12303         return ret_ref;
12304 }
12305
12306 static inline struct LDKOnionPacket CResult_OnionPacketDecodeErrorZ_get_ok(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
12307         LDKOnionPacket ret = *owner->contents.result;
12308         ret.is_owned = false;
12309         return ret;
12310 }
12311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12312         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
12313         LDKOnionPacket ret_var = CResult_OnionPacketDecodeErrorZ_get_ok(owner_conv);
12314         int64_t ret_ref = 0;
12315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12317         return ret_ref;
12318 }
12319
12320 static inline struct LDKDecodeError CResult_OnionPacketDecodeErrorZ_get_err(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
12321 CHECK(!owner->result_ok);
12322         return DecodeError_clone(&*owner->contents.err);
12323 }
12324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12325         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
12326         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12327         *ret_copy = CResult_OnionPacketDecodeErrorZ_get_err(owner_conv);
12328         int64_t ret_ref = tag_ptr(ret_copy, true);
12329         return ret_ref;
12330 }
12331
12332 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
12333         LDKUpdateAddHTLC ret = *owner->contents.result;
12334         ret.is_owned = false;
12335         return ret;
12336 }
12337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12338         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
12339         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
12340         int64_t ret_ref = 0;
12341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12343         return ret_ref;
12344 }
12345
12346 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
12347 CHECK(!owner->result_ok);
12348         return DecodeError_clone(&*owner->contents.err);
12349 }
12350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12351         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
12352         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12353         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
12354         int64_t ret_ref = tag_ptr(ret_copy, true);
12355         return ret_ref;
12356 }
12357
12358 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
12359         LDKOnionMessage ret = *owner->contents.result;
12360         ret.is_owned = false;
12361         return ret;
12362 }
12363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12364         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
12365         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
12366         int64_t ret_ref = 0;
12367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12369         return ret_ref;
12370 }
12371
12372 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
12373 CHECK(!owner->result_ok);
12374         return DecodeError_clone(&*owner->contents.err);
12375 }
12376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12377         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
12378         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12379         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
12380         int64_t ret_ref = tag_ptr(ret_copy, true);
12381         return ret_ref;
12382 }
12383
12384 static inline struct LDKFinalOnionHopData CResult_FinalOnionHopDataDecodeErrorZ_get_ok(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
12385         LDKFinalOnionHopData ret = *owner->contents.result;
12386         ret.is_owned = false;
12387         return ret;
12388 }
12389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12390         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
12391         LDKFinalOnionHopData ret_var = CResult_FinalOnionHopDataDecodeErrorZ_get_ok(owner_conv);
12392         int64_t ret_ref = 0;
12393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12395         return ret_ref;
12396 }
12397
12398 static inline struct LDKDecodeError CResult_FinalOnionHopDataDecodeErrorZ_get_err(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
12399 CHECK(!owner->result_ok);
12400         return DecodeError_clone(&*owner->contents.err);
12401 }
12402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12403         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
12404         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12405         *ret_copy = CResult_FinalOnionHopDataDecodeErrorZ_get_err(owner_conv);
12406         int64_t ret_ref = tag_ptr(ret_copy, true);
12407         return ret_ref;
12408 }
12409
12410 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
12411         LDKPing ret = *owner->contents.result;
12412         ret.is_owned = false;
12413         return ret;
12414 }
12415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12416         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
12417         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
12418         int64_t ret_ref = 0;
12419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12421         return ret_ref;
12422 }
12423
12424 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
12425 CHECK(!owner->result_ok);
12426         return DecodeError_clone(&*owner->contents.err);
12427 }
12428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12429         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
12430         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12431         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
12432         int64_t ret_ref = tag_ptr(ret_copy, true);
12433         return ret_ref;
12434 }
12435
12436 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
12437         LDKPong ret = *owner->contents.result;
12438         ret.is_owned = false;
12439         return ret;
12440 }
12441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12442         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
12443         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
12444         int64_t ret_ref = 0;
12445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12447         return ret_ref;
12448 }
12449
12450 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
12451 CHECK(!owner->result_ok);
12452         return DecodeError_clone(&*owner->contents.err);
12453 }
12454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12455         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
12456         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12457         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
12458         int64_t ret_ref = tag_ptr(ret_copy, true);
12459         return ret_ref;
12460 }
12461
12462 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
12463         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
12464         ret.is_owned = false;
12465         return ret;
12466 }
12467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12468         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
12469         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
12470         int64_t ret_ref = 0;
12471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12473         return ret_ref;
12474 }
12475
12476 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
12477 CHECK(!owner->result_ok);
12478         return DecodeError_clone(&*owner->contents.err);
12479 }
12480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12481         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
12482         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12483         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
12484         int64_t ret_ref = tag_ptr(ret_copy, true);
12485         return ret_ref;
12486 }
12487
12488 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
12489         LDKChannelAnnouncement ret = *owner->contents.result;
12490         ret.is_owned = false;
12491         return ret;
12492 }
12493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12494         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
12495         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
12496         int64_t ret_ref = 0;
12497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12499         return ret_ref;
12500 }
12501
12502 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
12503 CHECK(!owner->result_ok);
12504         return DecodeError_clone(&*owner->contents.err);
12505 }
12506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12507         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
12508         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12509         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
12510         int64_t ret_ref = tag_ptr(ret_copy, true);
12511         return ret_ref;
12512 }
12513
12514 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
12515         LDKUnsignedChannelUpdate ret = *owner->contents.result;
12516         ret.is_owned = false;
12517         return ret;
12518 }
12519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12520         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
12521         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
12522         int64_t ret_ref = 0;
12523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12525         return ret_ref;
12526 }
12527
12528 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
12529 CHECK(!owner->result_ok);
12530         return DecodeError_clone(&*owner->contents.err);
12531 }
12532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12533         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
12534         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12535         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
12536         int64_t ret_ref = tag_ptr(ret_copy, true);
12537         return ret_ref;
12538 }
12539
12540 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
12541         LDKChannelUpdate ret = *owner->contents.result;
12542         ret.is_owned = false;
12543         return ret;
12544 }
12545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12546         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
12547         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
12548         int64_t ret_ref = 0;
12549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12551         return ret_ref;
12552 }
12553
12554 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
12555 CHECK(!owner->result_ok);
12556         return DecodeError_clone(&*owner->contents.err);
12557 }
12558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12559         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
12560         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12561         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
12562         int64_t ret_ref = tag_ptr(ret_copy, true);
12563         return ret_ref;
12564 }
12565
12566 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
12567         LDKErrorMessage ret = *owner->contents.result;
12568         ret.is_owned = false;
12569         return ret;
12570 }
12571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12572         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
12573         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
12574         int64_t ret_ref = 0;
12575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12577         return ret_ref;
12578 }
12579
12580 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
12581 CHECK(!owner->result_ok);
12582         return DecodeError_clone(&*owner->contents.err);
12583 }
12584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12585         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
12586         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12587         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
12588         int64_t ret_ref = tag_ptr(ret_copy, true);
12589         return ret_ref;
12590 }
12591
12592 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
12593         LDKWarningMessage ret = *owner->contents.result;
12594         ret.is_owned = false;
12595         return ret;
12596 }
12597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12598         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
12599         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
12600         int64_t ret_ref = 0;
12601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12603         return ret_ref;
12604 }
12605
12606 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
12607 CHECK(!owner->result_ok);
12608         return DecodeError_clone(&*owner->contents.err);
12609 }
12610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12611         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
12612         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12613         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
12614         int64_t ret_ref = tag_ptr(ret_copy, true);
12615         return ret_ref;
12616 }
12617
12618 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
12619         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
12620         ret.is_owned = false;
12621         return ret;
12622 }
12623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12624         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
12625         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
12626         int64_t ret_ref = 0;
12627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12629         return ret_ref;
12630 }
12631
12632 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
12633 CHECK(!owner->result_ok);
12634         return DecodeError_clone(&*owner->contents.err);
12635 }
12636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12637         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
12638         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12639         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
12640         int64_t ret_ref = tag_ptr(ret_copy, true);
12641         return ret_ref;
12642 }
12643
12644 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
12645         LDKNodeAnnouncement ret = *owner->contents.result;
12646         ret.is_owned = false;
12647         return ret;
12648 }
12649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12650         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
12651         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
12652         int64_t ret_ref = 0;
12653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12655         return ret_ref;
12656 }
12657
12658 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
12659 CHECK(!owner->result_ok);
12660         return DecodeError_clone(&*owner->contents.err);
12661 }
12662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12663         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
12664         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12665         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
12666         int64_t ret_ref = tag_ptr(ret_copy, true);
12667         return ret_ref;
12668 }
12669
12670 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
12671         LDKQueryShortChannelIds ret = *owner->contents.result;
12672         ret.is_owned = false;
12673         return ret;
12674 }
12675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12676         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
12677         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
12678         int64_t ret_ref = 0;
12679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12681         return ret_ref;
12682 }
12683
12684 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
12685 CHECK(!owner->result_ok);
12686         return DecodeError_clone(&*owner->contents.err);
12687 }
12688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12689         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
12690         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12691         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
12692         int64_t ret_ref = tag_ptr(ret_copy, true);
12693         return ret_ref;
12694 }
12695
12696 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
12697         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
12698         ret.is_owned = false;
12699         return ret;
12700 }
12701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12702         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
12703         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
12704         int64_t ret_ref = 0;
12705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12707         return ret_ref;
12708 }
12709
12710 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
12711 CHECK(!owner->result_ok);
12712         return DecodeError_clone(&*owner->contents.err);
12713 }
12714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12715         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
12716         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12717         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
12718         int64_t ret_ref = tag_ptr(ret_copy, true);
12719         return ret_ref;
12720 }
12721
12722 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
12723         LDKQueryChannelRange ret = *owner->contents.result;
12724         ret.is_owned = false;
12725         return ret;
12726 }
12727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12728         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
12729         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
12730         int64_t ret_ref = 0;
12731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12733         return ret_ref;
12734 }
12735
12736 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
12737 CHECK(!owner->result_ok);
12738         return DecodeError_clone(&*owner->contents.err);
12739 }
12740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12741         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
12742         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12743         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
12744         int64_t ret_ref = tag_ptr(ret_copy, true);
12745         return ret_ref;
12746 }
12747
12748 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
12749         LDKReplyChannelRange ret = *owner->contents.result;
12750         ret.is_owned = false;
12751         return ret;
12752 }
12753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12754         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
12755         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
12756         int64_t ret_ref = 0;
12757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12759         return ret_ref;
12760 }
12761
12762 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
12763 CHECK(!owner->result_ok);
12764         return DecodeError_clone(&*owner->contents.err);
12765 }
12766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12767         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
12768         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12769         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
12770         int64_t ret_ref = tag_ptr(ret_copy, true);
12771         return ret_ref;
12772 }
12773
12774 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
12775         LDKGossipTimestampFilter ret = *owner->contents.result;
12776         ret.is_owned = false;
12777         return ret;
12778 }
12779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12780         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
12781         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
12782         int64_t ret_ref = 0;
12783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12785         return ret_ref;
12786 }
12787
12788 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
12789 CHECK(!owner->result_ok);
12790         return DecodeError_clone(&*owner->contents.err);
12791 }
12792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12793         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
12794         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12795         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
12796         int64_t ret_ref = tag_ptr(ret_copy, true);
12797         return ret_ref;
12798 }
12799
12800 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
12801         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
12802         for (size_t i = 0; i < ret.datalen; i++) {
12803                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
12804         }
12805         return ret;
12806 }
12807 static jclass LDKSignOrCreationError_SignError_class = NULL;
12808 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
12809 static jclass LDKSignOrCreationError_CreationError_class = NULL;
12810 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
12811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
12812         LDKSignOrCreationError_SignError_class =
12813                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
12814         CHECK(LDKSignOrCreationError_SignError_class != NULL);
12815         LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
12816         CHECK(LDKSignOrCreationError_SignError_meth != NULL);
12817         LDKSignOrCreationError_CreationError_class =
12818                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
12819         CHECK(LDKSignOrCreationError_CreationError_class != NULL);
12820         LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
12821         CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
12822 }
12823 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12824         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
12825         switch(obj->tag) {
12826                 case LDKSignOrCreationError_SignError: {
12827                         return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
12828                 }
12829                 case LDKSignOrCreationError_CreationError: {
12830                         jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
12831                         return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
12832                 }
12833                 default: abort();
12834         }
12835 }
12836 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
12837         LDKBolt11Invoice ret = *owner->contents.result;
12838         ret.is_owned = false;
12839         return ret;
12840 }
12841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12842         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
12843         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
12844         int64_t ret_ref = 0;
12845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12846         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12847         return ret_ref;
12848 }
12849
12850 static inline struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
12851 CHECK(!owner->result_ok);
12852         return SignOrCreationError_clone(&*owner->contents.err);
12853 }
12854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12855         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
12856         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
12857         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
12858         int64_t ret_ref = tag_ptr(ret_copy, true);
12859         return ret_ref;
12860 }
12861
12862 static inline LDKCVec_FutureZ CVec_FutureZ_clone(const LDKCVec_FutureZ *orig) {
12863         LDKCVec_FutureZ ret = { .data = MALLOC(sizeof(LDKFuture) * orig->datalen, "LDKCVec_FutureZ clone bytes"), .datalen = orig->datalen };
12864         for (size_t i = 0; i < ret.datalen; i++) {
12865                 ret.data[i] = Future_clone(&orig->data[i]);
12866         }
12867         return ret;
12868 }
12869 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
12870 CHECK(owner->result_ok);
12871         return OffersMessage_clone(&*owner->contents.result);
12872 }
12873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12874         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
12875         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
12876         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
12877         int64_t ret_ref = tag_ptr(ret_copy, true);
12878         return ret_ref;
12879 }
12880
12881 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
12882 CHECK(!owner->result_ok);
12883         return DecodeError_clone(&*owner->contents.err);
12884 }
12885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12886         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
12887         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12888         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
12889         int64_t ret_ref = tag_ptr(ret_copy, true);
12890         return ret_ref;
12891 }
12892
12893 static jclass LDKCOption_HTLCClaimZ_Some_class = NULL;
12894 static jmethodID LDKCOption_HTLCClaimZ_Some_meth = NULL;
12895 static jclass LDKCOption_HTLCClaimZ_None_class = NULL;
12896 static jmethodID LDKCOption_HTLCClaimZ_None_meth = NULL;
12897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCClaimZ_init (JNIEnv *env, jclass clz) {
12898         LDKCOption_HTLCClaimZ_Some_class =
12899                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$Some"));
12900         CHECK(LDKCOption_HTLCClaimZ_Some_class != NULL);
12901         LDKCOption_HTLCClaimZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_Some_class, "<init>", "(Lorg/ldk/enums/HTLCClaim;)V");
12902         CHECK(LDKCOption_HTLCClaimZ_Some_meth != NULL);
12903         LDKCOption_HTLCClaimZ_None_class =
12904                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$None"));
12905         CHECK(LDKCOption_HTLCClaimZ_None_class != NULL);
12906         LDKCOption_HTLCClaimZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_None_class, "<init>", "()V");
12907         CHECK(LDKCOption_HTLCClaimZ_None_meth != NULL);
12908 }
12909 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCClaimZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12910         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
12911         switch(obj->tag) {
12912                 case LDKCOption_HTLCClaimZ_Some: {
12913                         jclass some_conv = LDKHTLCClaim_to_java(env, obj->some);
12914                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_Some_class, LDKCOption_HTLCClaimZ_Some_meth, some_conv);
12915                 }
12916                 case LDKCOption_HTLCClaimZ_None: {
12917                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_None_class, LDKCOption_HTLCClaimZ_None_meth);
12918                 }
12919                 default: abort();
12920         }
12921 }
12922 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
12923         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
12924         ret.is_owned = false;
12925         return ret;
12926 }
12927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12928         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
12929         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
12930         int64_t ret_ref = 0;
12931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12933         return ret_ref;
12934 }
12935
12936 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
12937 CHECK(!owner->result_ok);
12938         return DecodeError_clone(&*owner->contents.err);
12939 }
12940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12941         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
12942         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12943         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
12944         int64_t ret_ref = tag_ptr(ret_copy, true);
12945         return ret_ref;
12946 }
12947
12948 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
12949         LDKTxCreationKeys ret = *owner->contents.result;
12950         ret.is_owned = false;
12951         return ret;
12952 }
12953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12954         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
12955         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
12956         int64_t ret_ref = 0;
12957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12959         return ret_ref;
12960 }
12961
12962 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
12963 CHECK(!owner->result_ok);
12964         return DecodeError_clone(&*owner->contents.err);
12965 }
12966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12967         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
12968         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12969         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
12970         int64_t ret_ref = tag_ptr(ret_copy, true);
12971         return ret_ref;
12972 }
12973
12974 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
12975         LDKChannelPublicKeys ret = *owner->contents.result;
12976         ret.is_owned = false;
12977         return ret;
12978 }
12979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12980         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
12981         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
12982         int64_t ret_ref = 0;
12983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12985         return ret_ref;
12986 }
12987
12988 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
12989 CHECK(!owner->result_ok);
12990         return DecodeError_clone(&*owner->contents.err);
12991 }
12992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12993         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
12994         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12995         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
12996         int64_t ret_ref = tag_ptr(ret_copy, true);
12997         return ret_ref;
12998 }
12999
13000 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
13001         LDKHTLCOutputInCommitment ret = *owner->contents.result;
13002         ret.is_owned = false;
13003         return ret;
13004 }
13005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13006         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
13007         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
13008         int64_t ret_ref = 0;
13009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13011         return ret_ref;
13012 }
13013
13014 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
13015 CHECK(!owner->result_ok);
13016         return DecodeError_clone(&*owner->contents.err);
13017 }
13018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13019         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
13020         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13021         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
13022         int64_t ret_ref = tag_ptr(ret_copy, true);
13023         return ret_ref;
13024 }
13025
13026 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
13027         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
13028         ret.is_owned = false;
13029         return ret;
13030 }
13031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13032         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
13033         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
13034         int64_t ret_ref = 0;
13035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13037         return ret_ref;
13038 }
13039
13040 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
13041 CHECK(!owner->result_ok);
13042         return DecodeError_clone(&*owner->contents.err);
13043 }
13044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13045         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
13046         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13047         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
13048         int64_t ret_ref = tag_ptr(ret_copy, true);
13049         return ret_ref;
13050 }
13051
13052 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
13053         LDKChannelTransactionParameters ret = *owner->contents.result;
13054         ret.is_owned = false;
13055         return ret;
13056 }
13057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13058         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
13059         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
13060         int64_t ret_ref = 0;
13061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13063         return ret_ref;
13064 }
13065
13066 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
13067 CHECK(!owner->result_ok);
13068         return DecodeError_clone(&*owner->contents.err);
13069 }
13070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13071         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
13072         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13073         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
13074         int64_t ret_ref = tag_ptr(ret_copy, true);
13075         return ret_ref;
13076 }
13077
13078 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
13079         LDKHolderCommitmentTransaction ret = *owner->contents.result;
13080         ret.is_owned = false;
13081         return ret;
13082 }
13083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13084         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
13085         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
13086         int64_t ret_ref = 0;
13087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13089         return ret_ref;
13090 }
13091
13092 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
13093 CHECK(!owner->result_ok);
13094         return DecodeError_clone(&*owner->contents.err);
13095 }
13096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13097         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
13098         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13099         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
13100         int64_t ret_ref = tag_ptr(ret_copy, true);
13101         return ret_ref;
13102 }
13103
13104 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
13105         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
13106         ret.is_owned = false;
13107         return ret;
13108 }
13109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13110         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
13111         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
13112         int64_t ret_ref = 0;
13113         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13114         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13115         return ret_ref;
13116 }
13117
13118 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
13119 CHECK(!owner->result_ok);
13120         return DecodeError_clone(&*owner->contents.err);
13121 }
13122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13123         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
13124         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13125         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
13126         int64_t ret_ref = tag_ptr(ret_copy, true);
13127         return ret_ref;
13128 }
13129
13130 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
13131         LDKTrustedClosingTransaction ret = *owner->contents.result;
13132         ret.is_owned = false;
13133         return ret;
13134 }
13135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13136         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
13137         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
13138         int64_t ret_ref = 0;
13139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13141         return ret_ref;
13142 }
13143
13144 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
13145 CHECK(!owner->result_ok);
13146         return *owner->contents.err;
13147 }
13148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13149         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
13150         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
13151 }
13152
13153 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
13154         LDKCommitmentTransaction ret = *owner->contents.result;
13155         ret.is_owned = false;
13156         return ret;
13157 }
13158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13159         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
13160         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
13161         int64_t ret_ref = 0;
13162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13164         return ret_ref;
13165 }
13166
13167 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
13168 CHECK(!owner->result_ok);
13169         return DecodeError_clone(&*owner->contents.err);
13170 }
13171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13172         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
13173         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13174         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
13175         int64_t ret_ref = tag_ptr(ret_copy, true);
13176         return ret_ref;
13177 }
13178
13179 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
13180         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
13181         ret.is_owned = false;
13182         return ret;
13183 }
13184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13185         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
13186         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
13187         int64_t ret_ref = 0;
13188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13190         return ret_ref;
13191 }
13192
13193 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
13194 CHECK(!owner->result_ok);
13195         return *owner->contents.err;
13196 }
13197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13198         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
13199         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
13200 }
13201
13202 static inline struct LDKCVec_ECDSASignatureZ CResult_CVec_ECDSASignatureZNoneZ_get_ok(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
13203 CHECK(owner->result_ok);
13204         return *owner->contents.result;
13205 }
13206 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13207         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
13208         LDKCVec_ECDSASignatureZ ret_var = CResult_CVec_ECDSASignatureZNoneZ_get_ok(owner_conv);
13209         jobjectArray ret_arr = NULL;
13210         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
13211         ;
13212         for (size_t i = 0; i < ret_var.datalen; i++) {
13213                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
13214                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
13215                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
13216         }
13217         
13218         return ret_arr;
13219 }
13220
13221 static inline void CResult_CVec_ECDSASignatureZNoneZ_get_err(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
13222 CHECK(!owner->result_ok);
13223         return *owner->contents.err;
13224 }
13225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13226         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
13227         CResult_CVec_ECDSASignatureZNoneZ_get_err(owner_conv);
13228 }
13229
13230 static jclass LDKCOption_usizeZ_Some_class = NULL;
13231 static jmethodID LDKCOption_usizeZ_Some_meth = NULL;
13232 static jclass LDKCOption_usizeZ_None_class = NULL;
13233 static jmethodID LDKCOption_usizeZ_None_meth = NULL;
13234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1usizeZ_init (JNIEnv *env, jclass clz) {
13235         LDKCOption_usizeZ_Some_class =
13236                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_usizeZ$Some"));
13237         CHECK(LDKCOption_usizeZ_Some_class != NULL);
13238         LDKCOption_usizeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_usizeZ_Some_class, "<init>", "(J)V");
13239         CHECK(LDKCOption_usizeZ_Some_meth != NULL);
13240         LDKCOption_usizeZ_None_class =
13241                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_usizeZ$None"));
13242         CHECK(LDKCOption_usizeZ_None_class != NULL);
13243         LDKCOption_usizeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_usizeZ_None_class, "<init>", "()V");
13244         CHECK(LDKCOption_usizeZ_None_meth != NULL);
13245 }
13246 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1usizeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13247         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
13248         switch(obj->tag) {
13249                 case LDKCOption_usizeZ_Some: {
13250                         int64_t some_conv = obj->some;
13251                         return (*env)->NewObject(env, LDKCOption_usizeZ_Some_class, LDKCOption_usizeZ_Some_meth, some_conv);
13252                 }
13253                 case LDKCOption_usizeZ_None: {
13254                         return (*env)->NewObject(env, LDKCOption_usizeZ_None_class, LDKCOption_usizeZ_None_meth);
13255                 }
13256                 default: abort();
13257         }
13258 }
13259 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
13260         LDKShutdownScript ret = *owner->contents.result;
13261         ret.is_owned = false;
13262         return ret;
13263 }
13264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13265         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
13266         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
13267         int64_t ret_ref = 0;
13268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13270         return ret_ref;
13271 }
13272
13273 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
13274 CHECK(!owner->result_ok);
13275         return DecodeError_clone(&*owner->contents.err);
13276 }
13277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13278         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
13279         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13280         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
13281         int64_t ret_ref = tag_ptr(ret_copy, true);
13282         return ret_ref;
13283 }
13284
13285 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
13286         LDKShutdownScript ret = *owner->contents.result;
13287         ret.is_owned = false;
13288         return ret;
13289 }
13290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13291         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
13292         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
13293         int64_t ret_ref = 0;
13294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13296         return ret_ref;
13297 }
13298
13299 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
13300         LDKInvalidShutdownScript ret = *owner->contents.err;
13301         ret.is_owned = false;
13302         return ret;
13303 }
13304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13305         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
13306         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
13307         int64_t ret_ref = 0;
13308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13310         return ret_ref;
13311 }
13312
13313 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
13314 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
13315 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
13316 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
13317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
13318         LDKPaymentPurpose_InvoicePayment_class =
13319                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment"));
13320         CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
13321         LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "(J[B)V");
13322         CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
13323         LDKPaymentPurpose_SpontaneousPayment_class =
13324                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
13325         CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
13326         LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
13327         CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
13328 }
13329 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13330         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
13331         switch(obj->tag) {
13332                 case LDKPaymentPurpose_InvoicePayment: {
13333                         int64_t payment_preimage_ref = tag_ptr(&obj->invoice_payment.payment_preimage, false);
13334                         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
13335                         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
13336                         return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_ref, payment_secret_arr);
13337                 }
13338                 case LDKPaymentPurpose_SpontaneousPayment: {
13339                         int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
13340                         (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
13341                         return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
13342                 }
13343                 default: abort();
13344         }
13345 }
13346 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
13347 CHECK(owner->result_ok);
13348         return PaymentPurpose_clone(&*owner->contents.result);
13349 }
13350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13351         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
13352         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
13353         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
13354         int64_t ret_ref = tag_ptr(ret_copy, true);
13355         return ret_ref;
13356 }
13357
13358 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
13359 CHECK(!owner->result_ok);
13360         return DecodeError_clone(&*owner->contents.err);
13361 }
13362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13363         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
13364         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13365         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
13366         int64_t ret_ref = tag_ptr(ret_copy, true);
13367         return ret_ref;
13368 }
13369
13370 static inline struct LDKClaimedHTLC CResult_ClaimedHTLCDecodeErrorZ_get_ok(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
13371         LDKClaimedHTLC ret = *owner->contents.result;
13372         ret.is_owned = false;
13373         return ret;
13374 }
13375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13376         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
13377         LDKClaimedHTLC ret_var = CResult_ClaimedHTLCDecodeErrorZ_get_ok(owner_conv);
13378         int64_t ret_ref = 0;
13379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13381         return ret_ref;
13382 }
13383
13384 static inline struct LDKDecodeError CResult_ClaimedHTLCDecodeErrorZ_get_err(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
13385 CHECK(!owner->result_ok);
13386         return DecodeError_clone(&*owner->contents.err);
13387 }
13388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13389         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
13390         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13391         *ret_copy = CResult_ClaimedHTLCDecodeErrorZ_get_err(owner_conv);
13392         int64_t ret_ref = tag_ptr(ret_copy, true);
13393         return ret_ref;
13394 }
13395
13396 static jclass LDKPathFailure_InitialSend_class = NULL;
13397 static jmethodID LDKPathFailure_InitialSend_meth = NULL;
13398 static jclass LDKPathFailure_OnPath_class = NULL;
13399 static jmethodID LDKPathFailure_OnPath_meth = NULL;
13400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPathFailure_init (JNIEnv *env, jclass clz) {
13401         LDKPathFailure_InitialSend_class =
13402                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$InitialSend"));
13403         CHECK(LDKPathFailure_InitialSend_class != NULL);
13404         LDKPathFailure_InitialSend_meth = (*env)->GetMethodID(env, LDKPathFailure_InitialSend_class, "<init>", "(J)V");
13405         CHECK(LDKPathFailure_InitialSend_meth != NULL);
13406         LDKPathFailure_OnPath_class =
13407                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$OnPath"));
13408         CHECK(LDKPathFailure_OnPath_class != NULL);
13409         LDKPathFailure_OnPath_meth = (*env)->GetMethodID(env, LDKPathFailure_OnPath_class, "<init>", "(J)V");
13410         CHECK(LDKPathFailure_OnPath_meth != NULL);
13411 }
13412 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPathFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13413         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
13414         switch(obj->tag) {
13415                 case LDKPathFailure_InitialSend: {
13416                         int64_t err_ref = tag_ptr(&obj->initial_send.err, false);
13417                         return (*env)->NewObject(env, LDKPathFailure_InitialSend_class, LDKPathFailure_InitialSend_meth, err_ref);
13418                 }
13419                 case LDKPathFailure_OnPath: {
13420                         int64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
13421                         return (*env)->NewObject(env, LDKPathFailure_OnPath_class, LDKPathFailure_OnPath_meth, network_update_ref);
13422                 }
13423                 default: abort();
13424         }
13425 }
13426 static jclass LDKCOption_PathFailureZ_Some_class = NULL;
13427 static jmethodID LDKCOption_PathFailureZ_Some_meth = NULL;
13428 static jclass LDKCOption_PathFailureZ_None_class = NULL;
13429 static jmethodID LDKCOption_PathFailureZ_None_meth = NULL;
13430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PathFailureZ_init (JNIEnv *env, jclass clz) {
13431         LDKCOption_PathFailureZ_Some_class =
13432                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$Some"));
13433         CHECK(LDKCOption_PathFailureZ_Some_class != NULL);
13434         LDKCOption_PathFailureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_Some_class, "<init>", "(J)V");
13435         CHECK(LDKCOption_PathFailureZ_Some_meth != NULL);
13436         LDKCOption_PathFailureZ_None_class =
13437                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$None"));
13438         CHECK(LDKCOption_PathFailureZ_None_class != NULL);
13439         LDKCOption_PathFailureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_None_class, "<init>", "()V");
13440         CHECK(LDKCOption_PathFailureZ_None_meth != NULL);
13441 }
13442 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PathFailureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13443         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
13444         switch(obj->tag) {
13445                 case LDKCOption_PathFailureZ_Some: {
13446                         int64_t some_ref = tag_ptr(&obj->some, false);
13447                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_Some_class, LDKCOption_PathFailureZ_Some_meth, some_ref);
13448                 }
13449                 case LDKCOption_PathFailureZ_None: {
13450                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_None_class, LDKCOption_PathFailureZ_None_meth);
13451                 }
13452                 default: abort();
13453         }
13454 }
13455 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
13456 CHECK(owner->result_ok);
13457         return COption_PathFailureZ_clone(&*owner->contents.result);
13458 }
13459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13460         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
13461         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
13462         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
13463         int64_t ret_ref = tag_ptr(ret_copy, true);
13464         return ret_ref;
13465 }
13466
13467 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
13468 CHECK(!owner->result_ok);
13469         return DecodeError_clone(&*owner->contents.err);
13470 }
13471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13472         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
13473         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13474         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
13475         int64_t ret_ref = tag_ptr(ret_copy, true);
13476         return ret_ref;
13477 }
13478
13479 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
13480 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
13481 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
13482 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
13483 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
13484 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
13485 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
13486 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
13487 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
13488 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
13489 static jclass LDKClosureReason_ProcessingError_class = NULL;
13490 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
13491 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
13492 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
13493 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
13494 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
13495 static jclass LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class = NULL;
13496 static jmethodID LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth = NULL;
13497 static jclass LDKClosureReason_FundingBatchClosure_class = NULL;
13498 static jmethodID LDKClosureReason_FundingBatchClosure_meth = NULL;
13499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
13500         LDKClosureReason_CounterpartyForceClosed_class =
13501                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
13502         CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
13503         LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(J)V");
13504         CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
13505         LDKClosureReason_HolderForceClosed_class =
13506                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
13507         CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
13508         LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
13509         CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
13510         LDKClosureReason_CooperativeClosure_class =
13511                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure"));
13512         CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
13513         LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
13514         CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
13515         LDKClosureReason_CommitmentTxConfirmed_class =
13516                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
13517         CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
13518         LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
13519         CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
13520         LDKClosureReason_FundingTimedOut_class =
13521                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
13522         CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
13523         LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
13524         CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
13525         LDKClosureReason_ProcessingError_class =
13526                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
13527         CHECK(LDKClosureReason_ProcessingError_class != NULL);
13528         LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
13529         CHECK(LDKClosureReason_ProcessingError_meth != NULL);
13530         LDKClosureReason_DisconnectedPeer_class =
13531                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
13532         CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
13533         LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
13534         CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
13535         LDKClosureReason_OutdatedChannelManager_class =
13536                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
13537         CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
13538         LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
13539         CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
13540         LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class =
13541                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyCoopClosedUnfundedChannel"));
13542         CHECK(LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class != NULL);
13543         LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class, "<init>", "()V");
13544         CHECK(LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth != NULL);
13545         LDKClosureReason_FundingBatchClosure_class =
13546                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingBatchClosure"));
13547         CHECK(LDKClosureReason_FundingBatchClosure_class != NULL);
13548         LDKClosureReason_FundingBatchClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingBatchClosure_class, "<init>", "()V");
13549         CHECK(LDKClosureReason_FundingBatchClosure_meth != NULL);
13550 }
13551 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13552         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
13553         switch(obj->tag) {
13554                 case LDKClosureReason_CounterpartyForceClosed: {
13555                         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
13556                         int64_t peer_msg_ref = 0;
13557                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
13558                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
13559                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_ref);
13560                 }
13561                 case LDKClosureReason_HolderForceClosed: {
13562                         return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
13563                 }
13564                 case LDKClosureReason_CooperativeClosure: {
13565                         return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
13566                 }
13567                 case LDKClosureReason_CommitmentTxConfirmed: {
13568                         return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
13569                 }
13570                 case LDKClosureReason_FundingTimedOut: {
13571                         return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
13572                 }
13573                 case LDKClosureReason_ProcessingError: {
13574                         LDKStr err_str = obj->processing_error.err;
13575                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
13576                         return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
13577                 }
13578                 case LDKClosureReason_DisconnectedPeer: {
13579                         return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
13580                 }
13581                 case LDKClosureReason_OutdatedChannelManager: {
13582                         return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
13583                 }
13584                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: {
13585                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth);
13586                 }
13587                 case LDKClosureReason_FundingBatchClosure: {
13588                         return (*env)->NewObject(env, LDKClosureReason_FundingBatchClosure_class, LDKClosureReason_FundingBatchClosure_meth);
13589                 }
13590                 default: abort();
13591         }
13592 }
13593 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
13594 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
13595 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
13596 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
13597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
13598         LDKCOption_ClosureReasonZ_Some_class =
13599                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
13600         CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
13601         LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
13602         CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
13603         LDKCOption_ClosureReasonZ_None_class =
13604                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
13605         CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
13606         LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
13607         CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
13608 }
13609 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13610         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
13611         switch(obj->tag) {
13612                 case LDKCOption_ClosureReasonZ_Some: {
13613                         int64_t some_ref = tag_ptr(&obj->some, false);
13614                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
13615                 }
13616                 case LDKCOption_ClosureReasonZ_None: {
13617                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
13618                 }
13619                 default: abort();
13620         }
13621 }
13622 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
13623 CHECK(owner->result_ok);
13624         return COption_ClosureReasonZ_clone(&*owner->contents.result);
13625 }
13626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13627         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
13628         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13629         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
13630         int64_t ret_ref = tag_ptr(ret_copy, true);
13631         return ret_ref;
13632 }
13633
13634 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
13635 CHECK(!owner->result_ok);
13636         return DecodeError_clone(&*owner->contents.err);
13637 }
13638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13639         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
13640         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13641         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
13642         int64_t ret_ref = tag_ptr(ret_copy, true);
13643         return ret_ref;
13644 }
13645
13646 static jclass LDKHTLCDestination_NextHopChannel_class = NULL;
13647 static jmethodID LDKHTLCDestination_NextHopChannel_meth = NULL;
13648 static jclass LDKHTLCDestination_UnknownNextHop_class = NULL;
13649 static jmethodID LDKHTLCDestination_UnknownNextHop_meth = NULL;
13650 static jclass LDKHTLCDestination_InvalidForward_class = NULL;
13651 static jmethodID LDKHTLCDestination_InvalidForward_meth = NULL;
13652 static jclass LDKHTLCDestination_FailedPayment_class = NULL;
13653 static jmethodID LDKHTLCDestination_FailedPayment_meth = NULL;
13654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCDestination_init (JNIEnv *env, jclass clz) {
13655         LDKHTLCDestination_NextHopChannel_class =
13656                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$NextHopChannel"));
13657         CHECK(LDKHTLCDestination_NextHopChannel_class != NULL);
13658         LDKHTLCDestination_NextHopChannel_meth = (*env)->GetMethodID(env, LDKHTLCDestination_NextHopChannel_class, "<init>", "([B[B)V");
13659         CHECK(LDKHTLCDestination_NextHopChannel_meth != NULL);
13660         LDKHTLCDestination_UnknownNextHop_class =
13661                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$UnknownNextHop"));
13662         CHECK(LDKHTLCDestination_UnknownNextHop_class != NULL);
13663         LDKHTLCDestination_UnknownNextHop_meth = (*env)->GetMethodID(env, LDKHTLCDestination_UnknownNextHop_class, "<init>", "(J)V");
13664         CHECK(LDKHTLCDestination_UnknownNextHop_meth != NULL);
13665         LDKHTLCDestination_InvalidForward_class =
13666                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$InvalidForward"));
13667         CHECK(LDKHTLCDestination_InvalidForward_class != NULL);
13668         LDKHTLCDestination_InvalidForward_meth = (*env)->GetMethodID(env, LDKHTLCDestination_InvalidForward_class, "<init>", "(J)V");
13669         CHECK(LDKHTLCDestination_InvalidForward_meth != NULL);
13670         LDKHTLCDestination_FailedPayment_class =
13671                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$FailedPayment"));
13672         CHECK(LDKHTLCDestination_FailedPayment_class != NULL);
13673         LDKHTLCDestination_FailedPayment_meth = (*env)->GetMethodID(env, LDKHTLCDestination_FailedPayment_class, "<init>", "([B)V");
13674         CHECK(LDKHTLCDestination_FailedPayment_meth != NULL);
13675 }
13676 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13677         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
13678         switch(obj->tag) {
13679                 case LDKHTLCDestination_NextHopChannel: {
13680                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
13681                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->next_hop_channel.node_id.compressed_form);
13682                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
13683                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->next_hop_channel.channel_id.data);
13684                         return (*env)->NewObject(env, LDKHTLCDestination_NextHopChannel_class, LDKHTLCDestination_NextHopChannel_meth, node_id_arr, channel_id_arr);
13685                 }
13686                 case LDKHTLCDestination_UnknownNextHop: {
13687                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
13688                         return (*env)->NewObject(env, LDKHTLCDestination_UnknownNextHop_class, LDKHTLCDestination_UnknownNextHop_meth, requested_forward_scid_conv);
13689                 }
13690                 case LDKHTLCDestination_InvalidForward: {
13691                         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
13692                         return (*env)->NewObject(env, LDKHTLCDestination_InvalidForward_class, LDKHTLCDestination_InvalidForward_meth, requested_forward_scid_conv);
13693                 }
13694                 case LDKHTLCDestination_FailedPayment: {
13695                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13696                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->failed_payment.payment_hash.data);
13697                         return (*env)->NewObject(env, LDKHTLCDestination_FailedPayment_class, LDKHTLCDestination_FailedPayment_meth, payment_hash_arr);
13698                 }
13699                 default: abort();
13700         }
13701 }
13702 static jclass LDKCOption_HTLCDestinationZ_Some_class = NULL;
13703 static jmethodID LDKCOption_HTLCDestinationZ_Some_meth = NULL;
13704 static jclass LDKCOption_HTLCDestinationZ_None_class = NULL;
13705 static jmethodID LDKCOption_HTLCDestinationZ_None_meth = NULL;
13706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCDestinationZ_init (JNIEnv *env, jclass clz) {
13707         LDKCOption_HTLCDestinationZ_Some_class =
13708                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$Some"));
13709         CHECK(LDKCOption_HTLCDestinationZ_Some_class != NULL);
13710         LDKCOption_HTLCDestinationZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_Some_class, "<init>", "(J)V");
13711         CHECK(LDKCOption_HTLCDestinationZ_Some_meth != NULL);
13712         LDKCOption_HTLCDestinationZ_None_class =
13713                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$None"));
13714         CHECK(LDKCOption_HTLCDestinationZ_None_class != NULL);
13715         LDKCOption_HTLCDestinationZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_None_class, "<init>", "()V");
13716         CHECK(LDKCOption_HTLCDestinationZ_None_meth != NULL);
13717 }
13718 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCDestinationZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13719         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
13720         switch(obj->tag) {
13721                 case LDKCOption_HTLCDestinationZ_Some: {
13722                         int64_t some_ref = tag_ptr(&obj->some, false);
13723                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_Some_class, LDKCOption_HTLCDestinationZ_Some_meth, some_ref);
13724                 }
13725                 case LDKCOption_HTLCDestinationZ_None: {
13726                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_None_class, LDKCOption_HTLCDestinationZ_None_meth);
13727                 }
13728                 default: abort();
13729         }
13730 }
13731 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
13732 CHECK(owner->result_ok);
13733         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
13734 }
13735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13736         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
13737         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13738         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
13739         int64_t ret_ref = tag_ptr(ret_copy, true);
13740         return ret_ref;
13741 }
13742
13743 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
13744 CHECK(!owner->result_ok);
13745         return DecodeError_clone(&*owner->contents.err);
13746 }
13747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13748         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
13749         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13750         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
13751         int64_t ret_ref = tag_ptr(ret_copy, true);
13752         return ret_ref;
13753 }
13754
13755 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
13756 CHECK(owner->result_ok);
13757         return PaymentFailureReason_clone(&*owner->contents.result);
13758 }
13759 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13760         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
13761         jclass ret_conv = LDKPaymentFailureReason_to_java(env, CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
13762         return ret_conv;
13763 }
13764
13765 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
13766 CHECK(!owner->result_ok);
13767         return DecodeError_clone(&*owner->contents.err);
13768 }
13769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13770         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
13771         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13772         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
13773         int64_t ret_ref = tag_ptr(ret_copy, true);
13774         return ret_ref;
13775 }
13776
13777 static jclass LDKCOption_U128Z_Some_class = NULL;
13778 static jmethodID LDKCOption_U128Z_Some_meth = NULL;
13779 static jclass LDKCOption_U128Z_None_class = NULL;
13780 static jmethodID LDKCOption_U128Z_None_meth = NULL;
13781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1U128Z_init (JNIEnv *env, jclass clz) {
13782         LDKCOption_U128Z_Some_class =
13783                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_U128Z$Some"));
13784         CHECK(LDKCOption_U128Z_Some_class != NULL);
13785         LDKCOption_U128Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_U128Z_Some_class, "<init>", "([B)V");
13786         CHECK(LDKCOption_U128Z_Some_meth != NULL);
13787         LDKCOption_U128Z_None_class =
13788                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_U128Z$None"));
13789         CHECK(LDKCOption_U128Z_None_class != NULL);
13790         LDKCOption_U128Z_None_meth = (*env)->GetMethodID(env, LDKCOption_U128Z_None_class, "<init>", "()V");
13791         CHECK(LDKCOption_U128Z_None_meth != NULL);
13792 }
13793 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1U128Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13794         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
13795         switch(obj->tag) {
13796                 case LDKCOption_U128Z_Some: {
13797                         int8_tArray some_arr = (*env)->NewByteArray(env, 16);
13798                         (*env)->SetByteArrayRegion(env, some_arr, 0, 16, obj->some.le_bytes);
13799                         return (*env)->NewObject(env, LDKCOption_U128Z_Some_class, LDKCOption_U128Z_Some_meth, some_arr);
13800                 }
13801                 case LDKCOption_U128Z_None: {
13802                         return (*env)->NewObject(env, LDKCOption_U128Z_None_class, LDKCOption_U128Z_None_meth);
13803                 }
13804                 default: abort();
13805         }
13806 }
13807 static inline LDKCVec_ClaimedHTLCZ CVec_ClaimedHTLCZ_clone(const LDKCVec_ClaimedHTLCZ *orig) {
13808         LDKCVec_ClaimedHTLCZ ret = { .data = MALLOC(sizeof(LDKClaimedHTLC) * orig->datalen, "LDKCVec_ClaimedHTLCZ clone bytes"), .datalen = orig->datalen };
13809         for (size_t i = 0; i < ret.datalen; i++) {
13810                 ret.data[i] = ClaimedHTLC_clone(&orig->data[i]);
13811         }
13812         return ret;
13813 }
13814 static jclass LDKCOption_PaymentFailureReasonZ_Some_class = NULL;
13815 static jmethodID LDKCOption_PaymentFailureReasonZ_Some_meth = NULL;
13816 static jclass LDKCOption_PaymentFailureReasonZ_None_class = NULL;
13817 static jmethodID LDKCOption_PaymentFailureReasonZ_None_meth = NULL;
13818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PaymentFailureReasonZ_init (JNIEnv *env, jclass clz) {
13819         LDKCOption_PaymentFailureReasonZ_Some_class =
13820                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentFailureReasonZ$Some"));
13821         CHECK(LDKCOption_PaymentFailureReasonZ_Some_class != NULL);
13822         LDKCOption_PaymentFailureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PaymentFailureReasonZ_Some_class, "<init>", "(Lorg/ldk/enums/PaymentFailureReason;)V");
13823         CHECK(LDKCOption_PaymentFailureReasonZ_Some_meth != NULL);
13824         LDKCOption_PaymentFailureReasonZ_None_class =
13825                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentFailureReasonZ$None"));
13826         CHECK(LDKCOption_PaymentFailureReasonZ_None_class != NULL);
13827         LDKCOption_PaymentFailureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PaymentFailureReasonZ_None_class, "<init>", "()V");
13828         CHECK(LDKCOption_PaymentFailureReasonZ_None_meth != NULL);
13829 }
13830 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PaymentFailureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13831         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
13832         switch(obj->tag) {
13833                 case LDKCOption_PaymentFailureReasonZ_Some: {
13834                         jclass some_conv = LDKPaymentFailureReason_to_java(env, obj->some);
13835                         return (*env)->NewObject(env, LDKCOption_PaymentFailureReasonZ_Some_class, LDKCOption_PaymentFailureReasonZ_Some_meth, some_conv);
13836                 }
13837                 case LDKCOption_PaymentFailureReasonZ_None: {
13838                         return (*env)->NewObject(env, LDKCOption_PaymentFailureReasonZ_None_class, LDKCOption_PaymentFailureReasonZ_None_meth);
13839                 }
13840                 default: abort();
13841         }
13842 }
13843 static jclass LDKBumpTransactionEvent_ChannelClose_class = NULL;
13844 static jmethodID LDKBumpTransactionEvent_ChannelClose_meth = NULL;
13845 static jclass LDKBumpTransactionEvent_HTLCResolution_class = NULL;
13846 static jmethodID LDKBumpTransactionEvent_HTLCResolution_meth = NULL;
13847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBumpTransactionEvent_init (JNIEnv *env, jclass clz) {
13848         LDKBumpTransactionEvent_ChannelClose_class =
13849                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBumpTransactionEvent$ChannelClose"));
13850         CHECK(LDKBumpTransactionEvent_ChannelClose_class != NULL);
13851         LDKBumpTransactionEvent_ChannelClose_meth = (*env)->GetMethodID(env, LDKBumpTransactionEvent_ChannelClose_class, "<init>", "([BI[BJJ[J)V");
13852         CHECK(LDKBumpTransactionEvent_ChannelClose_meth != NULL);
13853         LDKBumpTransactionEvent_HTLCResolution_class =
13854                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBumpTransactionEvent$HTLCResolution"));
13855         CHECK(LDKBumpTransactionEvent_HTLCResolution_class != NULL);
13856         LDKBumpTransactionEvent_HTLCResolution_meth = (*env)->GetMethodID(env, LDKBumpTransactionEvent_HTLCResolution_class, "<init>", "([BI[JI)V");
13857         CHECK(LDKBumpTransactionEvent_HTLCResolution_meth != NULL);
13858 }
13859 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBumpTransactionEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13860         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
13861         switch(obj->tag) {
13862                 case LDKBumpTransactionEvent_ChannelClose: {
13863                         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
13864                         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, obj->channel_close.claim_id.data);
13865                         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
13866                         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
13867                         int8_tArray commitment_tx_arr = (*env)->NewByteArray(env, commitment_tx_var.datalen);
13868                         (*env)->SetByteArrayRegion(env, commitment_tx_arr, 0, commitment_tx_var.datalen, commitment_tx_var.data);
13869                         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
13870                         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
13871                         int64_t anchor_descriptor_ref = 0;
13872                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
13873                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
13874                         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
13875                         int64_tArray pending_htlcs_arr = NULL;
13876                         pending_htlcs_arr = (*env)->NewLongArray(env, pending_htlcs_var.datalen);
13877                         int64_t *pending_htlcs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, pending_htlcs_arr, NULL);
13878                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
13879                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
13880                                 int64_t pending_htlcs_conv_24_ref = 0;
13881                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
13882                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
13883                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
13884                         }
13885                         (*env)->ReleasePrimitiveArrayCritical(env, pending_htlcs_arr, pending_htlcs_arr_ptr, 0);
13886                         return (*env)->NewObject(env, LDKBumpTransactionEvent_ChannelClose_class, LDKBumpTransactionEvent_ChannelClose_meth, claim_id_arr, package_target_feerate_sat_per_1000_weight_conv, commitment_tx_arr, commitment_tx_fee_satoshis_conv, anchor_descriptor_ref, pending_htlcs_arr);
13887                 }
13888                 case LDKBumpTransactionEvent_HTLCResolution: {
13889                         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
13890                         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, obj->htlc_resolution.claim_id.data);
13891                         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
13892                         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
13893                         int64_tArray htlc_descriptors_arr = NULL;
13894                         htlc_descriptors_arr = (*env)->NewLongArray(env, htlc_descriptors_var.datalen);
13895                         int64_t *htlc_descriptors_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, htlc_descriptors_arr, NULL);
13896                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
13897                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
13898                                 int64_t htlc_descriptors_conv_16_ref = 0;
13899                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
13900                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
13901                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
13902                         }
13903                         (*env)->ReleasePrimitiveArrayCritical(env, htlc_descriptors_arr, htlc_descriptors_arr_ptr, 0);
13904                         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
13905                         return (*env)->NewObject(env, LDKBumpTransactionEvent_HTLCResolution_class, LDKBumpTransactionEvent_HTLCResolution_meth, claim_id_arr, target_feerate_sat_per_1000_weight_conv, htlc_descriptors_arr, tx_lock_time_conv);
13906                 }
13907                 default: abort();
13908         }
13909 }
13910 static jclass LDKEvent_FundingGenerationReady_class = NULL;
13911 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
13912 static jclass LDKEvent_PaymentClaimable_class = NULL;
13913 static jmethodID LDKEvent_PaymentClaimable_meth = NULL;
13914 static jclass LDKEvent_PaymentClaimed_class = NULL;
13915 static jmethodID LDKEvent_PaymentClaimed_meth = NULL;
13916 static jclass LDKEvent_ConnectionNeeded_class = NULL;
13917 static jmethodID LDKEvent_ConnectionNeeded_meth = NULL;
13918 static jclass LDKEvent_InvoiceRequestFailed_class = NULL;
13919 static jmethodID LDKEvent_InvoiceRequestFailed_meth = NULL;
13920 static jclass LDKEvent_PaymentSent_class = NULL;
13921 static jmethodID LDKEvent_PaymentSent_meth = NULL;
13922 static jclass LDKEvent_PaymentFailed_class = NULL;
13923 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
13924 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
13925 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
13926 static jclass LDKEvent_PaymentPathFailed_class = NULL;
13927 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
13928 static jclass LDKEvent_ProbeSuccessful_class = NULL;
13929 static jmethodID LDKEvent_ProbeSuccessful_meth = NULL;
13930 static jclass LDKEvent_ProbeFailed_class = NULL;
13931 static jmethodID LDKEvent_ProbeFailed_meth = NULL;
13932 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
13933 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
13934 static jclass LDKEvent_HTLCIntercepted_class = NULL;
13935 static jmethodID LDKEvent_HTLCIntercepted_meth = NULL;
13936 static jclass LDKEvent_SpendableOutputs_class = NULL;
13937 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
13938 static jclass LDKEvent_PaymentForwarded_class = NULL;
13939 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
13940 static jclass LDKEvent_ChannelPending_class = NULL;
13941 static jmethodID LDKEvent_ChannelPending_meth = NULL;
13942 static jclass LDKEvent_ChannelReady_class = NULL;
13943 static jmethodID LDKEvent_ChannelReady_meth = NULL;
13944 static jclass LDKEvent_ChannelClosed_class = NULL;
13945 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
13946 static jclass LDKEvent_DiscardFunding_class = NULL;
13947 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
13948 static jclass LDKEvent_OpenChannelRequest_class = NULL;
13949 static jmethodID LDKEvent_OpenChannelRequest_meth = NULL;
13950 static jclass LDKEvent_HTLCHandlingFailed_class = NULL;
13951 static jmethodID LDKEvent_HTLCHandlingFailed_meth = NULL;
13952 static jclass LDKEvent_BumpTransaction_class = NULL;
13953 static jmethodID LDKEvent_BumpTransaction_meth = NULL;
13954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
13955         LDKEvent_FundingGenerationReady_class =
13956                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
13957         CHECK(LDKEvent_FundingGenerationReady_class != NULL);
13958         LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([B[BJ[B[B)V");
13959         CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
13960         LDKEvent_PaymentClaimable_class =
13961                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimable"));
13962         CHECK(LDKEvent_PaymentClaimable_class != NULL);
13963         LDKEvent_PaymentClaimable_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimable_class, "<init>", "([B[BJJJJJJJ)V");
13964         CHECK(LDKEvent_PaymentClaimable_meth != NULL);
13965         LDKEvent_PaymentClaimed_class =
13966                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimed"));
13967         CHECK(LDKEvent_PaymentClaimed_class != NULL);
13968         LDKEvent_PaymentClaimed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimed_class, "<init>", "([B[BJJ[JJ)V");
13969         CHECK(LDKEvent_PaymentClaimed_meth != NULL);
13970         LDKEvent_ConnectionNeeded_class =
13971                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ConnectionNeeded"));
13972         CHECK(LDKEvent_ConnectionNeeded_class != NULL);
13973         LDKEvent_ConnectionNeeded_meth = (*env)->GetMethodID(env, LDKEvent_ConnectionNeeded_class, "<init>", "([B[J)V");
13974         CHECK(LDKEvent_ConnectionNeeded_meth != NULL);
13975         LDKEvent_InvoiceRequestFailed_class =
13976                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$InvoiceRequestFailed"));
13977         CHECK(LDKEvent_InvoiceRequestFailed_class != NULL);
13978         LDKEvent_InvoiceRequestFailed_meth = (*env)->GetMethodID(env, LDKEvent_InvoiceRequestFailed_class, "<init>", "([B)V");
13979         CHECK(LDKEvent_InvoiceRequestFailed_meth != NULL);
13980         LDKEvent_PaymentSent_class =
13981                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
13982         CHECK(LDKEvent_PaymentSent_class != NULL);
13983         LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "(J[B[BJ)V");
13984         CHECK(LDKEvent_PaymentSent_meth != NULL);
13985         LDKEvent_PaymentFailed_class =
13986                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
13987         CHECK(LDKEvent_PaymentFailed_class != NULL);
13988         LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[BJ)V");
13989         CHECK(LDKEvent_PaymentFailed_meth != NULL);
13990         LDKEvent_PaymentPathSuccessful_class =
13991                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
13992         CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
13993         LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([BJJ)V");
13994         CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
13995         LDKEvent_PaymentPathFailed_class =
13996                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
13997         CHECK(LDKEvent_PaymentPathFailed_class != NULL);
13998         LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "(J[BZJJJ)V");
13999         CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
14000         LDKEvent_ProbeSuccessful_class =
14001                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeSuccessful"));
14002         CHECK(LDKEvent_ProbeSuccessful_class != NULL);
14003         LDKEvent_ProbeSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_ProbeSuccessful_class, "<init>", "([B[BJ)V");
14004         CHECK(LDKEvent_ProbeSuccessful_meth != NULL);
14005         LDKEvent_ProbeFailed_class =
14006                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeFailed"));
14007         CHECK(LDKEvent_ProbeFailed_class != NULL);
14008         LDKEvent_ProbeFailed_meth = (*env)->GetMethodID(env, LDKEvent_ProbeFailed_class, "<init>", "([B[BJJ)V");
14009         CHECK(LDKEvent_ProbeFailed_meth != NULL);
14010         LDKEvent_PendingHTLCsForwardable_class =
14011                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
14012         CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
14013         LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
14014         CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
14015         LDKEvent_HTLCIntercepted_class =
14016                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCIntercepted"));
14017         CHECK(LDKEvent_HTLCIntercepted_class != NULL);
14018         LDKEvent_HTLCIntercepted_meth = (*env)->GetMethodID(env, LDKEvent_HTLCIntercepted_class, "<init>", "([BJ[BJJ)V");
14019         CHECK(LDKEvent_HTLCIntercepted_meth != NULL);
14020         LDKEvent_SpendableOutputs_class =
14021                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
14022         CHECK(LDKEvent_SpendableOutputs_class != NULL);
14023         LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([JJ)V");
14024         CHECK(LDKEvent_SpendableOutputs_meth != NULL);
14025         LDKEvent_PaymentForwarded_class =
14026                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
14027         CHECK(LDKEvent_PaymentForwarded_class != NULL);
14028         LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JJJZJ)V");
14029         CHECK(LDKEvent_PaymentForwarded_meth != NULL);
14030         LDKEvent_ChannelPending_class =
14031                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelPending"));
14032         CHECK(LDKEvent_ChannelPending_class != NULL);
14033         LDKEvent_ChannelPending_meth = (*env)->GetMethodID(env, LDKEvent_ChannelPending_class, "<init>", "([B[BJ[BJ)V");
14034         CHECK(LDKEvent_ChannelPending_meth != NULL);
14035         LDKEvent_ChannelReady_class =
14036                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelReady"));
14037         CHECK(LDKEvent_ChannelReady_class != NULL);
14038         LDKEvent_ChannelReady_meth = (*env)->GetMethodID(env, LDKEvent_ChannelReady_class, "<init>", "([B[B[BJ)V");
14039         CHECK(LDKEvent_ChannelReady_meth != NULL);
14040         LDKEvent_ChannelClosed_class =
14041                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
14042         CHECK(LDKEvent_ChannelClosed_class != NULL);
14043         LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([B[BJ[BJJ)V");
14044         CHECK(LDKEvent_ChannelClosed_meth != NULL);
14045         LDKEvent_DiscardFunding_class =
14046                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
14047         CHECK(LDKEvent_DiscardFunding_class != NULL);
14048         LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
14049         CHECK(LDKEvent_DiscardFunding_meth != NULL);
14050         LDKEvent_OpenChannelRequest_class =
14051                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest"));
14052         CHECK(LDKEvent_OpenChannelRequest_class != NULL);
14053         LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "<init>", "([B[BJJJ)V");
14054         CHECK(LDKEvent_OpenChannelRequest_meth != NULL);
14055         LDKEvent_HTLCHandlingFailed_class =
14056                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCHandlingFailed"));
14057         CHECK(LDKEvent_HTLCHandlingFailed_class != NULL);
14058         LDKEvent_HTLCHandlingFailed_meth = (*env)->GetMethodID(env, LDKEvent_HTLCHandlingFailed_class, "<init>", "([BJ)V");
14059         CHECK(LDKEvent_HTLCHandlingFailed_meth != NULL);
14060         LDKEvent_BumpTransaction_class =
14061                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$BumpTransaction"));
14062         CHECK(LDKEvent_BumpTransaction_class != NULL);
14063         LDKEvent_BumpTransaction_meth = (*env)->GetMethodID(env, LDKEvent_BumpTransaction_class, "<init>", "(J)V");
14064         CHECK(LDKEvent_BumpTransaction_meth != NULL);
14065 }
14066 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14067         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
14068         switch(obj->tag) {
14069                 case LDKEvent_FundingGenerationReady: {
14070                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
14071                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
14072                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
14073                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->funding_generation_ready.counterparty_node_id.compressed_form);
14074                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
14075                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
14076                         int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
14077                         (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
14078                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
14079                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->funding_generation_ready.user_channel_id.le_bytes);
14080                         return (*env)->NewObject(env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, temporary_channel_id_arr, counterparty_node_id_arr, channel_value_satoshis_conv, output_script_arr, user_channel_id_arr);
14081                 }
14082                 case LDKEvent_PaymentClaimable: {
14083                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
14084                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimable.receiver_node_id.compressed_form);
14085                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14086                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimable.payment_hash.data);
14087                         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
14088                         int64_t onion_fields_ref = 0;
14089                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
14090                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
14091                         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
14092                         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
14093                         int64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
14094                         int64_t via_channel_id_ref = tag_ptr(&obj->payment_claimable.via_channel_id, false);
14095                         int64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
14096                         int64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
14097                         return (*env)->NewObject(env, LDKEvent_PaymentClaimable_class, LDKEvent_PaymentClaimable_meth, receiver_node_id_arr, payment_hash_arr, onion_fields_ref, amount_msat_conv, counterparty_skimmed_fee_msat_conv, purpose_ref, via_channel_id_ref, via_user_channel_id_ref, claim_deadline_ref);
14098                 }
14099                 case LDKEvent_PaymentClaimed: {
14100                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
14101                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimed.receiver_node_id.compressed_form);
14102                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14103                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimed.payment_hash.data);
14104                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
14105                         int64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
14106                         LDKCVec_ClaimedHTLCZ htlcs_var = obj->payment_claimed.htlcs;
14107                         int64_tArray htlcs_arr = NULL;
14108                         htlcs_arr = (*env)->NewLongArray(env, htlcs_var.datalen);
14109                         int64_t *htlcs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, htlcs_arr, NULL);
14110                         for (size_t n = 0; n < htlcs_var.datalen; n++) {
14111                                 LDKClaimedHTLC htlcs_conv_13_var = htlcs_var.data[n];
14112                                 int64_t htlcs_conv_13_ref = 0;
14113                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_var);
14114                                 htlcs_conv_13_ref = tag_ptr(htlcs_conv_13_var.inner, false);
14115                                 htlcs_arr_ptr[n] = htlcs_conv_13_ref;
14116                         }
14117                         (*env)->ReleasePrimitiveArrayCritical(env, htlcs_arr, htlcs_arr_ptr, 0);
14118                         int64_t sender_intended_total_msat_ref = tag_ptr(&obj->payment_claimed.sender_intended_total_msat, false);
14119                         return (*env)->NewObject(env, LDKEvent_PaymentClaimed_class, LDKEvent_PaymentClaimed_meth, receiver_node_id_arr, payment_hash_arr, amount_msat_conv, purpose_ref, htlcs_arr, sender_intended_total_msat_ref);
14120                 }
14121                 case LDKEvent_ConnectionNeeded: {
14122                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
14123                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->connection_needed.node_id.compressed_form);
14124                         LDKCVec_SocketAddressZ addresses_var = obj->connection_needed.addresses;
14125                         int64_tArray addresses_arr = NULL;
14126                         addresses_arr = (*env)->NewLongArray(env, addresses_var.datalen);
14127                         int64_t *addresses_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, addresses_arr, NULL);
14128                         for (size_t p = 0; p < addresses_var.datalen; p++) {
14129                                 int64_t addresses_conv_15_ref = tag_ptr(&addresses_var.data[p], false);
14130                                 addresses_arr_ptr[p] = addresses_conv_15_ref;
14131                         }
14132                         (*env)->ReleasePrimitiveArrayCritical(env, addresses_arr, addresses_arr_ptr, 0);
14133                         return (*env)->NewObject(env, LDKEvent_ConnectionNeeded_class, LDKEvent_ConnectionNeeded_meth, node_id_arr, addresses_arr);
14134                 }
14135                 case LDKEvent_InvoiceRequestFailed: {
14136                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
14137                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->invoice_request_failed.payment_id.data);
14138                         return (*env)->NewObject(env, LDKEvent_InvoiceRequestFailed_class, LDKEvent_InvoiceRequestFailed_meth, payment_id_arr);
14139                 }
14140                 case LDKEvent_PaymentSent: {
14141                         int64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
14142                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
14143                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
14144                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14145                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
14146                         int64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
14147                         return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_ref, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
14148                 }
14149                 case LDKEvent_PaymentFailed: {
14150                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
14151                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
14152                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14153                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
14154                         int64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
14155                         return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr, reason_ref);
14156                 }
14157                 case LDKEvent_PaymentPathSuccessful: {
14158                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
14159                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
14160                         int64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
14161                         LDKPath path_var = obj->payment_path_successful.path;
14162                         int64_t path_ref = 0;
14163                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
14164                         path_ref = tag_ptr(path_var.inner, false);
14165                         return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_ref, path_ref);
14166                 }
14167                 case LDKEvent_PaymentPathFailed: {
14168                         int64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
14169                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14170                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
14171                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
14172                         int64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
14173                         LDKPath path_var = obj->payment_path_failed.path;
14174                         int64_t path_ref = 0;
14175                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
14176                         path_ref = tag_ptr(path_var.inner, false);
14177                         int64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
14178                         return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_id_ref, payment_hash_arr, payment_failed_permanently_conv, failure_ref, path_ref, short_channel_id_ref);
14179                 }
14180                 case LDKEvent_ProbeSuccessful: {
14181                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
14182                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_successful.payment_id.data);
14183                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14184                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_successful.payment_hash.data);
14185                         LDKPath path_var = obj->probe_successful.path;
14186                         int64_t path_ref = 0;
14187                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
14188                         path_ref = tag_ptr(path_var.inner, false);
14189                         return (*env)->NewObject(env, LDKEvent_ProbeSuccessful_class, LDKEvent_ProbeSuccessful_meth, payment_id_arr, payment_hash_arr, path_ref);
14190                 }
14191                 case LDKEvent_ProbeFailed: {
14192                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
14193                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_failed.payment_id.data);
14194                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14195                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_failed.payment_hash.data);
14196                         LDKPath path_var = obj->probe_failed.path;
14197                         int64_t path_ref = 0;
14198                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
14199                         path_ref = tag_ptr(path_var.inner, false);
14200                         int64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
14201                         return (*env)->NewObject(env, LDKEvent_ProbeFailed_class, LDKEvent_ProbeFailed_meth, payment_id_arr, payment_hash_arr, path_ref, short_channel_id_ref);
14202                 }
14203                 case LDKEvent_PendingHTLCsForwardable: {
14204                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
14205                         return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, time_forwardable_conv);
14206                 }
14207                 case LDKEvent_HTLCIntercepted: {
14208                         int8_tArray intercept_id_arr = (*env)->NewByteArray(env, 32);
14209                         (*env)->SetByteArrayRegion(env, intercept_id_arr, 0, 32, obj->htlc_intercepted.intercept_id.data);
14210                         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
14211                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14212                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->htlc_intercepted.payment_hash.data);
14213                         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
14214                         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
14215                         return (*env)->NewObject(env, LDKEvent_HTLCIntercepted_class, LDKEvent_HTLCIntercepted_meth, intercept_id_arr, requested_next_hop_scid_conv, payment_hash_arr, inbound_amount_msat_conv, expected_outbound_amount_msat_conv);
14216                 }
14217                 case LDKEvent_SpendableOutputs: {
14218                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
14219                         int64_tArray outputs_arr = NULL;
14220                         outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
14221                         int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
14222                         for (size_t b = 0; b < outputs_var.datalen; b++) {
14223                                 int64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
14224                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
14225                         }
14226                         (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
14227                         int64_t channel_id_ref = tag_ptr(&obj->spendable_outputs.channel_id, false);
14228                         return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr, channel_id_ref);
14229                 }
14230                 case LDKEvent_PaymentForwarded: {
14231                         int64_t prev_channel_id_ref = tag_ptr(&obj->payment_forwarded.prev_channel_id, false);
14232                         int64_t next_channel_id_ref = tag_ptr(&obj->payment_forwarded.next_channel_id, false);
14233                         int64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
14234                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
14235                         int64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
14236                         return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_ref, claim_from_onchain_tx_conv, outbound_amount_forwarded_msat_ref);
14237                 }
14238                 case LDKEvent_ChannelPending: {
14239                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
14240                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_pending.channel_id.data);
14241                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
14242                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_pending.user_channel_id.le_bytes);
14243                         int64_t former_temporary_channel_id_ref = tag_ptr(&obj->channel_pending.former_temporary_channel_id, false);
14244                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
14245                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_pending.counterparty_node_id.compressed_form);
14246                         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
14247                         int64_t funding_txo_ref = 0;
14248                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
14249                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
14250                         return (*env)->NewObject(env, LDKEvent_ChannelPending_class, LDKEvent_ChannelPending_meth, channel_id_arr, user_channel_id_arr, former_temporary_channel_id_ref, counterparty_node_id_arr, funding_txo_ref);
14251                 }
14252                 case LDKEvent_ChannelReady: {
14253                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
14254                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_ready.channel_id.data);
14255                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
14256                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_ready.user_channel_id.le_bytes);
14257                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
14258                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_ready.counterparty_node_id.compressed_form);
14259                         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
14260                         int64_t channel_type_ref = 0;
14261                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
14262                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
14263                         return (*env)->NewObject(env, LDKEvent_ChannelReady_class, LDKEvent_ChannelReady_meth, channel_id_arr, user_channel_id_arr, counterparty_node_id_arr, channel_type_ref);
14264                 }
14265                 case LDKEvent_ChannelClosed: {
14266                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
14267                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
14268                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
14269                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_closed.user_channel_id.le_bytes);
14270                         int64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
14271                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
14272                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_closed.counterparty_node_id.compressed_form);
14273                         int64_t channel_capacity_sats_ref = tag_ptr(&obj->channel_closed.channel_capacity_sats, false);
14274                         LDKOutPoint channel_funding_txo_var = obj->channel_closed.channel_funding_txo;
14275                         int64_t channel_funding_txo_ref = 0;
14276                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_var);
14277                         channel_funding_txo_ref = tag_ptr(channel_funding_txo_var.inner, false);
14278                         return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, user_channel_id_arr, reason_ref, counterparty_node_id_arr, channel_capacity_sats_ref, channel_funding_txo_ref);
14279                 }
14280                 case LDKEvent_DiscardFunding: {
14281                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
14282                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
14283                         LDKTransaction transaction_var = obj->discard_funding.transaction;
14284                         int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
14285                         (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
14286                         return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
14287                 }
14288                 case LDKEvent_OpenChannelRequest: {
14289                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
14290                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data);
14291                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
14292                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form);
14293                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
14294                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
14295                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
14296                         int64_t channel_type_ref = 0;
14297                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
14298                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
14299                         return (*env)->NewObject(env, LDKEvent_OpenChannelRequest_class, LDKEvent_OpenChannelRequest_meth, temporary_channel_id_arr, counterparty_node_id_arr, funding_satoshis_conv, push_msat_conv, channel_type_ref);
14300                 }
14301                 case LDKEvent_HTLCHandlingFailed: {
14302                         int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
14303                         (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->htlc_handling_failed.prev_channel_id.data);
14304                         int64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
14305                         return (*env)->NewObject(env, LDKEvent_HTLCHandlingFailed_class, LDKEvent_HTLCHandlingFailed_meth, prev_channel_id_arr, failed_next_destination_ref);
14306                 }
14307                 case LDKEvent_BumpTransaction: {
14308                         int64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
14309                         return (*env)->NewObject(env, LDKEvent_BumpTransaction_class, LDKEvent_BumpTransaction_meth, bump_transaction_ref);
14310                 }
14311                 default: abort();
14312         }
14313 }
14314 static jclass LDKCOption_EventZ_Some_class = NULL;
14315 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
14316 static jclass LDKCOption_EventZ_None_class = NULL;
14317 static jmethodID LDKCOption_EventZ_None_meth = NULL;
14318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
14319         LDKCOption_EventZ_Some_class =
14320                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
14321         CHECK(LDKCOption_EventZ_Some_class != NULL);
14322         LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
14323         CHECK(LDKCOption_EventZ_Some_meth != NULL);
14324         LDKCOption_EventZ_None_class =
14325                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
14326         CHECK(LDKCOption_EventZ_None_class != NULL);
14327         LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
14328         CHECK(LDKCOption_EventZ_None_meth != NULL);
14329 }
14330 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14331         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
14332         switch(obj->tag) {
14333                 case LDKCOption_EventZ_Some: {
14334                         int64_t some_ref = tag_ptr(&obj->some, false);
14335                         return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
14336                 }
14337                 case LDKCOption_EventZ_None: {
14338                         return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
14339                 }
14340                 default: abort();
14341         }
14342 }
14343 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
14344 CHECK(owner->result_ok);
14345         return COption_EventZ_clone(&*owner->contents.result);
14346 }
14347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14348         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
14349         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
14350         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
14351         int64_t ret_ref = tag_ptr(ret_copy, true);
14352         return ret_ref;
14353 }
14354
14355 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
14356 CHECK(!owner->result_ok);
14357         return DecodeError_clone(&*owner->contents.err);
14358 }
14359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14360         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
14361         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14362         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
14363         int64_t ret_ref = tag_ptr(ret_copy, true);
14364         return ret_ref;
14365 }
14366
14367 static jclass LDKBolt11ParseError_Bech32Error_class = NULL;
14368 static jmethodID LDKBolt11ParseError_Bech32Error_meth = NULL;
14369 static jclass LDKBolt11ParseError_ParseAmountError_class = NULL;
14370 static jmethodID LDKBolt11ParseError_ParseAmountError_meth = NULL;
14371 static jclass LDKBolt11ParseError_MalformedSignature_class = NULL;
14372 static jmethodID LDKBolt11ParseError_MalformedSignature_meth = NULL;
14373 static jclass LDKBolt11ParseError_BadPrefix_class = NULL;
14374 static jmethodID LDKBolt11ParseError_BadPrefix_meth = NULL;
14375 static jclass LDKBolt11ParseError_UnknownCurrency_class = NULL;
14376 static jmethodID LDKBolt11ParseError_UnknownCurrency_meth = NULL;
14377 static jclass LDKBolt11ParseError_UnknownSiPrefix_class = NULL;
14378 static jmethodID LDKBolt11ParseError_UnknownSiPrefix_meth = NULL;
14379 static jclass LDKBolt11ParseError_MalformedHRP_class = NULL;
14380 static jmethodID LDKBolt11ParseError_MalformedHRP_meth = NULL;
14381 static jclass LDKBolt11ParseError_TooShortDataPart_class = NULL;
14382 static jmethodID LDKBolt11ParseError_TooShortDataPart_meth = NULL;
14383 static jclass LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class = NULL;
14384 static jmethodID LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth = NULL;
14385 static jclass LDKBolt11ParseError_DescriptionDecodeError_class = NULL;
14386 static jmethodID LDKBolt11ParseError_DescriptionDecodeError_meth = NULL;
14387 static jclass LDKBolt11ParseError_PaddingError_class = NULL;
14388 static jmethodID LDKBolt11ParseError_PaddingError_meth = NULL;
14389 static jclass LDKBolt11ParseError_IntegerOverflowError_class = NULL;
14390 static jmethodID LDKBolt11ParseError_IntegerOverflowError_meth = NULL;
14391 static jclass LDKBolt11ParseError_InvalidSegWitProgramLength_class = NULL;
14392 static jmethodID LDKBolt11ParseError_InvalidSegWitProgramLength_meth = NULL;
14393 static jclass LDKBolt11ParseError_InvalidPubKeyHashLength_class = NULL;
14394 static jmethodID LDKBolt11ParseError_InvalidPubKeyHashLength_meth = NULL;
14395 static jclass LDKBolt11ParseError_InvalidScriptHashLength_class = NULL;
14396 static jmethodID LDKBolt11ParseError_InvalidScriptHashLength_meth = NULL;
14397 static jclass LDKBolt11ParseError_InvalidRecoveryId_class = NULL;
14398 static jmethodID LDKBolt11ParseError_InvalidRecoveryId_meth = NULL;
14399 static jclass LDKBolt11ParseError_InvalidSliceLength_class = NULL;
14400 static jmethodID LDKBolt11ParseError_InvalidSliceLength_meth = NULL;
14401 static jclass LDKBolt11ParseError_Skip_class = NULL;
14402 static jmethodID LDKBolt11ParseError_Skip_meth = NULL;
14403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBolt11ParseError_init (JNIEnv *env, jclass clz) {
14404         LDKBolt11ParseError_Bech32Error_class =
14405                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$Bech32Error"));
14406         CHECK(LDKBolt11ParseError_Bech32Error_class != NULL);
14407         LDKBolt11ParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_Bech32Error_class, "<init>", "(J)V");
14408         CHECK(LDKBolt11ParseError_Bech32Error_meth != NULL);
14409         LDKBolt11ParseError_ParseAmountError_class =
14410                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$ParseAmountError"));
14411         CHECK(LDKBolt11ParseError_ParseAmountError_class != NULL);
14412         LDKBolt11ParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_ParseAmountError_class, "<init>", "(I)V");
14413         CHECK(LDKBolt11ParseError_ParseAmountError_meth != NULL);
14414         LDKBolt11ParseError_MalformedSignature_class =
14415                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$MalformedSignature"));
14416         CHECK(LDKBolt11ParseError_MalformedSignature_class != NULL);
14417         LDKBolt11ParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_MalformedSignature_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
14418         CHECK(LDKBolt11ParseError_MalformedSignature_meth != NULL);
14419         LDKBolt11ParseError_BadPrefix_class =
14420                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$BadPrefix"));
14421         CHECK(LDKBolt11ParseError_BadPrefix_class != NULL);
14422         LDKBolt11ParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_BadPrefix_class, "<init>", "()V");
14423         CHECK(LDKBolt11ParseError_BadPrefix_meth != NULL);
14424         LDKBolt11ParseError_UnknownCurrency_class =
14425                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnknownCurrency"));
14426         CHECK(LDKBolt11ParseError_UnknownCurrency_class != NULL);
14427         LDKBolt11ParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnknownCurrency_class, "<init>", "()V");
14428         CHECK(LDKBolt11ParseError_UnknownCurrency_meth != NULL);
14429         LDKBolt11ParseError_UnknownSiPrefix_class =
14430                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnknownSiPrefix"));
14431         CHECK(LDKBolt11ParseError_UnknownSiPrefix_class != NULL);
14432         LDKBolt11ParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnknownSiPrefix_class, "<init>", "()V");
14433         CHECK(LDKBolt11ParseError_UnknownSiPrefix_meth != NULL);
14434         LDKBolt11ParseError_MalformedHRP_class =
14435                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$MalformedHRP"));
14436         CHECK(LDKBolt11ParseError_MalformedHRP_class != NULL);
14437         LDKBolt11ParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_MalformedHRP_class, "<init>", "()V");
14438         CHECK(LDKBolt11ParseError_MalformedHRP_meth != NULL);
14439         LDKBolt11ParseError_TooShortDataPart_class =
14440                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$TooShortDataPart"));
14441         CHECK(LDKBolt11ParseError_TooShortDataPart_class != NULL);
14442         LDKBolt11ParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_TooShortDataPart_class, "<init>", "()V");
14443         CHECK(LDKBolt11ParseError_TooShortDataPart_meth != NULL);
14444         LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class =
14445                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnexpectedEndOfTaggedFields"));
14446         CHECK(LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class != NULL);
14447         LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class, "<init>", "()V");
14448         CHECK(LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth != NULL);
14449         LDKBolt11ParseError_DescriptionDecodeError_class =
14450                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$DescriptionDecodeError"));
14451         CHECK(LDKBolt11ParseError_DescriptionDecodeError_class != NULL);
14452         LDKBolt11ParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_DescriptionDecodeError_class, "<init>", "(I)V");
14453         CHECK(LDKBolt11ParseError_DescriptionDecodeError_meth != NULL);
14454         LDKBolt11ParseError_PaddingError_class =
14455                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$PaddingError"));
14456         CHECK(LDKBolt11ParseError_PaddingError_class != NULL);
14457         LDKBolt11ParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_PaddingError_class, "<init>", "()V");
14458         CHECK(LDKBolt11ParseError_PaddingError_meth != NULL);
14459         LDKBolt11ParseError_IntegerOverflowError_class =
14460                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$IntegerOverflowError"));
14461         CHECK(LDKBolt11ParseError_IntegerOverflowError_class != NULL);
14462         LDKBolt11ParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_IntegerOverflowError_class, "<init>", "()V");
14463         CHECK(LDKBolt11ParseError_IntegerOverflowError_meth != NULL);
14464         LDKBolt11ParseError_InvalidSegWitProgramLength_class =
14465                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidSegWitProgramLength"));
14466         CHECK(LDKBolt11ParseError_InvalidSegWitProgramLength_class != NULL);
14467         LDKBolt11ParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidSegWitProgramLength_class, "<init>", "()V");
14468         CHECK(LDKBolt11ParseError_InvalidSegWitProgramLength_meth != NULL);
14469         LDKBolt11ParseError_InvalidPubKeyHashLength_class =
14470                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidPubKeyHashLength"));
14471         CHECK(LDKBolt11ParseError_InvalidPubKeyHashLength_class != NULL);
14472         LDKBolt11ParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidPubKeyHashLength_class, "<init>", "()V");
14473         CHECK(LDKBolt11ParseError_InvalidPubKeyHashLength_meth != NULL);
14474         LDKBolt11ParseError_InvalidScriptHashLength_class =
14475                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidScriptHashLength"));
14476         CHECK(LDKBolt11ParseError_InvalidScriptHashLength_class != NULL);
14477         LDKBolt11ParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidScriptHashLength_class, "<init>", "()V");
14478         CHECK(LDKBolt11ParseError_InvalidScriptHashLength_meth != NULL);
14479         LDKBolt11ParseError_InvalidRecoveryId_class =
14480                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidRecoveryId"));
14481         CHECK(LDKBolt11ParseError_InvalidRecoveryId_class != NULL);
14482         LDKBolt11ParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidRecoveryId_class, "<init>", "()V");
14483         CHECK(LDKBolt11ParseError_InvalidRecoveryId_meth != NULL);
14484         LDKBolt11ParseError_InvalidSliceLength_class =
14485                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidSliceLength"));
14486         CHECK(LDKBolt11ParseError_InvalidSliceLength_class != NULL);
14487         LDKBolt11ParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidSliceLength_class, "<init>", "(Ljava/lang/String;)V");
14488         CHECK(LDKBolt11ParseError_InvalidSliceLength_meth != NULL);
14489         LDKBolt11ParseError_Skip_class =
14490                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$Skip"));
14491         CHECK(LDKBolt11ParseError_Skip_class != NULL);
14492         LDKBolt11ParseError_Skip_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_Skip_class, "<init>", "()V");
14493         CHECK(LDKBolt11ParseError_Skip_meth != NULL);
14494 }
14495 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBolt11ParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14496         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
14497         switch(obj->tag) {
14498                 case LDKBolt11ParseError_Bech32Error: {
14499                         int64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
14500                         return (*env)->NewObject(env, LDKBolt11ParseError_Bech32Error_class, LDKBolt11ParseError_Bech32Error_meth, bech32_error_ref);
14501                 }
14502                 case LDKBolt11ParseError_ParseAmountError: {
14503                         /*obj->parse_amount_error*/
14504                         return (*env)->NewObject(env, LDKBolt11ParseError_ParseAmountError_class, LDKBolt11ParseError_ParseAmountError_meth, 0);
14505                 }
14506                 case LDKBolt11ParseError_MalformedSignature: {
14507                         jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature);
14508                         return (*env)->NewObject(env, LDKBolt11ParseError_MalformedSignature_class, LDKBolt11ParseError_MalformedSignature_meth, malformed_signature_conv);
14509                 }
14510                 case LDKBolt11ParseError_BadPrefix: {
14511                         return (*env)->NewObject(env, LDKBolt11ParseError_BadPrefix_class, LDKBolt11ParseError_BadPrefix_meth);
14512                 }
14513                 case LDKBolt11ParseError_UnknownCurrency: {
14514                         return (*env)->NewObject(env, LDKBolt11ParseError_UnknownCurrency_class, LDKBolt11ParseError_UnknownCurrency_meth);
14515                 }
14516                 case LDKBolt11ParseError_UnknownSiPrefix: {
14517                         return (*env)->NewObject(env, LDKBolt11ParseError_UnknownSiPrefix_class, LDKBolt11ParseError_UnknownSiPrefix_meth);
14518                 }
14519                 case LDKBolt11ParseError_MalformedHRP: {
14520                         return (*env)->NewObject(env, LDKBolt11ParseError_MalformedHRP_class, LDKBolt11ParseError_MalformedHRP_meth);
14521                 }
14522                 case LDKBolt11ParseError_TooShortDataPart: {
14523                         return (*env)->NewObject(env, LDKBolt11ParseError_TooShortDataPart_class, LDKBolt11ParseError_TooShortDataPart_meth);
14524                 }
14525                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: {
14526                         return (*env)->NewObject(env, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth);
14527                 }
14528                 case LDKBolt11ParseError_DescriptionDecodeError: {
14529                         /*obj->description_decode_error*/
14530                         return (*env)->NewObject(env, LDKBolt11ParseError_DescriptionDecodeError_class, LDKBolt11ParseError_DescriptionDecodeError_meth, 0);
14531                 }
14532                 case LDKBolt11ParseError_PaddingError: {
14533                         return (*env)->NewObject(env, LDKBolt11ParseError_PaddingError_class, LDKBolt11ParseError_PaddingError_meth);
14534                 }
14535                 case LDKBolt11ParseError_IntegerOverflowError: {
14536                         return (*env)->NewObject(env, LDKBolt11ParseError_IntegerOverflowError_class, LDKBolt11ParseError_IntegerOverflowError_meth);
14537                 }
14538                 case LDKBolt11ParseError_InvalidSegWitProgramLength: {
14539                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidSegWitProgramLength_class, LDKBolt11ParseError_InvalidSegWitProgramLength_meth);
14540                 }
14541                 case LDKBolt11ParseError_InvalidPubKeyHashLength: {
14542                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidPubKeyHashLength_class, LDKBolt11ParseError_InvalidPubKeyHashLength_meth);
14543                 }
14544                 case LDKBolt11ParseError_InvalidScriptHashLength: {
14545                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidScriptHashLength_class, LDKBolt11ParseError_InvalidScriptHashLength_meth);
14546                 }
14547                 case LDKBolt11ParseError_InvalidRecoveryId: {
14548                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidRecoveryId_class, LDKBolt11ParseError_InvalidRecoveryId_meth);
14549                 }
14550                 case LDKBolt11ParseError_InvalidSliceLength: {
14551                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
14552                         jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len);
14553                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidSliceLength_class, LDKBolt11ParseError_InvalidSliceLength_meth, invalid_slice_length_conv);
14554                 }
14555                 case LDKBolt11ParseError_Skip: {
14556                         return (*env)->NewObject(env, LDKBolt11ParseError_Skip_class, LDKBolt11ParseError_Skip_meth);
14557                 }
14558                 default: abort();
14559         }
14560 }
14561 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
14562 CHECK(owner->result_ok);
14563         return SiPrefix_clone(&*owner->contents.result);
14564 }
14565 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14566         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
14567         jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
14568         return ret_conv;
14569 }
14570
14571 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
14572 CHECK(!owner->result_ok);
14573         return Bolt11ParseError_clone(&*owner->contents.err);
14574 }
14575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14576         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
14577         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
14578         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
14579         int64_t ret_ref = tag_ptr(ret_copy, true);
14580         return ret_ref;
14581 }
14582
14583 static jclass LDKParseOrSemanticError_ParseError_class = NULL;
14584 static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL;
14585 static jclass LDKParseOrSemanticError_SemanticError_class = NULL;
14586 static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL;
14587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) {
14588         LDKParseOrSemanticError_ParseError_class =
14589                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError"));
14590         CHECK(LDKParseOrSemanticError_ParseError_class != NULL);
14591         LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "<init>", "(J)V");
14592         CHECK(LDKParseOrSemanticError_ParseError_meth != NULL);
14593         LDKParseOrSemanticError_SemanticError_class =
14594                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError"));
14595         CHECK(LDKParseOrSemanticError_SemanticError_class != NULL);
14596         LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "<init>", "(Lorg/ldk/enums/Bolt11SemanticError;)V");
14597         CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL);
14598 }
14599 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14600         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
14601         switch(obj->tag) {
14602                 case LDKParseOrSemanticError_ParseError: {
14603                         int64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
14604                         return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref);
14605                 }
14606                 case LDKParseOrSemanticError_SemanticError: {
14607                         jclass semantic_error_conv = LDKBolt11SemanticError_to_java(env, obj->semantic_error);
14608                         return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv);
14609                 }
14610                 default: abort();
14611         }
14612 }
14613 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
14614         LDKBolt11Invoice ret = *owner->contents.result;
14615         ret.is_owned = false;
14616         return ret;
14617 }
14618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14619         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
14620         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
14621         int64_t ret_ref = 0;
14622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14624         return ret_ref;
14625 }
14626
14627 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
14628 CHECK(!owner->result_ok);
14629         return ParseOrSemanticError_clone(&*owner->contents.err);
14630 }
14631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14632         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
14633         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
14634         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
14635         int64_t ret_ref = tag_ptr(ret_copy, true);
14636         return ret_ref;
14637 }
14638
14639 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
14640         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
14641         ret.is_owned = false;
14642         return ret;
14643 }
14644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14645         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
14646         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
14647         int64_t ret_ref = 0;
14648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14650         return ret_ref;
14651 }
14652
14653 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
14654 CHECK(!owner->result_ok);
14655         return Bolt11ParseError_clone(&*owner->contents.err);
14656 }
14657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14658         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
14659         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
14660         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
14661         int64_t ret_ref = tag_ptr(ret_copy, true);
14662         return ret_ref;
14663 }
14664
14665 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
14666         LDKRawBolt11Invoice ret = owner->a;
14667         ret.is_owned = false;
14668         return ret;
14669 }
14670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
14671         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
14672         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
14673         int64_t ret_ref = 0;
14674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14676         return ret_ref;
14677 }
14678
14679 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
14680         return ThirtyTwoBytes_clone(&owner->b);
14681 }
14682 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
14683         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
14684         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14685         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data);
14686         return ret_arr;
14687 }
14688
14689 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
14690         LDKBolt11InvoiceSignature ret = owner->c;
14691         ret.is_owned = false;
14692         return ret;
14693 }
14694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
14695         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
14696         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
14697         int64_t ret_ref = 0;
14698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14700         return ret_ref;
14701 }
14702
14703 static inline struct LDKPayeePubKey CResult_PayeePubKeySecp256k1ErrorZ_get_ok(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
14704         LDKPayeePubKey ret = *owner->contents.result;
14705         ret.is_owned = false;
14706         return ret;
14707 }
14708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14709         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
14710         LDKPayeePubKey ret_var = CResult_PayeePubKeySecp256k1ErrorZ_get_ok(owner_conv);
14711         int64_t ret_ref = 0;
14712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14714         return ret_ref;
14715 }
14716
14717 static inline enum LDKSecp256k1Error CResult_PayeePubKeySecp256k1ErrorZ_get_err(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
14718 CHECK(!owner->result_ok);
14719         return *owner->contents.err;
14720 }
14721 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14722         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
14723         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeySecp256k1ErrorZ_get_err(owner_conv));
14724         return ret_conv;
14725 }
14726
14727 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
14728         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
14729         for (size_t i = 0; i < ret.datalen; i++) {
14730                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
14731         }
14732         return ret;
14733 }
14734 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
14735         LDKPositiveTimestamp ret = *owner->contents.result;
14736         ret.is_owned = false;
14737         return ret;
14738 }
14739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14740         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
14741         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
14742         int64_t ret_ref = 0;
14743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14745         return ret_ref;
14746 }
14747
14748 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
14749 CHECK(!owner->result_ok);
14750         return CreationError_clone(&*owner->contents.err);
14751 }
14752 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14753         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
14754         jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
14755         return ret_conv;
14756 }
14757
14758 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
14759 CHECK(owner->result_ok);
14760         return *owner->contents.result;
14761 }
14762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14763         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
14764         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
14765 }
14766
14767 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
14768 CHECK(!owner->result_ok);
14769         return Bolt11SemanticError_clone(&*owner->contents.err);
14770 }
14771 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14772         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
14773         jclass ret_conv = LDKBolt11SemanticError_to_java(env, CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
14774         return ret_conv;
14775 }
14776
14777 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
14778         LDKBolt11Invoice ret = *owner->contents.result;
14779         ret.is_owned = false;
14780         return ret;
14781 }
14782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14783         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
14784         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
14785         int64_t ret_ref = 0;
14786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14788         return ret_ref;
14789 }
14790
14791 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
14792 CHECK(!owner->result_ok);
14793         return Bolt11SemanticError_clone(&*owner->contents.err);
14794 }
14795 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14796         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
14797         jclass ret_conv = LDKBolt11SemanticError_to_java(env, CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
14798         return ret_conv;
14799 }
14800
14801 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
14802         LDKDescription ret = *owner->contents.result;
14803         ret.is_owned = false;
14804         return ret;
14805 }
14806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14807         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
14808         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
14809         int64_t ret_ref = 0;
14810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14812         return ret_ref;
14813 }
14814
14815 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
14816 CHECK(!owner->result_ok);
14817         return CreationError_clone(&*owner->contents.err);
14818 }
14819 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14820         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
14821         jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
14822         return ret_conv;
14823 }
14824
14825 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
14826         LDKPrivateRoute ret = *owner->contents.result;
14827         ret.is_owned = false;
14828         return ret;
14829 }
14830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14831         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
14832         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
14833         int64_t ret_ref = 0;
14834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14836         return ret_ref;
14837 }
14838
14839 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
14840 CHECK(!owner->result_ok);
14841         return CreationError_clone(&*owner->contents.err);
14842 }
14843 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14844         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
14845         jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
14846         return ret_conv;
14847 }
14848
14849 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
14850         LDKOutPoint ret = *owner->contents.result;
14851         ret.is_owned = false;
14852         return ret;
14853 }
14854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14855         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
14856         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
14857         int64_t ret_ref = 0;
14858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14860         return ret_ref;
14861 }
14862
14863 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
14864 CHECK(!owner->result_ok);
14865         return DecodeError_clone(&*owner->contents.err);
14866 }
14867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14868         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
14869         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14870         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
14871         int64_t ret_ref = tag_ptr(ret_copy, true);
14872         return ret_ref;
14873 }
14874
14875 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
14876         LDKBigSize ret = *owner->contents.result;
14877         ret.is_owned = false;
14878         return ret;
14879 }
14880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14881         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
14882         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
14883         int64_t ret_ref = 0;
14884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14886         return ret_ref;
14887 }
14888
14889 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
14890 CHECK(!owner->result_ok);
14891         return DecodeError_clone(&*owner->contents.err);
14892 }
14893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14894         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
14895         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14896         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
14897         int64_t ret_ref = tag_ptr(ret_copy, true);
14898         return ret_ref;
14899 }
14900
14901 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
14902         LDKHostname ret = *owner->contents.result;
14903         ret.is_owned = false;
14904         return ret;
14905 }
14906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14907         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
14908         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
14909         int64_t ret_ref = 0;
14910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14912         return ret_ref;
14913 }
14914
14915 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
14916 CHECK(!owner->result_ok);
14917         return DecodeError_clone(&*owner->contents.err);
14918 }
14919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14920         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
14921         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14922         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
14923         int64_t ret_ref = tag_ptr(ret_copy, true);
14924         return ret_ref;
14925 }
14926
14927 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
14928         LDKTransactionU16LenLimited ret = *owner->contents.result;
14929         ret.is_owned = false;
14930         return ret;
14931 }
14932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14933         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
14934         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
14935         int64_t ret_ref = 0;
14936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14938         return ret_ref;
14939 }
14940
14941 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
14942 CHECK(!owner->result_ok);
14943         return *owner->contents.err;
14944 }
14945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14946         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
14947         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
14948 }
14949
14950 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
14951         LDKTransactionU16LenLimited ret = *owner->contents.result;
14952         ret.is_owned = false;
14953         return ret;
14954 }
14955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14956         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
14957         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
14958         int64_t ret_ref = 0;
14959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14961         return ret_ref;
14962 }
14963
14964 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
14965 CHECK(!owner->result_ok);
14966         return DecodeError_clone(&*owner->contents.err);
14967 }
14968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14969         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
14970         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14971         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
14972         int64_t ret_ref = tag_ptr(ret_copy, true);
14973         return ret_ref;
14974 }
14975
14976 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
14977         LDKUntrustedString ret = *owner->contents.result;
14978         ret.is_owned = false;
14979         return ret;
14980 }
14981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14982         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
14983         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
14984         int64_t ret_ref = 0;
14985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14987         return ret_ref;
14988 }
14989
14990 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
14991 CHECK(!owner->result_ok);
14992         return DecodeError_clone(&*owner->contents.err);
14993 }
14994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14995         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
14996         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14997         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
14998         int64_t ret_ref = tag_ptr(ret_copy, true);
14999         return ret_ref;
15000 }
15001
15002 static inline struct LDKThirtyTwoBytes C2Tuple__u832u16Z_get_a(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
15003         return ThirtyTwoBytes_clone(&owner->a);
15004 }
15005 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
15006         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
15007         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15008         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple__u832u16Z_get_a(owner_conv).data);
15009         return ret_arr;
15010 }
15011
15012 static inline uint16_t C2Tuple__u832u16Z_get_b(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
15013         return owner->b;
15014 }
15015 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
15016         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
15017         int16_t ret_conv = C2Tuple__u832u16Z_get_b(owner_conv);
15018         return ret_conv;
15019 }
15020
15021 static inline struct LDKPaymentRelay CResult_PaymentRelayDecodeErrorZ_get_ok(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
15022         LDKPaymentRelay ret = *owner->contents.result;
15023         ret.is_owned = false;
15024         return ret;
15025 }
15026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15027         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
15028         LDKPaymentRelay ret_var = CResult_PaymentRelayDecodeErrorZ_get_ok(owner_conv);
15029         int64_t ret_ref = 0;
15030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15032         return ret_ref;
15033 }
15034
15035 static inline struct LDKDecodeError CResult_PaymentRelayDecodeErrorZ_get_err(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
15036 CHECK(!owner->result_ok);
15037         return DecodeError_clone(&*owner->contents.err);
15038 }
15039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15040         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
15041         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15042         *ret_copy = CResult_PaymentRelayDecodeErrorZ_get_err(owner_conv);
15043         int64_t ret_ref = tag_ptr(ret_copy, true);
15044         return ret_ref;
15045 }
15046
15047 static inline struct LDKPaymentConstraints CResult_PaymentConstraintsDecodeErrorZ_get_ok(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
15048         LDKPaymentConstraints ret = *owner->contents.result;
15049         ret.is_owned = false;
15050         return ret;
15051 }
15052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15053         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
15054         LDKPaymentConstraints ret_var = CResult_PaymentConstraintsDecodeErrorZ_get_ok(owner_conv);
15055         int64_t ret_ref = 0;
15056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15058         return ret_ref;
15059 }
15060
15061 static inline struct LDKDecodeError CResult_PaymentConstraintsDecodeErrorZ_get_err(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
15062 CHECK(!owner->result_ok);
15063         return DecodeError_clone(&*owner->contents.err);
15064 }
15065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15066         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
15067         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15068         *ret_copy = CResult_PaymentConstraintsDecodeErrorZ_get_err(owner_conv);
15069         int64_t ret_ref = tag_ptr(ret_copy, true);
15070         return ret_ref;
15071 }
15072
15073 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
15074         return ThirtyTwoBytes_clone(&owner->a);
15075 }
15076 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
15077         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
15078         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15079         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(owner_conv).data);
15080         return ret_arr;
15081 }
15082
15083 static inline struct LDKRecipientOnionFields C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
15084         LDKRecipientOnionFields ret = owner->b;
15085         ret.is_owned = false;
15086         return ret;
15087 }
15088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
15089         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
15090         LDKRecipientOnionFields ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(owner_conv);
15091         int64_t ret_ref = 0;
15092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15094         return ret_ref;
15095 }
15096
15097 static inline struct LDKRouteParameters C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
15098         LDKRouteParameters ret = owner->c;
15099         ret.is_owned = false;
15100         return ret;
15101 }
15102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
15103         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
15104         LDKRouteParameters ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(owner_conv);
15105         int64_t ret_ref = 0;
15106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15108         return ret_ref;
15109 }
15110
15111 static inline struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
15112 CHECK(owner->result_ok);
15113         return C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(&*owner->contents.result);
15114 }
15115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15116         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
15117         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
15118         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(owner_conv);
15119         return tag_ptr(ret_conv, true);
15120 }
15121
15122 static inline void CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
15123 CHECK(!owner->result_ok);
15124         return *owner->contents.err;
15125 }
15126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15127         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
15128         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(owner_conv);
15129 }
15130
15131 static inline struct LDKStr CResult_StrSecp256k1ErrorZ_get_ok(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
15132 CHECK(owner->result_ok);
15133         return *owner->contents.result;
15134 }
15135 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15136         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
15137         LDKStr ret_str = CResult_StrSecp256k1ErrorZ_get_ok(owner_conv);
15138         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
15139         return ret_conv;
15140 }
15141
15142 static inline enum LDKSecp256k1Error CResult_StrSecp256k1ErrorZ_get_err(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
15143 CHECK(!owner->result_ok);
15144         return *owner->contents.err;
15145 }
15146 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15147         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
15148         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StrSecp256k1ErrorZ_get_err(owner_conv));
15149         return ret_conv;
15150 }
15151
15152 static inline struct LDKPublicKey C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
15153         return owner->a;
15154 }
15155 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
15156         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
15157         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15158         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(owner_conv).compressed_form);
15159         return ret_arr;
15160 }
15161
15162 static inline struct LDKOnionMessage C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
15163         LDKOnionMessage ret = owner->b;
15164         ret.is_owned = false;
15165         return ret;
15166 }
15167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
15168         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
15169         LDKOnionMessage ret_var = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(owner_conv);
15170         int64_t ret_ref = 0;
15171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15173         return ret_ref;
15174 }
15175
15176 static inline struct LDKCOption_CVec_SocketAddressZZ C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
15177         return COption_CVec_SocketAddressZZ_clone(&owner->c);
15178 }
15179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
15180         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
15181         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
15182         *ret_copy = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(owner_conv);
15183         int64_t ret_ref = tag_ptr(ret_copy, true);
15184         return ret_ref;
15185 }
15186
15187 static jclass LDKSendError_Secp256k1_class = NULL;
15188 static jmethodID LDKSendError_Secp256k1_meth = NULL;
15189 static jclass LDKSendError_TooBigPacket_class = NULL;
15190 static jmethodID LDKSendError_TooBigPacket_meth = NULL;
15191 static jclass LDKSendError_TooFewBlindedHops_class = NULL;
15192 static jmethodID LDKSendError_TooFewBlindedHops_meth = NULL;
15193 static jclass LDKSendError_InvalidFirstHop_class = NULL;
15194 static jmethodID LDKSendError_InvalidFirstHop_meth = NULL;
15195 static jclass LDKSendError_PathNotFound_class = NULL;
15196 static jmethodID LDKSendError_PathNotFound_meth = NULL;
15197 static jclass LDKSendError_InvalidMessage_class = NULL;
15198 static jmethodID LDKSendError_InvalidMessage_meth = NULL;
15199 static jclass LDKSendError_BufferFull_class = NULL;
15200 static jmethodID LDKSendError_BufferFull_meth = NULL;
15201 static jclass LDKSendError_GetNodeIdFailed_class = NULL;
15202 static jmethodID LDKSendError_GetNodeIdFailed_meth = NULL;
15203 static jclass LDKSendError_BlindedPathAdvanceFailed_class = NULL;
15204 static jmethodID LDKSendError_BlindedPathAdvanceFailed_meth = NULL;
15205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSendError_init (JNIEnv *env, jclass clz) {
15206         LDKSendError_Secp256k1_class =
15207                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$Secp256k1"));
15208         CHECK(LDKSendError_Secp256k1_class != NULL);
15209         LDKSendError_Secp256k1_meth = (*env)->GetMethodID(env, LDKSendError_Secp256k1_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
15210         CHECK(LDKSendError_Secp256k1_meth != NULL);
15211         LDKSendError_TooBigPacket_class =
15212                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooBigPacket"));
15213         CHECK(LDKSendError_TooBigPacket_class != NULL);
15214         LDKSendError_TooBigPacket_meth = (*env)->GetMethodID(env, LDKSendError_TooBigPacket_class, "<init>", "()V");
15215         CHECK(LDKSendError_TooBigPacket_meth != NULL);
15216         LDKSendError_TooFewBlindedHops_class =
15217                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooFewBlindedHops"));
15218         CHECK(LDKSendError_TooFewBlindedHops_class != NULL);
15219         LDKSendError_TooFewBlindedHops_meth = (*env)->GetMethodID(env, LDKSendError_TooFewBlindedHops_class, "<init>", "()V");
15220         CHECK(LDKSendError_TooFewBlindedHops_meth != NULL);
15221         LDKSendError_InvalidFirstHop_class =
15222                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidFirstHop"));
15223         CHECK(LDKSendError_InvalidFirstHop_class != NULL);
15224         LDKSendError_InvalidFirstHop_meth = (*env)->GetMethodID(env, LDKSendError_InvalidFirstHop_class, "<init>", "([B)V");
15225         CHECK(LDKSendError_InvalidFirstHop_meth != NULL);
15226         LDKSendError_PathNotFound_class =
15227                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$PathNotFound"));
15228         CHECK(LDKSendError_PathNotFound_class != NULL);
15229         LDKSendError_PathNotFound_meth = (*env)->GetMethodID(env, LDKSendError_PathNotFound_class, "<init>", "()V");
15230         CHECK(LDKSendError_PathNotFound_meth != NULL);
15231         LDKSendError_InvalidMessage_class =
15232                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidMessage"));
15233         CHECK(LDKSendError_InvalidMessage_class != NULL);
15234         LDKSendError_InvalidMessage_meth = (*env)->GetMethodID(env, LDKSendError_InvalidMessage_class, "<init>", "()V");
15235         CHECK(LDKSendError_InvalidMessage_meth != NULL);
15236         LDKSendError_BufferFull_class =
15237                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BufferFull"));
15238         CHECK(LDKSendError_BufferFull_class != NULL);
15239         LDKSendError_BufferFull_meth = (*env)->GetMethodID(env, LDKSendError_BufferFull_class, "<init>", "()V");
15240         CHECK(LDKSendError_BufferFull_meth != NULL);
15241         LDKSendError_GetNodeIdFailed_class =
15242                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$GetNodeIdFailed"));
15243         CHECK(LDKSendError_GetNodeIdFailed_class != NULL);
15244         LDKSendError_GetNodeIdFailed_meth = (*env)->GetMethodID(env, LDKSendError_GetNodeIdFailed_class, "<init>", "()V");
15245         CHECK(LDKSendError_GetNodeIdFailed_meth != NULL);
15246         LDKSendError_BlindedPathAdvanceFailed_class =
15247                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BlindedPathAdvanceFailed"));
15248         CHECK(LDKSendError_BlindedPathAdvanceFailed_class != NULL);
15249         LDKSendError_BlindedPathAdvanceFailed_meth = (*env)->GetMethodID(env, LDKSendError_BlindedPathAdvanceFailed_class, "<init>", "()V");
15250         CHECK(LDKSendError_BlindedPathAdvanceFailed_meth != NULL);
15251 }
15252 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSendError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15253         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
15254         switch(obj->tag) {
15255                 case LDKSendError_Secp256k1: {
15256                         jclass secp256k1_conv = LDKSecp256k1Error_to_java(env, obj->secp256k1);
15257                         return (*env)->NewObject(env, LDKSendError_Secp256k1_class, LDKSendError_Secp256k1_meth, secp256k1_conv);
15258                 }
15259                 case LDKSendError_TooBigPacket: {
15260                         return (*env)->NewObject(env, LDKSendError_TooBigPacket_class, LDKSendError_TooBigPacket_meth);
15261                 }
15262                 case LDKSendError_TooFewBlindedHops: {
15263                         return (*env)->NewObject(env, LDKSendError_TooFewBlindedHops_class, LDKSendError_TooFewBlindedHops_meth);
15264                 }
15265                 case LDKSendError_InvalidFirstHop: {
15266                         int8_tArray invalid_first_hop_arr = (*env)->NewByteArray(env, 33);
15267                         (*env)->SetByteArrayRegion(env, invalid_first_hop_arr, 0, 33, obj->invalid_first_hop.compressed_form);
15268                         return (*env)->NewObject(env, LDKSendError_InvalidFirstHop_class, LDKSendError_InvalidFirstHop_meth, invalid_first_hop_arr);
15269                 }
15270                 case LDKSendError_PathNotFound: {
15271                         return (*env)->NewObject(env, LDKSendError_PathNotFound_class, LDKSendError_PathNotFound_meth);
15272                 }
15273                 case LDKSendError_InvalidMessage: {
15274                         return (*env)->NewObject(env, LDKSendError_InvalidMessage_class, LDKSendError_InvalidMessage_meth);
15275                 }
15276                 case LDKSendError_BufferFull: {
15277                         return (*env)->NewObject(env, LDKSendError_BufferFull_class, LDKSendError_BufferFull_meth);
15278                 }
15279                 case LDKSendError_GetNodeIdFailed: {
15280                         return (*env)->NewObject(env, LDKSendError_GetNodeIdFailed_class, LDKSendError_GetNodeIdFailed_meth);
15281                 }
15282                 case LDKSendError_BlindedPathAdvanceFailed: {
15283                         return (*env)->NewObject(env, LDKSendError_BlindedPathAdvanceFailed_class, LDKSendError_BlindedPathAdvanceFailed_meth);
15284                 }
15285                 default: abort();
15286         }
15287 }
15288 static inline struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
15289 CHECK(owner->result_ok);
15290         return C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(&*owner->contents.result);
15291 }
15292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15293         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
15294         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
15295         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(owner_conv);
15296         return tag_ptr(ret_conv, true);
15297 }
15298
15299 static inline struct LDKSendError CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
15300 CHECK(!owner->result_ok);
15301         return SendError_clone(&*owner->contents.err);
15302 }
15303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15304         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
15305         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
15306         *ret_copy = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(owner_conv);
15307         int64_t ret_ref = tag_ptr(ret_copy, true);
15308         return ret_ref;
15309 }
15310
15311 static jclass LDKParsedOnionMessageContents_Offers_class = NULL;
15312 static jmethodID LDKParsedOnionMessageContents_Offers_meth = NULL;
15313 static jclass LDKParsedOnionMessageContents_Custom_class = NULL;
15314 static jmethodID LDKParsedOnionMessageContents_Custom_meth = NULL;
15315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParsedOnionMessageContents_init (JNIEnv *env, jclass clz) {
15316         LDKParsedOnionMessageContents_Offers_class =
15317                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParsedOnionMessageContents$Offers"));
15318         CHECK(LDKParsedOnionMessageContents_Offers_class != NULL);
15319         LDKParsedOnionMessageContents_Offers_meth = (*env)->GetMethodID(env, LDKParsedOnionMessageContents_Offers_class, "<init>", "(J)V");
15320         CHECK(LDKParsedOnionMessageContents_Offers_meth != NULL);
15321         LDKParsedOnionMessageContents_Custom_class =
15322                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParsedOnionMessageContents$Custom"));
15323         CHECK(LDKParsedOnionMessageContents_Custom_class != NULL);
15324         LDKParsedOnionMessageContents_Custom_meth = (*env)->GetMethodID(env, LDKParsedOnionMessageContents_Custom_class, "<init>", "(J)V");
15325         CHECK(LDKParsedOnionMessageContents_Custom_meth != NULL);
15326 }
15327 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParsedOnionMessageContents_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15328         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
15329         switch(obj->tag) {
15330                 case LDKParsedOnionMessageContents_Offers: {
15331                         int64_t offers_ref = tag_ptr(&obj->offers, false);
15332                         return (*env)->NewObject(env, LDKParsedOnionMessageContents_Offers_class, LDKParsedOnionMessageContents_Offers_meth, offers_ref);
15333                 }
15334                 case LDKParsedOnionMessageContents_Custom: {
15335                         LDKOnionMessageContents* custom_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
15336                         *custom_ret = OnionMessageContents_clone(&obj->custom);
15337                         return (*env)->NewObject(env, LDKParsedOnionMessageContents_Custom_class, LDKParsedOnionMessageContents_Custom_meth, tag_ptr(custom_ret, true));
15338                 }
15339                 default: abort();
15340         }
15341 }
15342 static jclass LDKPeeledOnion_Forward_class = NULL;
15343 static jmethodID LDKPeeledOnion_Forward_meth = NULL;
15344 static jclass LDKPeeledOnion_Receive_class = NULL;
15345 static jmethodID LDKPeeledOnion_Receive_meth = NULL;
15346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPeeledOnion_init (JNIEnv *env, jclass clz) {
15347         LDKPeeledOnion_Forward_class =
15348                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPeeledOnion$Forward"));
15349         CHECK(LDKPeeledOnion_Forward_class != NULL);
15350         LDKPeeledOnion_Forward_meth = (*env)->GetMethodID(env, LDKPeeledOnion_Forward_class, "<init>", "([BJ)V");
15351         CHECK(LDKPeeledOnion_Forward_meth != NULL);
15352         LDKPeeledOnion_Receive_class =
15353                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPeeledOnion$Receive"));
15354         CHECK(LDKPeeledOnion_Receive_class != NULL);
15355         LDKPeeledOnion_Receive_meth = (*env)->GetMethodID(env, LDKPeeledOnion_Receive_class, "<init>", "(J[BJ)V");
15356         CHECK(LDKPeeledOnion_Receive_meth != NULL);
15357 }
15358 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPeeledOnion_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15359         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
15360         switch(obj->tag) {
15361                 case LDKPeeledOnion_Forward: {
15362                         int8_tArray _0_arr = (*env)->NewByteArray(env, 33);
15363                         (*env)->SetByteArrayRegion(env, _0_arr, 0, 33, obj->forward._0.compressed_form);
15364                         LDKOnionMessage _1_var = obj->forward._1;
15365                         int64_t _1_ref = 0;
15366                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_1_var);
15367                         _1_ref = tag_ptr(_1_var.inner, false);
15368                         return (*env)->NewObject(env, LDKPeeledOnion_Forward_class, LDKPeeledOnion_Forward_meth, _0_arr, _1_ref);
15369                 }
15370                 case LDKPeeledOnion_Receive: {
15371                         int64_t _0_ref = tag_ptr(&obj->receive._0, false);
15372                         int8_tArray _1_arr = (*env)->NewByteArray(env, 32);
15373                         (*env)->SetByteArrayRegion(env, _1_arr, 0, 32, obj->receive._1.data);
15374                         LDKBlindedPath _2_var = obj->receive._2;
15375                         int64_t _2_ref = 0;
15376                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_2_var);
15377                         _2_ref = tag_ptr(_2_var.inner, false);
15378                         return (*env)->NewObject(env, LDKPeeledOnion_Receive_class, LDKPeeledOnion_Receive_meth, _0_ref, _1_arr, _2_ref);
15379                 }
15380                 default: abort();
15381         }
15382 }
15383 static inline struct LDKPeeledOnion CResult_PeeledOnionNoneZ_get_ok(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
15384 CHECK(owner->result_ok);
15385         return PeeledOnion_clone(&*owner->contents.result);
15386 }
15387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15388         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
15389         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
15390         *ret_copy = CResult_PeeledOnionNoneZ_get_ok(owner_conv);
15391         int64_t ret_ref = tag_ptr(ret_copy, true);
15392         return ret_ref;
15393 }
15394
15395 static inline void CResult_PeeledOnionNoneZ_get_err(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
15396 CHECK(!owner->result_ok);
15397         return *owner->contents.err;
15398 }
15399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15400         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
15401         CResult_PeeledOnionNoneZ_get_err(owner_conv);
15402 }
15403
15404 static jclass LDKSendSuccess_Buffered_class = NULL;
15405 static jmethodID LDKSendSuccess_Buffered_meth = NULL;
15406 static jclass LDKSendSuccess_BufferedAwaitingConnection_class = NULL;
15407 static jmethodID LDKSendSuccess_BufferedAwaitingConnection_meth = NULL;
15408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSendSuccess_init (JNIEnv *env, jclass clz) {
15409         LDKSendSuccess_Buffered_class =
15410                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendSuccess$Buffered"));
15411         CHECK(LDKSendSuccess_Buffered_class != NULL);
15412         LDKSendSuccess_Buffered_meth = (*env)->GetMethodID(env, LDKSendSuccess_Buffered_class, "<init>", "()V");
15413         CHECK(LDKSendSuccess_Buffered_meth != NULL);
15414         LDKSendSuccess_BufferedAwaitingConnection_class =
15415                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendSuccess$BufferedAwaitingConnection"));
15416         CHECK(LDKSendSuccess_BufferedAwaitingConnection_class != NULL);
15417         LDKSendSuccess_BufferedAwaitingConnection_meth = (*env)->GetMethodID(env, LDKSendSuccess_BufferedAwaitingConnection_class, "<init>", "([B)V");
15418         CHECK(LDKSendSuccess_BufferedAwaitingConnection_meth != NULL);
15419 }
15420 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSendSuccess_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15421         LDKSendSuccess *obj = (LDKSendSuccess*)untag_ptr(ptr);
15422         switch(obj->tag) {
15423                 case LDKSendSuccess_Buffered: {
15424                         return (*env)->NewObject(env, LDKSendSuccess_Buffered_class, LDKSendSuccess_Buffered_meth);
15425                 }
15426                 case LDKSendSuccess_BufferedAwaitingConnection: {
15427                         int8_tArray buffered_awaiting_connection_arr = (*env)->NewByteArray(env, 33);
15428                         (*env)->SetByteArrayRegion(env, buffered_awaiting_connection_arr, 0, 33, obj->buffered_awaiting_connection.compressed_form);
15429                         return (*env)->NewObject(env, LDKSendSuccess_BufferedAwaitingConnection_class, LDKSendSuccess_BufferedAwaitingConnection_meth, buffered_awaiting_connection_arr);
15430                 }
15431                 default: abort();
15432         }
15433 }
15434 static inline struct LDKSendSuccess CResult_SendSuccessSendErrorZ_get_ok(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
15435 CHECK(owner->result_ok);
15436         return SendSuccess_clone(&*owner->contents.result);
15437 }
15438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15439         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
15440         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
15441         *ret_copy = CResult_SendSuccessSendErrorZ_get_ok(owner_conv);
15442         int64_t ret_ref = tag_ptr(ret_copy, true);
15443         return ret_ref;
15444 }
15445
15446 static inline struct LDKSendError CResult_SendSuccessSendErrorZ_get_err(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
15447 CHECK(!owner->result_ok);
15448         return SendError_clone(&*owner->contents.err);
15449 }
15450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15451         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
15452         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
15453         *ret_copy = CResult_SendSuccessSendErrorZ_get_err(owner_conv);
15454         int64_t ret_ref = tag_ptr(ret_copy, true);
15455         return ret_ref;
15456 }
15457
15458 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
15459         LDKBlindedPath ret = *owner->contents.result;
15460         ret.is_owned = false;
15461         return ret;
15462 }
15463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15464         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
15465         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
15466         int64_t ret_ref = 0;
15467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15469         return ret_ref;
15470 }
15471
15472 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
15473 CHECK(!owner->result_ok);
15474         return *owner->contents.err;
15475 }
15476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15477         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
15478         CResult_BlindedPathNoneZ_get_err(owner_conv);
15479 }
15480
15481 static inline struct LDKC2Tuple_BlindedPayInfoBlindedPathZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
15482 CHECK(owner->result_ok);
15483         return C2Tuple_BlindedPayInfoBlindedPathZ_clone(&*owner->contents.result);
15484 }
15485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15486         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
15487         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
15488         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(owner_conv);
15489         return tag_ptr(ret_conv, true);
15490 }
15491
15492 static inline void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
15493 CHECK(!owner->result_ok);
15494         return *owner->contents.err;
15495 }
15496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15497         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
15498         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(owner_conv);
15499 }
15500
15501 static inline LDKCVec_ForwardNodeZ CVec_ForwardNodeZ_clone(const LDKCVec_ForwardNodeZ *orig) {
15502         LDKCVec_ForwardNodeZ ret = { .data = MALLOC(sizeof(LDKForwardNode) * orig->datalen, "LDKCVec_ForwardNodeZ clone bytes"), .datalen = orig->datalen };
15503         for (size_t i = 0; i < ret.datalen; i++) {
15504                 ret.data[i] = ForwardNode_clone(&orig->data[i]);
15505         }
15506         return ret;
15507 }
15508 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
15509         LDKBlindedPath ret = *owner->contents.result;
15510         ret.is_owned = false;
15511         return ret;
15512 }
15513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15514         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
15515         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
15516         int64_t ret_ref = 0;
15517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15519         return ret_ref;
15520 }
15521
15522 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
15523 CHECK(!owner->result_ok);
15524         return DecodeError_clone(&*owner->contents.err);
15525 }
15526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15527         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
15528         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15529         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
15530         int64_t ret_ref = tag_ptr(ret_copy, true);
15531         return ret_ref;
15532 }
15533
15534 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
15535         LDKBlindedHop ret = *owner->contents.result;
15536         ret.is_owned = false;
15537         return ret;
15538 }
15539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15540         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
15541         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
15542         int64_t ret_ref = 0;
15543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15545         return ret_ref;
15546 }
15547
15548 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
15549 CHECK(!owner->result_ok);
15550         return DecodeError_clone(&*owner->contents.err);
15551 }
15552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15553         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
15554         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15555         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
15556         int64_t ret_ref = tag_ptr(ret_copy, true);
15557         return ret_ref;
15558 }
15559
15560 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
15561         LDKInvoiceError ret = *owner->contents.result;
15562         ret.is_owned = false;
15563         return ret;
15564 }
15565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15566         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
15567         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
15568         int64_t ret_ref = 0;
15569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15571         return ret_ref;
15572 }
15573
15574 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
15575 CHECK(!owner->result_ok);
15576         return DecodeError_clone(&*owner->contents.err);
15577 }
15578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15579         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
15580         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15581         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
15582         int64_t ret_ref = tag_ptr(ret_copy, true);
15583         return ret_ref;
15584 }
15585
15586 static inline struct LDKDelayedPaymentBasepoint CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
15587         LDKDelayedPaymentBasepoint ret = *owner->contents.result;
15588         ret.is_owned = false;
15589         return ret;
15590 }
15591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15592         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
15593         LDKDelayedPaymentBasepoint ret_var = CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(owner_conv);
15594         int64_t ret_ref = 0;
15595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15597         return ret_ref;
15598 }
15599
15600 static inline struct LDKDecodeError CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
15601 CHECK(!owner->result_ok);
15602         return DecodeError_clone(&*owner->contents.err);
15603 }
15604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15605         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
15606         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15607         *ret_copy = CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(owner_conv);
15608         int64_t ret_ref = tag_ptr(ret_copy, true);
15609         return ret_ref;
15610 }
15611
15612 static inline struct LDKDelayedPaymentKey CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
15613         LDKDelayedPaymentKey ret = *owner->contents.result;
15614         ret.is_owned = false;
15615         return ret;
15616 }
15617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15618         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
15619         LDKDelayedPaymentKey ret_var = CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(owner_conv);
15620         int64_t ret_ref = 0;
15621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15623         return ret_ref;
15624 }
15625
15626 static inline struct LDKDecodeError CResult_DelayedPaymentKeyDecodeErrorZ_get_err(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
15627 CHECK(!owner->result_ok);
15628         return DecodeError_clone(&*owner->contents.err);
15629 }
15630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15631         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
15632         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15633         *ret_copy = CResult_DelayedPaymentKeyDecodeErrorZ_get_err(owner_conv);
15634         int64_t ret_ref = tag_ptr(ret_copy, true);
15635         return ret_ref;
15636 }
15637
15638 static inline struct LDKHtlcBasepoint CResult_HtlcBasepointDecodeErrorZ_get_ok(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
15639         LDKHtlcBasepoint ret = *owner->contents.result;
15640         ret.is_owned = false;
15641         return ret;
15642 }
15643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15644         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
15645         LDKHtlcBasepoint ret_var = CResult_HtlcBasepointDecodeErrorZ_get_ok(owner_conv);
15646         int64_t ret_ref = 0;
15647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15649         return ret_ref;
15650 }
15651
15652 static inline struct LDKDecodeError CResult_HtlcBasepointDecodeErrorZ_get_err(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
15653 CHECK(!owner->result_ok);
15654         return DecodeError_clone(&*owner->contents.err);
15655 }
15656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15657         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
15658         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15659         *ret_copy = CResult_HtlcBasepointDecodeErrorZ_get_err(owner_conv);
15660         int64_t ret_ref = tag_ptr(ret_copy, true);
15661         return ret_ref;
15662 }
15663
15664 static inline struct LDKHtlcKey CResult_HtlcKeyDecodeErrorZ_get_ok(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
15665         LDKHtlcKey ret = *owner->contents.result;
15666         ret.is_owned = false;
15667         return ret;
15668 }
15669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15670         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
15671         LDKHtlcKey ret_var = CResult_HtlcKeyDecodeErrorZ_get_ok(owner_conv);
15672         int64_t ret_ref = 0;
15673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15675         return ret_ref;
15676 }
15677
15678 static inline struct LDKDecodeError CResult_HtlcKeyDecodeErrorZ_get_err(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
15679 CHECK(!owner->result_ok);
15680         return DecodeError_clone(&*owner->contents.err);
15681 }
15682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15683         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
15684         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15685         *ret_copy = CResult_HtlcKeyDecodeErrorZ_get_err(owner_conv);
15686         int64_t ret_ref = tag_ptr(ret_copy, true);
15687         return ret_ref;
15688 }
15689
15690 static inline struct LDKRevocationBasepoint CResult_RevocationBasepointDecodeErrorZ_get_ok(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
15691         LDKRevocationBasepoint ret = *owner->contents.result;
15692         ret.is_owned = false;
15693         return ret;
15694 }
15695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15696         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
15697         LDKRevocationBasepoint ret_var = CResult_RevocationBasepointDecodeErrorZ_get_ok(owner_conv);
15698         int64_t ret_ref = 0;
15699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15701         return ret_ref;
15702 }
15703
15704 static inline struct LDKDecodeError CResult_RevocationBasepointDecodeErrorZ_get_err(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
15705 CHECK(!owner->result_ok);
15706         return DecodeError_clone(&*owner->contents.err);
15707 }
15708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15709         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
15710         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15711         *ret_copy = CResult_RevocationBasepointDecodeErrorZ_get_err(owner_conv);
15712         int64_t ret_ref = tag_ptr(ret_copy, true);
15713         return ret_ref;
15714 }
15715
15716 static inline struct LDKRevocationKey CResult_RevocationKeyDecodeErrorZ_get_ok(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
15717         LDKRevocationKey ret = *owner->contents.result;
15718         ret.is_owned = false;
15719         return ret;
15720 }
15721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15722         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
15723         LDKRevocationKey ret_var = CResult_RevocationKeyDecodeErrorZ_get_ok(owner_conv);
15724         int64_t ret_ref = 0;
15725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15727         return ret_ref;
15728 }
15729
15730 static inline struct LDKDecodeError CResult_RevocationKeyDecodeErrorZ_get_err(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
15731 CHECK(!owner->result_ok);
15732         return DecodeError_clone(&*owner->contents.err);
15733 }
15734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15735         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
15736         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15737         *ret_copy = CResult_RevocationKeyDecodeErrorZ_get_err(owner_conv);
15738         int64_t ret_ref = tag_ptr(ret_copy, true);
15739         return ret_ref;
15740 }
15741
15742 typedef struct LDKFilter_JCalls {
15743         atomic_size_t refcnt;
15744         JavaVM *vm;
15745         jweak o;
15746         jmethodID register_tx_meth;
15747         jmethodID register_output_meth;
15748 } LDKFilter_JCalls;
15749 static void LDKFilter_JCalls_free(void* this_arg) {
15750         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
15751         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15752                 JNIEnv *env;
15753                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15754                 if (get_jenv_res == JNI_EDETACHED) {
15755                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15756                 } else {
15757                         DO_ASSERT(get_jenv_res == JNI_OK);
15758                 }
15759                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15760                 if (get_jenv_res == JNI_EDETACHED) {
15761                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15762                 }
15763                 FREE(j_calls);
15764         }
15765 }
15766 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
15767         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
15768         JNIEnv *env;
15769         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15770         if (get_jenv_res == JNI_EDETACHED) {
15771                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15772         } else {
15773                 DO_ASSERT(get_jenv_res == JNI_OK);
15774         }
15775         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
15776         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
15777         LDKu8slice script_pubkey_var = script_pubkey;
15778         int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
15779         (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
15780         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15781         CHECK(obj != NULL);
15782         (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
15783         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15784                 (*env)->ExceptionDescribe(env);
15785                 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
15786         }
15787         if (get_jenv_res == JNI_EDETACHED) {
15788                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15789         }
15790 }
15791 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
15792         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
15793         JNIEnv *env;
15794         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15795         if (get_jenv_res == JNI_EDETACHED) {
15796                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15797         } else {
15798                 DO_ASSERT(get_jenv_res == JNI_OK);
15799         }
15800         LDKWatchedOutput output_var = output;
15801         int64_t output_ref = 0;
15802         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
15803         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
15804         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15805         CHECK(obj != NULL);
15806         (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, output_ref);
15807         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15808                 (*env)->ExceptionDescribe(env);
15809                 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
15810         }
15811         if (get_jenv_res == JNI_EDETACHED) {
15812                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15813         }
15814 }
15815 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
15816         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
15817         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15818 }
15819 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
15820         jclass c = (*env)->GetObjectClass(env, o);
15821         CHECK(c != NULL);
15822         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
15823         atomic_init(&calls->refcnt, 1);
15824         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15825         calls->o = (*env)->NewWeakGlobalRef(env, o);
15826         calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
15827         CHECK(calls->register_tx_meth != NULL);
15828         calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)V");
15829         CHECK(calls->register_output_meth != NULL);
15830
15831         LDKFilter ret = {
15832                 .this_arg = (void*) calls,
15833                 .register_tx = register_tx_LDKFilter_jcall,
15834                 .register_output = register_output_LDKFilter_jcall,
15835                 .free = LDKFilter_JCalls_free,
15836         };
15837         return ret;
15838 }
15839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
15840         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
15841         *res_ptr = LDKFilter_init(env, clz, o);
15842         return tag_ptr(res_ptr, true);
15843 }
15844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
15845         void* this_arg_ptr = untag_ptr(this_arg);
15846         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15847         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
15848         uint8_t txid_arr[32];
15849         CHECK((*env)->GetArrayLength(env, txid) == 32);
15850         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
15851         uint8_t (*txid_ref)[32] = &txid_arr;
15852         LDKu8slice script_pubkey_ref;
15853         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
15854         script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
15855         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
15856         (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
15857 }
15858
15859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
15860         void* this_arg_ptr = untag_ptr(this_arg);
15861         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15862         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
15863         LDKWatchedOutput output_conv;
15864         output_conv.inner = untag_ptr(output);
15865         output_conv.is_owned = ptr_is_owned(output);
15866         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
15867         output_conv = WatchedOutput_clone(&output_conv);
15868         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
15869 }
15870
15871 static jclass LDKCOption_FilterZ_Some_class = NULL;
15872 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
15873 static jclass LDKCOption_FilterZ_None_class = NULL;
15874 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
15875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
15876         LDKCOption_FilterZ_Some_class =
15877                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
15878         CHECK(LDKCOption_FilterZ_Some_class != NULL);
15879         LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
15880         CHECK(LDKCOption_FilterZ_Some_meth != NULL);
15881         LDKCOption_FilterZ_None_class =
15882                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
15883         CHECK(LDKCOption_FilterZ_None_class != NULL);
15884         LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
15885         CHECK(LDKCOption_FilterZ_None_meth != NULL);
15886 }
15887 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15888         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
15889         switch(obj->tag) {
15890                 case LDKCOption_FilterZ_Some: {
15891                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
15892                         *some_ret = obj->some;
15893                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
15894                         if ((*some_ret).free == LDKFilter_JCalls_free) {
15895                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15896                                 LDKFilter_JCalls_cloned(&(*some_ret));
15897                         }
15898                         return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, tag_ptr(some_ret, true));
15899                 }
15900                 case LDKCOption_FilterZ_None: {
15901                         return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
15902                 }
15903                 default: abort();
15904         }
15905 }
15906 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
15907         LDKLockedChannelMonitor ret = *owner->contents.result;
15908         ret.is_owned = false;
15909         return ret;
15910 }
15911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15912         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
15913         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
15914         int64_t ret_ref = 0;
15915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15917         return ret_ref;
15918 }
15919
15920 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
15921 CHECK(!owner->result_ok);
15922         return *owner->contents.err;
15923 }
15924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15925         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
15926         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
15927 }
15928
15929 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
15930         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
15931         for (size_t i = 0; i < ret.datalen; i++) {
15932                 ret.data[i] = OutPoint_clone(&orig->data[i]);
15933         }
15934         return ret;
15935 }
15936 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
15937         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
15938         for (size_t i = 0; i < ret.datalen; i++) {
15939                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
15940         }
15941         return ret;
15942 }
15943 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
15944         LDKOutPoint ret = owner->a;
15945         ret.is_owned = false;
15946         return ret;
15947 }
15948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
15949         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
15950         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
15951         int64_t ret_ref = 0;
15952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15954         return ret_ref;
15955 }
15956
15957 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
15958         return CVec_MonitorUpdateIdZ_clone(&owner->b);
15959 }
15960 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
15961         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
15962         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
15963         int64_tArray ret_arr = NULL;
15964         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15965         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15966         for (size_t r = 0; r < ret_var.datalen; r++) {
15967                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
15968                 int64_t ret_conv_17_ref = 0;
15969                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
15970                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
15971                 ret_arr_ptr[r] = ret_conv_17_ref;
15972         }
15973         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15974         FREE(ret_var.data);
15975         return ret_arr;
15976 }
15977
15978 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
15979         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
15980         for (size_t i = 0; i < ret.datalen; i++) {
15981                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
15982         }
15983         return ret;
15984 }
15985 typedef struct LDKKVStore_JCalls {
15986         atomic_size_t refcnt;
15987         JavaVM *vm;
15988         jweak o;
15989         jmethodID read_meth;
15990         jmethodID write_meth;
15991         jmethodID remove_meth;
15992         jmethodID list_meth;
15993 } LDKKVStore_JCalls;
15994 static void LDKKVStore_JCalls_free(void* this_arg) {
15995         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
15996         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15997                 JNIEnv *env;
15998                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15999                 if (get_jenv_res == JNI_EDETACHED) {
16000                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16001                 } else {
16002                         DO_ASSERT(get_jenv_res == JNI_OK);
16003                 }
16004                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16005                 if (get_jenv_res == JNI_EDETACHED) {
16006                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16007                 }
16008                 FREE(j_calls);
16009         }
16010 }
16011 LDKCResult_CVec_u8ZIOErrorZ read_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key) {
16012         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
16013         JNIEnv *env;
16014         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16015         if (get_jenv_res == JNI_EDETACHED) {
16016                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16017         } else {
16018                 DO_ASSERT(get_jenv_res == JNI_OK);
16019         }
16020         LDKStr primary_namespace_str = primary_namespace;
16021         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
16022         Str_free(primary_namespace_str);
16023         LDKStr secondary_namespace_str = secondary_namespace;
16024         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
16025         Str_free(secondary_namespace_str);
16026         LDKStr key_str = key;
16027         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
16028         Str_free(key_str);
16029         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16030         CHECK(obj != NULL);
16031         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, primary_namespace_conv, secondary_namespace_conv, key_conv);
16032         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16033                 (*env)->ExceptionDescribe(env);
16034                 (*env)->FatalError(env, "A call to read in LDKKVStore from rust threw an exception.");
16035         }
16036         void* ret_ptr = untag_ptr(ret);
16037         CHECK_ACCESS(ret_ptr);
16038         LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
16039         FREE(untag_ptr(ret));
16040         if (get_jenv_res == JNI_EDETACHED) {
16041                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16042         }
16043         return ret_conv;
16044 }
16045 LDKCResult_NoneIOErrorZ write_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, LDKu8slice buf) {
16046         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
16047         JNIEnv *env;
16048         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16049         if (get_jenv_res == JNI_EDETACHED) {
16050                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16051         } else {
16052                 DO_ASSERT(get_jenv_res == JNI_OK);
16053         }
16054         LDKStr primary_namespace_str = primary_namespace;
16055         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
16056         Str_free(primary_namespace_str);
16057         LDKStr secondary_namespace_str = secondary_namespace;
16058         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
16059         Str_free(secondary_namespace_str);
16060         LDKStr key_str = key;
16061         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
16062         Str_free(key_str);
16063         LDKu8slice buf_var = buf;
16064         int8_tArray buf_arr = (*env)->NewByteArray(env, buf_var.datalen);
16065         (*env)->SetByteArrayRegion(env, buf_arr, 0, buf_var.datalen, buf_var.data);
16066         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16067         CHECK(obj != NULL);
16068         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->write_meth, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_arr);
16069         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16070                 (*env)->ExceptionDescribe(env);
16071                 (*env)->FatalError(env, "A call to write in LDKKVStore from rust threw an exception.");
16072         }
16073         void* ret_ptr = untag_ptr(ret);
16074         CHECK_ACCESS(ret_ptr);
16075         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
16076         FREE(untag_ptr(ret));
16077         if (get_jenv_res == JNI_EDETACHED) {
16078                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16079         }
16080         return ret_conv;
16081 }
16082 LDKCResult_NoneIOErrorZ remove_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, bool lazy) {
16083         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
16084         JNIEnv *env;
16085         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16086         if (get_jenv_res == JNI_EDETACHED) {
16087                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16088         } else {
16089                 DO_ASSERT(get_jenv_res == JNI_OK);
16090         }
16091         LDKStr primary_namespace_str = primary_namespace;
16092         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
16093         Str_free(primary_namespace_str);
16094         LDKStr secondary_namespace_str = secondary_namespace;
16095         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
16096         Str_free(secondary_namespace_str);
16097         LDKStr key_str = key;
16098         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
16099         Str_free(key_str);
16100         jboolean lazy_conv = lazy;
16101         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16102         CHECK(obj != NULL);
16103         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->remove_meth, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy_conv);
16104         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16105                 (*env)->ExceptionDescribe(env);
16106                 (*env)->FatalError(env, "A call to remove in LDKKVStore from rust threw an exception.");
16107         }
16108         void* ret_ptr = untag_ptr(ret);
16109         CHECK_ACCESS(ret_ptr);
16110         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
16111         FREE(untag_ptr(ret));
16112         if (get_jenv_res == JNI_EDETACHED) {
16113                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16114         }
16115         return ret_conv;
16116 }
16117 LDKCResult_CVec_StrZIOErrorZ list_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace) {
16118         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
16119         JNIEnv *env;
16120         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16121         if (get_jenv_res == JNI_EDETACHED) {
16122                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16123         } else {
16124                 DO_ASSERT(get_jenv_res == JNI_OK);
16125         }
16126         LDKStr primary_namespace_str = primary_namespace;
16127         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
16128         Str_free(primary_namespace_str);
16129         LDKStr secondary_namespace_str = secondary_namespace;
16130         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
16131         Str_free(secondary_namespace_str);
16132         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16133         CHECK(obj != NULL);
16134         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->list_meth, primary_namespace_conv, secondary_namespace_conv);
16135         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16136                 (*env)->ExceptionDescribe(env);
16137                 (*env)->FatalError(env, "A call to list in LDKKVStore from rust threw an exception.");
16138         }
16139         void* ret_ptr = untag_ptr(ret);
16140         CHECK_ACCESS(ret_ptr);
16141         LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
16142         FREE(untag_ptr(ret));
16143         if (get_jenv_res == JNI_EDETACHED) {
16144                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16145         }
16146         return ret_conv;
16147 }
16148 static void LDKKVStore_JCalls_cloned(LDKKVStore* new_obj) {
16149         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) new_obj->this_arg;
16150         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16151 }
16152 static inline LDKKVStore LDKKVStore_init (JNIEnv *env, jclass clz, jobject o) {
16153         jclass c = (*env)->GetObjectClass(env, o);
16154         CHECK(c != NULL);
16155         LDKKVStore_JCalls *calls = MALLOC(sizeof(LDKKVStore_JCalls), "LDKKVStore_JCalls");
16156         atomic_init(&calls->refcnt, 1);
16157         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
16158         calls->o = (*env)->NewWeakGlobalRef(env, o);
16159         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J");
16160         CHECK(calls->read_meth != NULL);
16161         calls->write_meth = (*env)->GetMethodID(env, c, "write", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[B)J");
16162         CHECK(calls->write_meth != NULL);
16163         calls->remove_meth = (*env)->GetMethodID(env, c, "remove", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)J");
16164         CHECK(calls->remove_meth != NULL);
16165         calls->list_meth = (*env)->GetMethodID(env, c, "list", "(Ljava/lang/String;Ljava/lang/String;)J");
16166         CHECK(calls->list_meth != NULL);
16167
16168         LDKKVStore ret = {
16169                 .this_arg = (void*) calls,
16170                 .read = read_LDKKVStore_jcall,
16171                 .write = write_LDKKVStore_jcall,
16172                 .remove = remove_LDKKVStore_jcall,
16173                 .list = list_LDKKVStore_jcall,
16174                 .free = LDKKVStore_JCalls_free,
16175         };
16176         return ret;
16177 }
16178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKVStore_1new(JNIEnv *env, jclass clz, jobject o) {
16179         LDKKVStore *res_ptr = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
16180         *res_ptr = LDKKVStore_init(env, clz, o);
16181         return tag_ptr(res_ptr, true);
16182 }
16183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KVStore_1read(JNIEnv *env, jclass clz, int64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key) {
16184         void* this_arg_ptr = untag_ptr(this_arg);
16185         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16186         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
16187         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
16188         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
16189         LDKStr key_conv = java_to_owned_str(env, key);
16190         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
16191         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv);
16192         return tag_ptr(ret_conv, true);
16193 }
16194
16195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KVStore_1write(JNIEnv *env, jclass clz, int64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key, int8_tArray buf) {
16196         void* this_arg_ptr = untag_ptr(this_arg);
16197         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16198         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
16199         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
16200         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
16201         LDKStr key_conv = java_to_owned_str(env, key);
16202         LDKu8slice buf_ref;
16203         buf_ref.datalen = (*env)->GetArrayLength(env, buf);
16204         buf_ref.data = (*env)->GetByteArrayElements (env, buf, NULL);
16205         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
16206         *ret_conv = (this_arg_conv->write)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_ref);
16207         (*env)->ReleaseByteArrayElements(env, buf, (int8_t*)buf_ref.data, 0);
16208         return tag_ptr(ret_conv, true);
16209 }
16210
16211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KVStore_1remove(JNIEnv *env, jclass clz, int64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key, jboolean lazy) {
16212         void* this_arg_ptr = untag_ptr(this_arg);
16213         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16214         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
16215         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
16216         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
16217         LDKStr key_conv = java_to_owned_str(env, key);
16218         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
16219         *ret_conv = (this_arg_conv->remove)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy);
16220         return tag_ptr(ret_conv, true);
16221 }
16222
16223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KVStore_1list(JNIEnv *env, jclass clz, int64_t this_arg, jstring primary_namespace, jstring secondary_namespace) {
16224         void* this_arg_ptr = untag_ptr(this_arg);
16225         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16226         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
16227         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
16228         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
16229         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
16230         *ret_conv = (this_arg_conv->list)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv);
16231         return tag_ptr(ret_conv, true);
16232 }
16233
16234 typedef struct LDKPersister_JCalls {
16235         atomic_size_t refcnt;
16236         JavaVM *vm;
16237         jweak o;
16238         jmethodID persist_manager_meth;
16239         jmethodID persist_graph_meth;
16240         jmethodID persist_scorer_meth;
16241 } LDKPersister_JCalls;
16242 static void LDKPersister_JCalls_free(void* this_arg) {
16243         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
16244         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16245                 JNIEnv *env;
16246                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16247                 if (get_jenv_res == JNI_EDETACHED) {
16248                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16249                 } else {
16250                         DO_ASSERT(get_jenv_res == JNI_OK);
16251                 }
16252                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16253                 if (get_jenv_res == JNI_EDETACHED) {
16254                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16255                 }
16256                 FREE(j_calls);
16257         }
16258 }
16259 LDKCResult_NoneIOErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
16260         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
16261         JNIEnv *env;
16262         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16263         if (get_jenv_res == JNI_EDETACHED) {
16264                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16265         } else {
16266                 DO_ASSERT(get_jenv_res == JNI_OK);
16267         }
16268         LDKChannelManager channel_manager_var = *channel_manager;
16269         int64_t channel_manager_ref = 0;
16270         // WARNING: we may need a move here but no clone is available for LDKChannelManager
16271         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
16272         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
16273         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16274         CHECK(obj != NULL);
16275         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
16276         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16277                 (*env)->ExceptionDescribe(env);
16278                 (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception.");
16279         }
16280         void* ret_ptr = untag_ptr(ret);
16281         CHECK_ACCESS(ret_ptr);
16282         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
16283         FREE(untag_ptr(ret));
16284         if (get_jenv_res == JNI_EDETACHED) {
16285                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16286         }
16287         return ret_conv;
16288 }
16289 LDKCResult_NoneIOErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
16290         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
16291         JNIEnv *env;
16292         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16293         if (get_jenv_res == JNI_EDETACHED) {
16294                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16295         } else {
16296                 DO_ASSERT(get_jenv_res == JNI_OK);
16297         }
16298         LDKNetworkGraph network_graph_var = *network_graph;
16299         int64_t network_graph_ref = 0;
16300         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
16301         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
16302         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
16303         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16304         CHECK(obj != NULL);
16305         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref);
16306         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16307                 (*env)->ExceptionDescribe(env);
16308                 (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception.");
16309         }
16310         void* ret_ptr = untag_ptr(ret);
16311         CHECK_ACCESS(ret_ptr);
16312         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
16313         FREE(untag_ptr(ret));
16314         if (get_jenv_res == JNI_EDETACHED) {
16315                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16316         }
16317         return ret_conv;
16318 }
16319 LDKCResult_NoneIOErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
16320         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
16321         JNIEnv *env;
16322         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16323         if (get_jenv_res == JNI_EDETACHED) {
16324                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16325         } else {
16326                 DO_ASSERT(get_jenv_res == JNI_OK);
16327         }
16328         // WARNING: This object doesn't live past this scope, needs clone!
16329         int64_t ret_scorer = tag_ptr(scorer, false);
16330         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16331         CHECK(obj != NULL);
16332         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_scorer_meth, ret_scorer);
16333         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16334                 (*env)->ExceptionDescribe(env);
16335                 (*env)->FatalError(env, "A call to persist_scorer in LDKPersister from rust threw an exception.");
16336         }
16337         void* ret_ptr = untag_ptr(ret);
16338         CHECK_ACCESS(ret_ptr);
16339         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
16340         FREE(untag_ptr(ret));
16341         if (get_jenv_res == JNI_EDETACHED) {
16342                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16343         }
16344         return ret_conv;
16345 }
16346 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
16347         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
16348         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16349 }
16350 static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) {
16351         jclass c = (*env)->GetObjectClass(env, o);
16352         CHECK(c != NULL);
16353         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
16354         atomic_init(&calls->refcnt, 1);
16355         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
16356         calls->o = (*env)->NewWeakGlobalRef(env, o);
16357         calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
16358         CHECK(calls->persist_manager_meth != NULL);
16359         calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J");
16360         CHECK(calls->persist_graph_meth != NULL);
16361         calls->persist_scorer_meth = (*env)->GetMethodID(env, c, "persist_scorer", "(J)J");
16362         CHECK(calls->persist_scorer_meth != NULL);
16363
16364         LDKPersister ret = {
16365                 .this_arg = (void*) calls,
16366                 .persist_manager = persist_manager_LDKPersister_jcall,
16367                 .persist_graph = persist_graph_LDKPersister_jcall,
16368                 .persist_scorer = persist_scorer_LDKPersister_jcall,
16369                 .free = LDKPersister_JCalls_free,
16370         };
16371         return ret;
16372 }
16373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) {
16374         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
16375         *res_ptr = LDKPersister_init(env, clz, o);
16376         return tag_ptr(res_ptr, true);
16377 }
16378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
16379         void* this_arg_ptr = untag_ptr(this_arg);
16380         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16381         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
16382         LDKChannelManager channel_manager_conv;
16383         channel_manager_conv.inner = untag_ptr(channel_manager);
16384         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
16385         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
16386         channel_manager_conv.is_owned = false;
16387         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
16388         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
16389         return tag_ptr(ret_conv, true);
16390 }
16391
16392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
16393         void* this_arg_ptr = untag_ptr(this_arg);
16394         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16395         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
16396         LDKNetworkGraph network_graph_conv;
16397         network_graph_conv.inner = untag_ptr(network_graph);
16398         network_graph_conv.is_owned = ptr_is_owned(network_graph);
16399         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
16400         network_graph_conv.is_owned = false;
16401         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
16402         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
16403         return tag_ptr(ret_conv, true);
16404 }
16405
16406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1scorer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scorer) {
16407         void* this_arg_ptr = untag_ptr(this_arg);
16408         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16409         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
16410         void* scorer_ptr = untag_ptr(scorer);
16411         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
16412         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
16413         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
16414         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
16415         return tag_ptr(ret_conv, true);
16416 }
16417
16418 typedef struct LDKPersist_JCalls {
16419         atomic_size_t refcnt;
16420         JavaVM *vm;
16421         jweak o;
16422         jmethodID persist_new_channel_meth;
16423         jmethodID update_persisted_channel_meth;
16424 } LDKPersist_JCalls;
16425 static void LDKPersist_JCalls_free(void* this_arg) {
16426         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
16427         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16428                 JNIEnv *env;
16429                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16430                 if (get_jenv_res == JNI_EDETACHED) {
16431                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16432                 } else {
16433                         DO_ASSERT(get_jenv_res == JNI_OK);
16434                 }
16435                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16436                 if (get_jenv_res == JNI_EDETACHED) {
16437                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16438                 }
16439                 FREE(j_calls);
16440         }
16441 }
16442 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
16443         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
16444         JNIEnv *env;
16445         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16446         if (get_jenv_res == JNI_EDETACHED) {
16447                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16448         } else {
16449                 DO_ASSERT(get_jenv_res == JNI_OK);
16450         }
16451         LDKOutPoint channel_id_var = channel_id;
16452         int64_t channel_id_ref = 0;
16453         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
16454         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
16455         LDKChannelMonitor data_var = *data;
16456         int64_t data_ref = 0;
16457         data_var = ChannelMonitor_clone(&data_var);
16458         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
16459         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
16460         LDKMonitorUpdateId update_id_var = update_id;
16461         int64_t update_id_ref = 0;
16462         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
16463         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
16464         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16465         CHECK(obj != NULL);
16466         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
16467         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16468                 (*env)->ExceptionDescribe(env);
16469                 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
16470         }
16471         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
16472         if (get_jenv_res == JNI_EDETACHED) {
16473                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16474         }
16475         return ret_conv;
16476 }
16477 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
16478         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
16479         JNIEnv *env;
16480         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16481         if (get_jenv_res == JNI_EDETACHED) {
16482                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16483         } else {
16484                 DO_ASSERT(get_jenv_res == JNI_OK);
16485         }
16486         LDKOutPoint channel_id_var = channel_id;
16487         int64_t channel_id_ref = 0;
16488         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
16489         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
16490         LDKChannelMonitorUpdate update_var = update;
16491         int64_t update_ref = 0;
16492         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
16493         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
16494         LDKChannelMonitor data_var = *data;
16495         int64_t data_ref = 0;
16496         data_var = ChannelMonitor_clone(&data_var);
16497         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
16498         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
16499         LDKMonitorUpdateId update_id_var = update_id;
16500         int64_t update_id_ref = 0;
16501         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
16502         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
16503         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16504         CHECK(obj != NULL);
16505         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
16506         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16507                 (*env)->ExceptionDescribe(env);
16508                 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
16509         }
16510         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
16511         if (get_jenv_res == JNI_EDETACHED) {
16512                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16513         }
16514         return ret_conv;
16515 }
16516 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
16517         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
16518         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16519 }
16520 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
16521         jclass c = (*env)->GetObjectClass(env, o);
16522         CHECK(c != NULL);
16523         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
16524         atomic_init(&calls->refcnt, 1);
16525         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
16526         calls->o = (*env)->NewWeakGlobalRef(env, o);
16527         calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
16528         CHECK(calls->persist_new_channel_meth != NULL);
16529         calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
16530         CHECK(calls->update_persisted_channel_meth != NULL);
16531
16532         LDKPersist ret = {
16533                 .this_arg = (void*) calls,
16534                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
16535                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
16536                 .free = LDKPersist_JCalls_free,
16537         };
16538         return ret;
16539 }
16540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
16541         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
16542         *res_ptr = LDKPersist_init(env, clz, o);
16543         return tag_ptr(res_ptr, true);
16544 }
16545 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Persist_1persist_1new_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int64_t data, int64_t update_id) {
16546         void* this_arg_ptr = untag_ptr(this_arg);
16547         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16548         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
16549         LDKOutPoint channel_id_conv;
16550         channel_id_conv.inner = untag_ptr(channel_id);
16551         channel_id_conv.is_owned = ptr_is_owned(channel_id);
16552         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
16553         channel_id_conv = OutPoint_clone(&channel_id_conv);
16554         LDKChannelMonitor data_conv;
16555         data_conv.inner = untag_ptr(data);
16556         data_conv.is_owned = ptr_is_owned(data);
16557         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
16558         data_conv.is_owned = false;
16559         LDKMonitorUpdateId update_id_conv;
16560         update_id_conv.inner = untag_ptr(update_id);
16561         update_id_conv.is_owned = ptr_is_owned(update_id);
16562         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
16563         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
16564         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv));
16565         return ret_conv;
16566 }
16567
16568 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int64_t update, int64_t data, int64_t update_id) {
16569         void* this_arg_ptr = untag_ptr(this_arg);
16570         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16571         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
16572         LDKOutPoint channel_id_conv;
16573         channel_id_conv.inner = untag_ptr(channel_id);
16574         channel_id_conv.is_owned = ptr_is_owned(channel_id);
16575         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
16576         channel_id_conv = OutPoint_clone(&channel_id_conv);
16577         LDKChannelMonitorUpdate update_conv;
16578         update_conv.inner = untag_ptr(update);
16579         update_conv.is_owned = ptr_is_owned(update);
16580         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
16581         update_conv = ChannelMonitorUpdate_clone(&update_conv);
16582         LDKChannelMonitor data_conv;
16583         data_conv.inner = untag_ptr(data);
16584         data_conv.is_owned = ptr_is_owned(data);
16585         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
16586         data_conv.is_owned = false;
16587         LDKMonitorUpdateId update_id_conv;
16588         update_id_conv.inner = untag_ptr(update_id);
16589         update_id_conv.is_owned = ptr_is_owned(update_id);
16590         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
16591         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
16592         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, update_conv, &data_conv, update_id_conv));
16593         return ret_conv;
16594 }
16595
16596 typedef struct LDKFutureCallback_JCalls {
16597         atomic_size_t refcnt;
16598         JavaVM *vm;
16599         jweak o;
16600         jmethodID call_meth;
16601 } LDKFutureCallback_JCalls;
16602 static void LDKFutureCallback_JCalls_free(void* this_arg) {
16603         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
16604         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16605                 JNIEnv *env;
16606                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16607                 if (get_jenv_res == JNI_EDETACHED) {
16608                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16609                 } else {
16610                         DO_ASSERT(get_jenv_res == JNI_OK);
16611                 }
16612                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16613                 if (get_jenv_res == JNI_EDETACHED) {
16614                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16615                 }
16616                 FREE(j_calls);
16617         }
16618 }
16619 void call_LDKFutureCallback_jcall(const void* this_arg) {
16620         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
16621         JNIEnv *env;
16622         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16623         if (get_jenv_res == JNI_EDETACHED) {
16624                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16625         } else {
16626                 DO_ASSERT(get_jenv_res == JNI_OK);
16627         }
16628         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16629         CHECK(obj != NULL);
16630         (*env)->CallVoidMethod(env, obj, j_calls->call_meth);
16631         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16632                 (*env)->ExceptionDescribe(env);
16633                 (*env)->FatalError(env, "A call to call in LDKFutureCallback from rust threw an exception.");
16634         }
16635         if (get_jenv_res == JNI_EDETACHED) {
16636                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16637         }
16638 }
16639 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
16640         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
16641         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16642 }
16643 static inline LDKFutureCallback LDKFutureCallback_init (JNIEnv *env, jclass clz, jobject o) {
16644         jclass c = (*env)->GetObjectClass(env, o);
16645         CHECK(c != NULL);
16646         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
16647         atomic_init(&calls->refcnt, 1);
16648         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
16649         calls->o = (*env)->NewWeakGlobalRef(env, o);
16650         calls->call_meth = (*env)->GetMethodID(env, c, "call", "()V");
16651         CHECK(calls->call_meth != NULL);
16652
16653         LDKFutureCallback ret = {
16654                 .this_arg = (void*) calls,
16655                 .call = call_LDKFutureCallback_jcall,
16656                 .free = LDKFutureCallback_JCalls_free,
16657         };
16658         return ret;
16659 }
16660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFutureCallback_1new(JNIEnv *env, jclass clz, jobject o) {
16661         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
16662         *res_ptr = LDKFutureCallback_init(env, clz, o);
16663         return tag_ptr(res_ptr, true);
16664 }
16665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1call(JNIEnv *env, jclass clz, int64_t this_arg) {
16666         void* this_arg_ptr = untag_ptr(this_arg);
16667         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16668         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
16669         (this_arg_conv->call)(this_arg_conv->this_arg);
16670 }
16671
16672 typedef struct LDKListen_JCalls {
16673         atomic_size_t refcnt;
16674         JavaVM *vm;
16675         jweak o;
16676         jmethodID filtered_block_connected_meth;
16677         jmethodID block_connected_meth;
16678         jmethodID block_disconnected_meth;
16679 } LDKListen_JCalls;
16680 static void LDKListen_JCalls_free(void* this_arg) {
16681         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
16682         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16683                 JNIEnv *env;
16684                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16685                 if (get_jenv_res == JNI_EDETACHED) {
16686                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16687                 } else {
16688                         DO_ASSERT(get_jenv_res == JNI_OK);
16689                 }
16690                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16691                 if (get_jenv_res == JNI_EDETACHED) {
16692                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16693                 }
16694                 FREE(j_calls);
16695         }
16696 }
16697 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
16698         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
16699         JNIEnv *env;
16700         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16701         if (get_jenv_res == JNI_EDETACHED) {
16702                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16703         } else {
16704                 DO_ASSERT(get_jenv_res == JNI_OK);
16705         }
16706         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
16707         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
16708         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
16709         int64_tArray txdata_arr = NULL;
16710         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
16711         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
16712         for (size_t c = 0; c < txdata_var.datalen; c++) {
16713                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
16714                 *txdata_conv_28_conv = txdata_var.data[c];
16715                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
16716         }
16717         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
16718         FREE(txdata_var.data);
16719         int32_t height_conv = height;
16720         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16721         CHECK(obj != NULL);
16722         (*env)->CallVoidMethod(env, obj, j_calls->filtered_block_connected_meth, header_arr, txdata_arr, height_conv);
16723         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16724                 (*env)->ExceptionDescribe(env);
16725                 (*env)->FatalError(env, "A call to filtered_block_connected in LDKListen from rust threw an exception.");
16726         }
16727         if (get_jenv_res == JNI_EDETACHED) {
16728                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16729         }
16730 }
16731 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
16732         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
16733         JNIEnv *env;
16734         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16735         if (get_jenv_res == JNI_EDETACHED) {
16736                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16737         } else {
16738                 DO_ASSERT(get_jenv_res == JNI_OK);
16739         }
16740         LDKu8slice block_var = block;
16741         int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
16742         (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
16743         int32_t height_conv = height;
16744         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16745         CHECK(obj != NULL);
16746         (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height_conv);
16747         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16748                 (*env)->ExceptionDescribe(env);
16749                 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
16750         }
16751         if (get_jenv_res == JNI_EDETACHED) {
16752                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16753         }
16754 }
16755 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
16756         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
16757         JNIEnv *env;
16758         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16759         if (get_jenv_res == JNI_EDETACHED) {
16760                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16761         } else {
16762                 DO_ASSERT(get_jenv_res == JNI_OK);
16763         }
16764         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
16765         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
16766         int32_t height_conv = height;
16767         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16768         CHECK(obj != NULL);
16769         (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height_conv);
16770         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16771                 (*env)->ExceptionDescribe(env);
16772                 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
16773         }
16774         if (get_jenv_res == JNI_EDETACHED) {
16775                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16776         }
16777 }
16778 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
16779         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
16780         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16781 }
16782 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
16783         jclass c = (*env)->GetObjectClass(env, o);
16784         CHECK(c != NULL);
16785         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
16786         atomic_init(&calls->refcnt, 1);
16787         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
16788         calls->o = (*env)->NewWeakGlobalRef(env, o);
16789         calls->filtered_block_connected_meth = (*env)->GetMethodID(env, c, "filtered_block_connected", "([B[JI)V");
16790         CHECK(calls->filtered_block_connected_meth != NULL);
16791         calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
16792         CHECK(calls->block_connected_meth != NULL);
16793         calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
16794         CHECK(calls->block_disconnected_meth != NULL);
16795
16796         LDKListen ret = {
16797                 .this_arg = (void*) calls,
16798                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
16799                 .block_connected = block_connected_LDKListen_jcall,
16800                 .block_disconnected = block_disconnected_LDKListen_jcall,
16801                 .free = LDKListen_JCalls_free,
16802         };
16803         return ret;
16804 }
16805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
16806         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
16807         *res_ptr = LDKListen_init(env, clz, o);
16808         return tag_ptr(res_ptr, true);
16809 }
16810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1filtered_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
16811         void* this_arg_ptr = untag_ptr(this_arg);
16812         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16813         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
16814         uint8_t header_arr[80];
16815         CHECK((*env)->GetArrayLength(env, header) == 80);
16816         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
16817         uint8_t (*header_ref)[80] = &header_arr;
16818         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
16819         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
16820         if (txdata_constr.datalen > 0)
16821                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
16822         else
16823                 txdata_constr.data = NULL;
16824         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
16825         for (size_t c = 0; c < txdata_constr.datalen; c++) {
16826                 int64_t txdata_conv_28 = txdata_vals[c];
16827                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
16828                 CHECK_ACCESS(txdata_conv_28_ptr);
16829                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
16830                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
16831                 txdata_constr.data[c] = txdata_conv_28_conv;
16832         }
16833         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
16834         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
16835 }
16836
16837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray block, int32_t height) {
16838         void* this_arg_ptr = untag_ptr(this_arg);
16839         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16840         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
16841         LDKu8slice block_ref;
16842         block_ref.datalen = (*env)->GetArrayLength(env, block);
16843         block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
16844         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
16845         (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
16846 }
16847
16848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height) {
16849         void* this_arg_ptr = untag_ptr(this_arg);
16850         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16851         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
16852         uint8_t header_arr[80];
16853         CHECK((*env)->GetArrayLength(env, header) == 80);
16854         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
16855         uint8_t (*header_ref)[80] = &header_arr;
16856         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
16857 }
16858
16859 typedef struct LDKConfirm_JCalls {
16860         atomic_size_t refcnt;
16861         JavaVM *vm;
16862         jweak o;
16863         jmethodID transactions_confirmed_meth;
16864         jmethodID transaction_unconfirmed_meth;
16865         jmethodID best_block_updated_meth;
16866         jmethodID get_relevant_txids_meth;
16867 } LDKConfirm_JCalls;
16868 static void LDKConfirm_JCalls_free(void* this_arg) {
16869         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
16870         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16871                 JNIEnv *env;
16872                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16873                 if (get_jenv_res == JNI_EDETACHED) {
16874                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16875                 } else {
16876                         DO_ASSERT(get_jenv_res == JNI_OK);
16877                 }
16878                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16879                 if (get_jenv_res == JNI_EDETACHED) {
16880                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16881                 }
16882                 FREE(j_calls);
16883         }
16884 }
16885 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
16886         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
16887         JNIEnv *env;
16888         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16889         if (get_jenv_res == JNI_EDETACHED) {
16890                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16891         } else {
16892                 DO_ASSERT(get_jenv_res == JNI_OK);
16893         }
16894         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
16895         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
16896         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
16897         int64_tArray txdata_arr = NULL;
16898         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
16899         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
16900         for (size_t c = 0; c < txdata_var.datalen; c++) {
16901                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
16902                 *txdata_conv_28_conv = txdata_var.data[c];
16903                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
16904         }
16905         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
16906         FREE(txdata_var.data);
16907         int32_t height_conv = height;
16908         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16909         CHECK(obj != NULL);
16910         (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height_conv);
16911         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16912                 (*env)->ExceptionDescribe(env);
16913                 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
16914         }
16915         if (get_jenv_res == JNI_EDETACHED) {
16916                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16917         }
16918 }
16919 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
16920         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
16921         JNIEnv *env;
16922         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16923         if (get_jenv_res == JNI_EDETACHED) {
16924                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16925         } else {
16926                 DO_ASSERT(get_jenv_res == JNI_OK);
16927         }
16928         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
16929         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
16930         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16931         CHECK(obj != NULL);
16932         (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
16933         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16934                 (*env)->ExceptionDescribe(env);
16935                 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
16936         }
16937         if (get_jenv_res == JNI_EDETACHED) {
16938                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16939         }
16940 }
16941 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
16942         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
16943         JNIEnv *env;
16944         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16945         if (get_jenv_res == JNI_EDETACHED) {
16946                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16947         } else {
16948                 DO_ASSERT(get_jenv_res == JNI_OK);
16949         }
16950         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
16951         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
16952         int32_t height_conv = height;
16953         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16954         CHECK(obj != NULL);
16955         (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height_conv);
16956         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16957                 (*env)->ExceptionDescribe(env);
16958                 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
16959         }
16960         if (get_jenv_res == JNI_EDETACHED) {
16961                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16962         }
16963 }
16964 LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
16965         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
16966         JNIEnv *env;
16967         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16968         if (get_jenv_res == JNI_EDETACHED) {
16969                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16970         } else {
16971                 DO_ASSERT(get_jenv_res == JNI_OK);
16972         }
16973         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16974         CHECK(obj != NULL);
16975         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
16976         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16977                 (*env)->ExceptionDescribe(env);
16978                 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
16979         }
16980         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_constr;
16981         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
16982         if (ret_constr.datalen > 0)
16983                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
16984         else
16985                 ret_constr.data = NULL;
16986         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
16987         for (size_t c = 0; c < ret_constr.datalen; c++) {
16988                 int64_t ret_conv_54 = ret_vals[c];
16989                 void* ret_conv_54_ptr = untag_ptr(ret_conv_54);
16990                 CHECK_ACCESS(ret_conv_54_ptr);
16991                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ ret_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(ret_conv_54_ptr);
16992                 FREE(untag_ptr(ret_conv_54));
16993                 ret_constr.data[c] = ret_conv_54_conv;
16994         }
16995         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
16996         if (get_jenv_res == JNI_EDETACHED) {
16997                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16998         }
16999         return ret_constr;
17000 }
17001 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
17002         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
17003         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17004 }
17005 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
17006         jclass c = (*env)->GetObjectClass(env, o);
17007         CHECK(c != NULL);
17008         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
17009         atomic_init(&calls->refcnt, 1);
17010         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17011         calls->o = (*env)->NewWeakGlobalRef(env, o);
17012         calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
17013         CHECK(calls->transactions_confirmed_meth != NULL);
17014         calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
17015         CHECK(calls->transaction_unconfirmed_meth != NULL);
17016         calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
17017         CHECK(calls->best_block_updated_meth != NULL);
17018         calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[J");
17019         CHECK(calls->get_relevant_txids_meth != NULL);
17020
17021         LDKConfirm ret = {
17022                 .this_arg = (void*) calls,
17023                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
17024                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
17025                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
17026                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
17027                 .free = LDKConfirm_JCalls_free,
17028         };
17029         return ret;
17030 }
17031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
17032         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
17033         *res_ptr = LDKConfirm_init(env, clz, o);
17034         return tag_ptr(res_ptr, true);
17035 }
17036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transactions_1confirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
17037         void* this_arg_ptr = untag_ptr(this_arg);
17038         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17039         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
17040         uint8_t header_arr[80];
17041         CHECK((*env)->GetArrayLength(env, header) == 80);
17042         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
17043         uint8_t (*header_ref)[80] = &header_arr;
17044         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
17045         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
17046         if (txdata_constr.datalen > 0)
17047                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
17048         else
17049                 txdata_constr.data = NULL;
17050         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
17051         for (size_t c = 0; c < txdata_constr.datalen; c++) {
17052                 int64_t txdata_conv_28 = txdata_vals[c];
17053                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
17054                 CHECK_ACCESS(txdata_conv_28_ptr);
17055                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
17056                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
17057                 txdata_constr.data[c] = txdata_conv_28_conv;
17058         }
17059         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
17060         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
17061 }
17062
17063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
17064         void* this_arg_ptr = untag_ptr(this_arg);
17065         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17066         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
17067         uint8_t txid_arr[32];
17068         CHECK((*env)->GetArrayLength(env, txid) == 32);
17069         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
17070         uint8_t (*txid_ref)[32] = &txid_arr;
17071         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
17072 }
17073
17074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1best_1block_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height) {
17075         void* this_arg_ptr = untag_ptr(this_arg);
17076         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17077         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
17078         uint8_t header_arr[80];
17079         CHECK((*env)->GetArrayLength(env, header) == 80);
17080         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
17081         uint8_t (*header_ref)[80] = &header_arr;
17082         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
17083 }
17084
17085 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
17086         void* this_arg_ptr = untag_ptr(this_arg);
17087         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17088         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
17089         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
17090         int64_tArray ret_arr = NULL;
17091         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17092         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17093         for (size_t c = 0; c < ret_var.datalen; c++) {
17094                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
17095                 *ret_conv_54_conv = ret_var.data[c];
17096                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
17097         }
17098         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17099         FREE(ret_var.data);
17100         return ret_arr;
17101 }
17102
17103 typedef struct LDKEventHandler_JCalls {
17104         atomic_size_t refcnt;
17105         JavaVM *vm;
17106         jweak o;
17107         jmethodID handle_event_meth;
17108 } LDKEventHandler_JCalls;
17109 static void LDKEventHandler_JCalls_free(void* this_arg) {
17110         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
17111         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17112                 JNIEnv *env;
17113                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17114                 if (get_jenv_res == JNI_EDETACHED) {
17115                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17116                 } else {
17117                         DO_ASSERT(get_jenv_res == JNI_OK);
17118                 }
17119                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17120                 if (get_jenv_res == JNI_EDETACHED) {
17121                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17122                 }
17123                 FREE(j_calls);
17124         }
17125 }
17126 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
17127         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
17128         JNIEnv *env;
17129         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17130         if (get_jenv_res == JNI_EDETACHED) {
17131                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17132         } else {
17133                 DO_ASSERT(get_jenv_res == JNI_OK);
17134         }
17135         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
17136         *event_copy = event;
17137         int64_t event_ref = tag_ptr(event_copy, true);
17138         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17139         CHECK(obj != NULL);
17140         (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
17141         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17142                 (*env)->ExceptionDescribe(env);
17143                 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
17144         }
17145         if (get_jenv_res == JNI_EDETACHED) {
17146                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17147         }
17148 }
17149 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
17150         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
17151         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17152 }
17153 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
17154         jclass c = (*env)->GetObjectClass(env, o);
17155         CHECK(c != NULL);
17156         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
17157         atomic_init(&calls->refcnt, 1);
17158         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17159         calls->o = (*env)->NewWeakGlobalRef(env, o);
17160         calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
17161         CHECK(calls->handle_event_meth != NULL);
17162
17163         LDKEventHandler ret = {
17164                 .this_arg = (void*) calls,
17165                 .handle_event = handle_event_LDKEventHandler_jcall,
17166                 .free = LDKEventHandler_JCalls_free,
17167         };
17168         return ret;
17169 }
17170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
17171         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
17172         *res_ptr = LDKEventHandler_init(env, clz, o);
17173         return tag_ptr(res_ptr, true);
17174 }
17175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
17176         void* this_arg_ptr = untag_ptr(this_arg);
17177         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17178         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
17179         void* event_ptr = untag_ptr(event);
17180         CHECK_ACCESS(event_ptr);
17181         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
17182         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
17183         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
17184 }
17185
17186 typedef struct LDKEventsProvider_JCalls {
17187         atomic_size_t refcnt;
17188         JavaVM *vm;
17189         jweak o;
17190         jmethodID process_pending_events_meth;
17191 } LDKEventsProvider_JCalls;
17192 static void LDKEventsProvider_JCalls_free(void* this_arg) {
17193         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
17194         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17195                 JNIEnv *env;
17196                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17197                 if (get_jenv_res == JNI_EDETACHED) {
17198                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17199                 } else {
17200                         DO_ASSERT(get_jenv_res == JNI_OK);
17201                 }
17202                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17203                 if (get_jenv_res == JNI_EDETACHED) {
17204                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17205                 }
17206                 FREE(j_calls);
17207         }
17208 }
17209 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
17210         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
17211         JNIEnv *env;
17212         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17213         if (get_jenv_res == JNI_EDETACHED) {
17214                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17215         } else {
17216                 DO_ASSERT(get_jenv_res == JNI_OK);
17217         }
17218         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
17219         *handler_ret = handler;
17220         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17221         CHECK(obj != NULL);
17222         (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, tag_ptr(handler_ret, true));
17223         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17224                 (*env)->ExceptionDescribe(env);
17225                 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
17226         }
17227         if (get_jenv_res == JNI_EDETACHED) {
17228                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17229         }
17230 }
17231 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
17232         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
17233         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17234 }
17235 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
17236         jclass c = (*env)->GetObjectClass(env, o);
17237         CHECK(c != NULL);
17238         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
17239         atomic_init(&calls->refcnt, 1);
17240         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17241         calls->o = (*env)->NewWeakGlobalRef(env, o);
17242         calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
17243         CHECK(calls->process_pending_events_meth != NULL);
17244
17245         LDKEventsProvider ret = {
17246                 .this_arg = (void*) calls,
17247                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
17248                 .free = LDKEventsProvider_JCalls_free,
17249         };
17250         return ret;
17251 }
17252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
17253         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
17254         *res_ptr = LDKEventsProvider_init(env, clz, o);
17255         return tag_ptr(res_ptr, true);
17256 }
17257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
17258         void* this_arg_ptr = untag_ptr(this_arg);
17259         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17260         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
17261         void* handler_ptr = untag_ptr(handler);
17262         CHECK_ACCESS(handler_ptr);
17263         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
17264         if (handler_conv.free == LDKEventHandler_JCalls_free) {
17265                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17266                 LDKEventHandler_JCalls_cloned(&handler_conv);
17267         }
17268         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
17269 }
17270
17271 static jclass LDKFailureCode_TemporaryNodeFailure_class = NULL;
17272 static jmethodID LDKFailureCode_TemporaryNodeFailure_meth = NULL;
17273 static jclass LDKFailureCode_RequiredNodeFeatureMissing_class = NULL;
17274 static jmethodID LDKFailureCode_RequiredNodeFeatureMissing_meth = NULL;
17275 static jclass LDKFailureCode_IncorrectOrUnknownPaymentDetails_class = NULL;
17276 static jmethodID LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth = NULL;
17277 static jclass LDKFailureCode_InvalidOnionPayload_class = NULL;
17278 static jmethodID LDKFailureCode_InvalidOnionPayload_meth = NULL;
17279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFailureCode_init (JNIEnv *env, jclass clz) {
17280         LDKFailureCode_TemporaryNodeFailure_class =
17281                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$TemporaryNodeFailure"));
17282         CHECK(LDKFailureCode_TemporaryNodeFailure_class != NULL);
17283         LDKFailureCode_TemporaryNodeFailure_meth = (*env)->GetMethodID(env, LDKFailureCode_TemporaryNodeFailure_class, "<init>", "()V");
17284         CHECK(LDKFailureCode_TemporaryNodeFailure_meth != NULL);
17285         LDKFailureCode_RequiredNodeFeatureMissing_class =
17286                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$RequiredNodeFeatureMissing"));
17287         CHECK(LDKFailureCode_RequiredNodeFeatureMissing_class != NULL);
17288         LDKFailureCode_RequiredNodeFeatureMissing_meth = (*env)->GetMethodID(env, LDKFailureCode_RequiredNodeFeatureMissing_class, "<init>", "()V");
17289         CHECK(LDKFailureCode_RequiredNodeFeatureMissing_meth != NULL);
17290         LDKFailureCode_IncorrectOrUnknownPaymentDetails_class =
17291                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$IncorrectOrUnknownPaymentDetails"));
17292         CHECK(LDKFailureCode_IncorrectOrUnknownPaymentDetails_class != NULL);
17293         LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth = (*env)->GetMethodID(env, LDKFailureCode_IncorrectOrUnknownPaymentDetails_class, "<init>", "()V");
17294         CHECK(LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth != NULL);
17295         LDKFailureCode_InvalidOnionPayload_class =
17296                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$InvalidOnionPayload"));
17297         CHECK(LDKFailureCode_InvalidOnionPayload_class != NULL);
17298         LDKFailureCode_InvalidOnionPayload_meth = (*env)->GetMethodID(env, LDKFailureCode_InvalidOnionPayload_class, "<init>", "(J)V");
17299         CHECK(LDKFailureCode_InvalidOnionPayload_meth != NULL);
17300 }
17301 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFailureCode_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
17302         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
17303         switch(obj->tag) {
17304                 case LDKFailureCode_TemporaryNodeFailure: {
17305                         return (*env)->NewObject(env, LDKFailureCode_TemporaryNodeFailure_class, LDKFailureCode_TemporaryNodeFailure_meth);
17306                 }
17307                 case LDKFailureCode_RequiredNodeFeatureMissing: {
17308                         return (*env)->NewObject(env, LDKFailureCode_RequiredNodeFeatureMissing_class, LDKFailureCode_RequiredNodeFeatureMissing_meth);
17309                 }
17310                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: {
17311                         return (*env)->NewObject(env, LDKFailureCode_IncorrectOrUnknownPaymentDetails_class, LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth);
17312                 }
17313                 case LDKFailureCode_InvalidOnionPayload: {
17314                         int64_t invalid_onion_payload_ref = tag_ptr(&obj->invalid_onion_payload, false);
17315                         return (*env)->NewObject(env, LDKFailureCode_InvalidOnionPayload_class, LDKFailureCode_InvalidOnionPayload_meth, invalid_onion_payload_ref);
17316                 }
17317                 default: abort();
17318         }
17319 }
17320 typedef struct LDKMessageSendEventsProvider_JCalls {
17321         atomic_size_t refcnt;
17322         JavaVM *vm;
17323         jweak o;
17324         jmethodID get_and_clear_pending_msg_events_meth;
17325 } LDKMessageSendEventsProvider_JCalls;
17326 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
17327         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
17328         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17329                 JNIEnv *env;
17330                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17331                 if (get_jenv_res == JNI_EDETACHED) {
17332                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17333                 } else {
17334                         DO_ASSERT(get_jenv_res == JNI_OK);
17335                 }
17336                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17337                 if (get_jenv_res == JNI_EDETACHED) {
17338                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17339                 }
17340                 FREE(j_calls);
17341         }
17342 }
17343 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
17344         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
17345         JNIEnv *env;
17346         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17347         if (get_jenv_res == JNI_EDETACHED) {
17348                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17349         } else {
17350                 DO_ASSERT(get_jenv_res == JNI_OK);
17351         }
17352         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17353         CHECK(obj != NULL);
17354         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
17355         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17356                 (*env)->ExceptionDescribe(env);
17357                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
17358         }
17359         LDKCVec_MessageSendEventZ ret_constr;
17360         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
17361         if (ret_constr.datalen > 0)
17362                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
17363         else
17364                 ret_constr.data = NULL;
17365         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
17366         for (size_t s = 0; s < ret_constr.datalen; s++) {
17367                 int64_t ret_conv_18 = ret_vals[s];
17368                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
17369                 CHECK_ACCESS(ret_conv_18_ptr);
17370                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
17371                 FREE(untag_ptr(ret_conv_18));
17372                 ret_constr.data[s] = ret_conv_18_conv;
17373         }
17374         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
17375         if (get_jenv_res == JNI_EDETACHED) {
17376                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17377         }
17378         return ret_constr;
17379 }
17380 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
17381         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
17382         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17383 }
17384 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
17385         jclass c = (*env)->GetObjectClass(env, o);
17386         CHECK(c != NULL);
17387         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
17388         atomic_init(&calls->refcnt, 1);
17389         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17390         calls->o = (*env)->NewWeakGlobalRef(env, o);
17391         calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
17392         CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
17393
17394         LDKMessageSendEventsProvider ret = {
17395                 .this_arg = (void*) calls,
17396                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
17397                 .free = LDKMessageSendEventsProvider_JCalls_free,
17398         };
17399         return ret;
17400 }
17401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
17402         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
17403         *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
17404         return tag_ptr(res_ptr, true);
17405 }
17406 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
17407         void* this_arg_ptr = untag_ptr(this_arg);
17408         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17409         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
17410         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
17411         int64_tArray ret_arr = NULL;
17412         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17413         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17414         for (size_t s = 0; s < ret_var.datalen; s++) {
17415                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
17416                 *ret_conv_18_copy = ret_var.data[s];
17417                 int64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
17418                 ret_arr_ptr[s] = ret_conv_18_ref;
17419         }
17420         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17421         FREE(ret_var.data);
17422         return ret_arr;
17423 }
17424
17425 typedef struct LDKChannelMessageHandler_JCalls {
17426         atomic_size_t refcnt;
17427         JavaVM *vm;
17428         jweak o;
17429         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
17430         jmethodID handle_open_channel_meth;
17431         jmethodID handle_open_channel_v2_meth;
17432         jmethodID handle_accept_channel_meth;
17433         jmethodID handle_accept_channel_v2_meth;
17434         jmethodID handle_funding_created_meth;
17435         jmethodID handle_funding_signed_meth;
17436         jmethodID handle_channel_ready_meth;
17437         jmethodID handle_shutdown_meth;
17438         jmethodID handle_closing_signed_meth;
17439         jmethodID handle_stfu_meth;
17440         jmethodID handle_splice_meth;
17441         jmethodID handle_splice_ack_meth;
17442         jmethodID handle_splice_locked_meth;
17443         jmethodID handle_tx_add_input_meth;
17444         jmethodID handle_tx_add_output_meth;
17445         jmethodID handle_tx_remove_input_meth;
17446         jmethodID handle_tx_remove_output_meth;
17447         jmethodID handle_tx_complete_meth;
17448         jmethodID handle_tx_signatures_meth;
17449         jmethodID handle_tx_init_rbf_meth;
17450         jmethodID handle_tx_ack_rbf_meth;
17451         jmethodID handle_tx_abort_meth;
17452         jmethodID handle_update_add_htlc_meth;
17453         jmethodID handle_update_fulfill_htlc_meth;
17454         jmethodID handle_update_fail_htlc_meth;
17455         jmethodID handle_update_fail_malformed_htlc_meth;
17456         jmethodID handle_commitment_signed_meth;
17457         jmethodID handle_revoke_and_ack_meth;
17458         jmethodID handle_update_fee_meth;
17459         jmethodID handle_announcement_signatures_meth;
17460         jmethodID peer_disconnected_meth;
17461         jmethodID peer_connected_meth;
17462         jmethodID handle_channel_reestablish_meth;
17463         jmethodID handle_channel_update_meth;
17464         jmethodID handle_error_meth;
17465         jmethodID provided_node_features_meth;
17466         jmethodID provided_init_features_meth;
17467         jmethodID get_chain_hashes_meth;
17468 } LDKChannelMessageHandler_JCalls;
17469 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
17470         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17471         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17472                 JNIEnv *env;
17473                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17474                 if (get_jenv_res == JNI_EDETACHED) {
17475                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17476                 } else {
17477                         DO_ASSERT(get_jenv_res == JNI_OK);
17478                 }
17479                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17480                 if (get_jenv_res == JNI_EDETACHED) {
17481                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17482                 }
17483                 FREE(j_calls);
17484         }
17485 }
17486 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
17487         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17488         JNIEnv *env;
17489         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17490         if (get_jenv_res == JNI_EDETACHED) {
17491                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17492         } else {
17493                 DO_ASSERT(get_jenv_res == JNI_OK);
17494         }
17495         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17496         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17497         LDKOpenChannel msg_var = *msg;
17498         int64_t msg_ref = 0;
17499         msg_var = OpenChannel_clone(&msg_var);
17500         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17501         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17502         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17503         CHECK(obj != NULL);
17504         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, msg_ref);
17505         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17506                 (*env)->ExceptionDescribe(env);
17507                 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
17508         }
17509         if (get_jenv_res == JNI_EDETACHED) {
17510                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17511         }
17512 }
17513 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
17514         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17515         JNIEnv *env;
17516         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17517         if (get_jenv_res == JNI_EDETACHED) {
17518                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17519         } else {
17520                 DO_ASSERT(get_jenv_res == JNI_OK);
17521         }
17522         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17523         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17524         LDKOpenChannelV2 msg_var = *msg;
17525         int64_t msg_ref = 0;
17526         msg_var = OpenChannelV2_clone(&msg_var);
17527         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17528         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17529         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17530         CHECK(obj != NULL);
17531         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_v2_meth, their_node_id_arr, msg_ref);
17532         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17533                 (*env)->ExceptionDescribe(env);
17534                 (*env)->FatalError(env, "A call to handle_open_channel_v2 in LDKChannelMessageHandler from rust threw an exception.");
17535         }
17536         if (get_jenv_res == JNI_EDETACHED) {
17537                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17538         }
17539 }
17540 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
17541         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17542         JNIEnv *env;
17543         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17544         if (get_jenv_res == JNI_EDETACHED) {
17545                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17546         } else {
17547                 DO_ASSERT(get_jenv_res == JNI_OK);
17548         }
17549         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17550         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17551         LDKAcceptChannel msg_var = *msg;
17552         int64_t msg_ref = 0;
17553         msg_var = AcceptChannel_clone(&msg_var);
17554         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17555         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17556         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17557         CHECK(obj != NULL);
17558         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, msg_ref);
17559         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17560                 (*env)->ExceptionDescribe(env);
17561                 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
17562         }
17563         if (get_jenv_res == JNI_EDETACHED) {
17564                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17565         }
17566 }
17567 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
17568         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17569         JNIEnv *env;
17570         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17571         if (get_jenv_res == JNI_EDETACHED) {
17572                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17573         } else {
17574                 DO_ASSERT(get_jenv_res == JNI_OK);
17575         }
17576         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17577         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17578         LDKAcceptChannelV2 msg_var = *msg;
17579         int64_t msg_ref = 0;
17580         msg_var = AcceptChannelV2_clone(&msg_var);
17581         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17582         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17583         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17584         CHECK(obj != NULL);
17585         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_v2_meth, their_node_id_arr, msg_ref);
17586         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17587                 (*env)->ExceptionDescribe(env);
17588                 (*env)->FatalError(env, "A call to handle_accept_channel_v2 in LDKChannelMessageHandler from rust threw an exception.");
17589         }
17590         if (get_jenv_res == JNI_EDETACHED) {
17591                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17592         }
17593 }
17594 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
17595         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17596         JNIEnv *env;
17597         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17598         if (get_jenv_res == JNI_EDETACHED) {
17599                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17600         } else {
17601                 DO_ASSERT(get_jenv_res == JNI_OK);
17602         }
17603         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17604         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17605         LDKFundingCreated msg_var = *msg;
17606         int64_t msg_ref = 0;
17607         msg_var = FundingCreated_clone(&msg_var);
17608         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17609         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17610         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17611         CHECK(obj != NULL);
17612         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
17613         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17614                 (*env)->ExceptionDescribe(env);
17615                 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
17616         }
17617         if (get_jenv_res == JNI_EDETACHED) {
17618                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17619         }
17620 }
17621 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
17622         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17623         JNIEnv *env;
17624         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17625         if (get_jenv_res == JNI_EDETACHED) {
17626                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17627         } else {
17628                 DO_ASSERT(get_jenv_res == JNI_OK);
17629         }
17630         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17631         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17632         LDKFundingSigned msg_var = *msg;
17633         int64_t msg_ref = 0;
17634         msg_var = FundingSigned_clone(&msg_var);
17635         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17636         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17637         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17638         CHECK(obj != NULL);
17639         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
17640         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17641                 (*env)->ExceptionDescribe(env);
17642                 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
17643         }
17644         if (get_jenv_res == JNI_EDETACHED) {
17645                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17646         }
17647 }
17648 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
17649         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17650         JNIEnv *env;
17651         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17652         if (get_jenv_res == JNI_EDETACHED) {
17653                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17654         } else {
17655                 DO_ASSERT(get_jenv_res == JNI_OK);
17656         }
17657         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17658         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17659         LDKChannelReady msg_var = *msg;
17660         int64_t msg_ref = 0;
17661         msg_var = ChannelReady_clone(&msg_var);
17662         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17663         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17664         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17665         CHECK(obj != NULL);
17666         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_ready_meth, their_node_id_arr, msg_ref);
17667         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17668                 (*env)->ExceptionDescribe(env);
17669                 (*env)->FatalError(env, "A call to handle_channel_ready in LDKChannelMessageHandler from rust threw an exception.");
17670         }
17671         if (get_jenv_res == JNI_EDETACHED) {
17672                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17673         }
17674 }
17675 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
17676         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17677         JNIEnv *env;
17678         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17679         if (get_jenv_res == JNI_EDETACHED) {
17680                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17681         } else {
17682                 DO_ASSERT(get_jenv_res == JNI_OK);
17683         }
17684         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17685         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17686         LDKShutdown msg_var = *msg;
17687         int64_t msg_ref = 0;
17688         msg_var = Shutdown_clone(&msg_var);
17689         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17690         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17691         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17692         CHECK(obj != NULL);
17693         (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref);
17694         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17695                 (*env)->ExceptionDescribe(env);
17696                 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
17697         }
17698         if (get_jenv_res == JNI_EDETACHED) {
17699                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17700         }
17701 }
17702 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
17703         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17704         JNIEnv *env;
17705         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17706         if (get_jenv_res == JNI_EDETACHED) {
17707                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17708         } else {
17709                 DO_ASSERT(get_jenv_res == JNI_OK);
17710         }
17711         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17712         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17713         LDKClosingSigned msg_var = *msg;
17714         int64_t msg_ref = 0;
17715         msg_var = ClosingSigned_clone(&msg_var);
17716         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17717         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17718         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17719         CHECK(obj != NULL);
17720         (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
17721         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17722                 (*env)->ExceptionDescribe(env);
17723                 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
17724         }
17725         if (get_jenv_res == JNI_EDETACHED) {
17726                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17727         }
17728 }
17729 void handle_stfu_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKStfu * msg) {
17730         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17731         JNIEnv *env;
17732         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17733         if (get_jenv_res == JNI_EDETACHED) {
17734                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17735         } else {
17736                 DO_ASSERT(get_jenv_res == JNI_OK);
17737         }
17738         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17739         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17740         LDKStfu msg_var = *msg;
17741         int64_t msg_ref = 0;
17742         msg_var = Stfu_clone(&msg_var);
17743         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17744         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17745         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17746         CHECK(obj != NULL);
17747         (*env)->CallVoidMethod(env, obj, j_calls->handle_stfu_meth, their_node_id_arr, msg_ref);
17748         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17749                 (*env)->ExceptionDescribe(env);
17750                 (*env)->FatalError(env, "A call to handle_stfu in LDKChannelMessageHandler from rust threw an exception.");
17751         }
17752         if (get_jenv_res == JNI_EDETACHED) {
17753                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17754         }
17755 }
17756 void handle_splice_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKSplice * msg) {
17757         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17758         JNIEnv *env;
17759         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17760         if (get_jenv_res == JNI_EDETACHED) {
17761                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17762         } else {
17763                 DO_ASSERT(get_jenv_res == JNI_OK);
17764         }
17765         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17766         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17767         LDKSplice msg_var = *msg;
17768         int64_t msg_ref = 0;
17769         msg_var = Splice_clone(&msg_var);
17770         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17771         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17772         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17773         CHECK(obj != NULL);
17774         (*env)->CallVoidMethod(env, obj, j_calls->handle_splice_meth, their_node_id_arr, msg_ref);
17775         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17776                 (*env)->ExceptionDescribe(env);
17777                 (*env)->FatalError(env, "A call to handle_splice in LDKChannelMessageHandler from rust threw an exception.");
17778         }
17779         if (get_jenv_res == JNI_EDETACHED) {
17780                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17781         }
17782 }
17783 void handle_splice_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKSpliceAck * msg) {
17784         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17785         JNIEnv *env;
17786         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17787         if (get_jenv_res == JNI_EDETACHED) {
17788                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17789         } else {
17790                 DO_ASSERT(get_jenv_res == JNI_OK);
17791         }
17792         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17793         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17794         LDKSpliceAck msg_var = *msg;
17795         int64_t msg_ref = 0;
17796         msg_var = SpliceAck_clone(&msg_var);
17797         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17798         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17799         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17800         CHECK(obj != NULL);
17801         (*env)->CallVoidMethod(env, obj, j_calls->handle_splice_ack_meth, their_node_id_arr, msg_ref);
17802         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17803                 (*env)->ExceptionDescribe(env);
17804                 (*env)->FatalError(env, "A call to handle_splice_ack in LDKChannelMessageHandler from rust threw an exception.");
17805         }
17806         if (get_jenv_res == JNI_EDETACHED) {
17807                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17808         }
17809 }
17810 void handle_splice_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKSpliceLocked * msg) {
17811         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17812         JNIEnv *env;
17813         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17814         if (get_jenv_res == JNI_EDETACHED) {
17815                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17816         } else {
17817                 DO_ASSERT(get_jenv_res == JNI_OK);
17818         }
17819         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17820         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17821         LDKSpliceLocked msg_var = *msg;
17822         int64_t msg_ref = 0;
17823         msg_var = SpliceLocked_clone(&msg_var);
17824         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17825         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17826         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17827         CHECK(obj != NULL);
17828         (*env)->CallVoidMethod(env, obj, j_calls->handle_splice_locked_meth, their_node_id_arr, msg_ref);
17829         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17830                 (*env)->ExceptionDescribe(env);
17831                 (*env)->FatalError(env, "A call to handle_splice_locked in LDKChannelMessageHandler from rust threw an exception.");
17832         }
17833         if (get_jenv_res == JNI_EDETACHED) {
17834                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17835         }
17836 }
17837 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
17838         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17839         JNIEnv *env;
17840         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17841         if (get_jenv_res == JNI_EDETACHED) {
17842                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17843         } else {
17844                 DO_ASSERT(get_jenv_res == JNI_OK);
17845         }
17846         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17847         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17848         LDKTxAddInput msg_var = *msg;
17849         int64_t msg_ref = 0;
17850         msg_var = TxAddInput_clone(&msg_var);
17851         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17852         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17853         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17854         CHECK(obj != NULL);
17855         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_add_input_meth, their_node_id_arr, msg_ref);
17856         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17857                 (*env)->ExceptionDescribe(env);
17858                 (*env)->FatalError(env, "A call to handle_tx_add_input in LDKChannelMessageHandler from rust threw an exception.");
17859         }
17860         if (get_jenv_res == JNI_EDETACHED) {
17861                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17862         }
17863 }
17864 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
17865         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17866         JNIEnv *env;
17867         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17868         if (get_jenv_res == JNI_EDETACHED) {
17869                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17870         } else {
17871                 DO_ASSERT(get_jenv_res == JNI_OK);
17872         }
17873         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17874         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17875         LDKTxAddOutput msg_var = *msg;
17876         int64_t msg_ref = 0;
17877         msg_var = TxAddOutput_clone(&msg_var);
17878         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17879         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17880         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17881         CHECK(obj != NULL);
17882         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_add_output_meth, their_node_id_arr, msg_ref);
17883         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17884                 (*env)->ExceptionDescribe(env);
17885                 (*env)->FatalError(env, "A call to handle_tx_add_output in LDKChannelMessageHandler from rust threw an exception.");
17886         }
17887         if (get_jenv_res == JNI_EDETACHED) {
17888                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17889         }
17890 }
17891 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
17892         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17893         JNIEnv *env;
17894         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17895         if (get_jenv_res == JNI_EDETACHED) {
17896                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17897         } else {
17898                 DO_ASSERT(get_jenv_res == JNI_OK);
17899         }
17900         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17901         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17902         LDKTxRemoveInput msg_var = *msg;
17903         int64_t msg_ref = 0;
17904         msg_var = TxRemoveInput_clone(&msg_var);
17905         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17906         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17907         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17908         CHECK(obj != NULL);
17909         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_remove_input_meth, their_node_id_arr, msg_ref);
17910         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17911                 (*env)->ExceptionDescribe(env);
17912                 (*env)->FatalError(env, "A call to handle_tx_remove_input in LDKChannelMessageHandler from rust threw an exception.");
17913         }
17914         if (get_jenv_res == JNI_EDETACHED) {
17915                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17916         }
17917 }
17918 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
17919         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17920         JNIEnv *env;
17921         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17922         if (get_jenv_res == JNI_EDETACHED) {
17923                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17924         } else {
17925                 DO_ASSERT(get_jenv_res == JNI_OK);
17926         }
17927         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17928         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17929         LDKTxRemoveOutput msg_var = *msg;
17930         int64_t msg_ref = 0;
17931         msg_var = TxRemoveOutput_clone(&msg_var);
17932         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17933         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17934         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17935         CHECK(obj != NULL);
17936         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_remove_output_meth, their_node_id_arr, msg_ref);
17937         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17938                 (*env)->ExceptionDescribe(env);
17939                 (*env)->FatalError(env, "A call to handle_tx_remove_output in LDKChannelMessageHandler from rust threw an exception.");
17940         }
17941         if (get_jenv_res == JNI_EDETACHED) {
17942                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17943         }
17944 }
17945 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
17946         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17947         JNIEnv *env;
17948         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17949         if (get_jenv_res == JNI_EDETACHED) {
17950                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17951         } else {
17952                 DO_ASSERT(get_jenv_res == JNI_OK);
17953         }
17954         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17955         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17956         LDKTxComplete msg_var = *msg;
17957         int64_t msg_ref = 0;
17958         msg_var = TxComplete_clone(&msg_var);
17959         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17960         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17961         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17962         CHECK(obj != NULL);
17963         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_complete_meth, their_node_id_arr, msg_ref);
17964         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17965                 (*env)->ExceptionDescribe(env);
17966                 (*env)->FatalError(env, "A call to handle_tx_complete in LDKChannelMessageHandler from rust threw an exception.");
17967         }
17968         if (get_jenv_res == JNI_EDETACHED) {
17969                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17970         }
17971 }
17972 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
17973         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
17974         JNIEnv *env;
17975         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17976         if (get_jenv_res == JNI_EDETACHED) {
17977                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17978         } else {
17979                 DO_ASSERT(get_jenv_res == JNI_OK);
17980         }
17981         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17982         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17983         LDKTxSignatures msg_var = *msg;
17984         int64_t msg_ref = 0;
17985         msg_var = TxSignatures_clone(&msg_var);
17986         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17987         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17988         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17989         CHECK(obj != NULL);
17990         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_signatures_meth, their_node_id_arr, msg_ref);
17991         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17992                 (*env)->ExceptionDescribe(env);
17993                 (*env)->FatalError(env, "A call to handle_tx_signatures in LDKChannelMessageHandler from rust threw an exception.");
17994         }
17995         if (get_jenv_res == JNI_EDETACHED) {
17996                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17997         }
17998 }
17999 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
18000         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18001         JNIEnv *env;
18002         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18003         if (get_jenv_res == JNI_EDETACHED) {
18004                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18005         } else {
18006                 DO_ASSERT(get_jenv_res == JNI_OK);
18007         }
18008         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18009         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18010         LDKTxInitRbf msg_var = *msg;
18011         int64_t msg_ref = 0;
18012         msg_var = TxInitRbf_clone(&msg_var);
18013         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18014         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18015         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18016         CHECK(obj != NULL);
18017         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_init_rbf_meth, their_node_id_arr, msg_ref);
18018         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18019                 (*env)->ExceptionDescribe(env);
18020                 (*env)->FatalError(env, "A call to handle_tx_init_rbf in LDKChannelMessageHandler from rust threw an exception.");
18021         }
18022         if (get_jenv_res == JNI_EDETACHED) {
18023                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18024         }
18025 }
18026 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
18027         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18028         JNIEnv *env;
18029         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18030         if (get_jenv_res == JNI_EDETACHED) {
18031                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18032         } else {
18033                 DO_ASSERT(get_jenv_res == JNI_OK);
18034         }
18035         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18036         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18037         LDKTxAckRbf msg_var = *msg;
18038         int64_t msg_ref = 0;
18039         msg_var = TxAckRbf_clone(&msg_var);
18040         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18041         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18042         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18043         CHECK(obj != NULL);
18044         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_ack_rbf_meth, their_node_id_arr, msg_ref);
18045         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18046                 (*env)->ExceptionDescribe(env);
18047                 (*env)->FatalError(env, "A call to handle_tx_ack_rbf in LDKChannelMessageHandler from rust threw an exception.");
18048         }
18049         if (get_jenv_res == JNI_EDETACHED) {
18050                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18051         }
18052 }
18053 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
18054         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18055         JNIEnv *env;
18056         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18057         if (get_jenv_res == JNI_EDETACHED) {
18058                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18059         } else {
18060                 DO_ASSERT(get_jenv_res == JNI_OK);
18061         }
18062         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18063         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18064         LDKTxAbort msg_var = *msg;
18065         int64_t msg_ref = 0;
18066         msg_var = TxAbort_clone(&msg_var);
18067         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18068         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18069         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18070         CHECK(obj != NULL);
18071         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_abort_meth, their_node_id_arr, msg_ref);
18072         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18073                 (*env)->ExceptionDescribe(env);
18074                 (*env)->FatalError(env, "A call to handle_tx_abort in LDKChannelMessageHandler from rust threw an exception.");
18075         }
18076         if (get_jenv_res == JNI_EDETACHED) {
18077                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18078         }
18079 }
18080 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
18081         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18082         JNIEnv *env;
18083         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18084         if (get_jenv_res == JNI_EDETACHED) {
18085                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18086         } else {
18087                 DO_ASSERT(get_jenv_res == JNI_OK);
18088         }
18089         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18090         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18091         LDKUpdateAddHTLC msg_var = *msg;
18092         int64_t msg_ref = 0;
18093         msg_var = UpdateAddHTLC_clone(&msg_var);
18094         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18095         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18096         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18097         CHECK(obj != NULL);
18098         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
18099         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18100                 (*env)->ExceptionDescribe(env);
18101                 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
18102         }
18103         if (get_jenv_res == JNI_EDETACHED) {
18104                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18105         }
18106 }
18107 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
18108         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18109         JNIEnv *env;
18110         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18111         if (get_jenv_res == JNI_EDETACHED) {
18112                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18113         } else {
18114                 DO_ASSERT(get_jenv_res == JNI_OK);
18115         }
18116         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18117         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18118         LDKUpdateFulfillHTLC msg_var = *msg;
18119         int64_t msg_ref = 0;
18120         msg_var = UpdateFulfillHTLC_clone(&msg_var);
18121         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18122         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18123         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18124         CHECK(obj != NULL);
18125         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
18126         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18127                 (*env)->ExceptionDescribe(env);
18128                 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
18129         }
18130         if (get_jenv_res == JNI_EDETACHED) {
18131                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18132         }
18133 }
18134 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
18135         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18136         JNIEnv *env;
18137         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18138         if (get_jenv_res == JNI_EDETACHED) {
18139                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18140         } else {
18141                 DO_ASSERT(get_jenv_res == JNI_OK);
18142         }
18143         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18144         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18145         LDKUpdateFailHTLC msg_var = *msg;
18146         int64_t msg_ref = 0;
18147         msg_var = UpdateFailHTLC_clone(&msg_var);
18148         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18149         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18150         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18151         CHECK(obj != NULL);
18152         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
18153         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18154                 (*env)->ExceptionDescribe(env);
18155                 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
18156         }
18157         if (get_jenv_res == JNI_EDETACHED) {
18158                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18159         }
18160 }
18161 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
18162         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18163         JNIEnv *env;
18164         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18165         if (get_jenv_res == JNI_EDETACHED) {
18166                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18167         } else {
18168                 DO_ASSERT(get_jenv_res == JNI_OK);
18169         }
18170         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18171         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18172         LDKUpdateFailMalformedHTLC msg_var = *msg;
18173         int64_t msg_ref = 0;
18174         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
18175         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18176         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18177         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18178         CHECK(obj != NULL);
18179         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
18180         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18181                 (*env)->ExceptionDescribe(env);
18182                 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
18183         }
18184         if (get_jenv_res == JNI_EDETACHED) {
18185                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18186         }
18187 }
18188 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
18189         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18190         JNIEnv *env;
18191         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18192         if (get_jenv_res == JNI_EDETACHED) {
18193                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18194         } else {
18195                 DO_ASSERT(get_jenv_res == JNI_OK);
18196         }
18197         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18198         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18199         LDKCommitmentSigned msg_var = *msg;
18200         int64_t msg_ref = 0;
18201         msg_var = CommitmentSigned_clone(&msg_var);
18202         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18203         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18204         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18205         CHECK(obj != NULL);
18206         (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
18207         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18208                 (*env)->ExceptionDescribe(env);
18209                 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
18210         }
18211         if (get_jenv_res == JNI_EDETACHED) {
18212                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18213         }
18214 }
18215 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
18216         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18217         JNIEnv *env;
18218         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18219         if (get_jenv_res == JNI_EDETACHED) {
18220                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18221         } else {
18222                 DO_ASSERT(get_jenv_res == JNI_OK);
18223         }
18224         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18225         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18226         LDKRevokeAndACK msg_var = *msg;
18227         int64_t msg_ref = 0;
18228         msg_var = RevokeAndACK_clone(&msg_var);
18229         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18230         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18231         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18232         CHECK(obj != NULL);
18233         (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
18234         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18235                 (*env)->ExceptionDescribe(env);
18236                 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
18237         }
18238         if (get_jenv_res == JNI_EDETACHED) {
18239                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18240         }
18241 }
18242 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
18243         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18244         JNIEnv *env;
18245         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18246         if (get_jenv_res == JNI_EDETACHED) {
18247                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18248         } else {
18249                 DO_ASSERT(get_jenv_res == JNI_OK);
18250         }
18251         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18252         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18253         LDKUpdateFee msg_var = *msg;
18254         int64_t msg_ref = 0;
18255         msg_var = UpdateFee_clone(&msg_var);
18256         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18257         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18258         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18259         CHECK(obj != NULL);
18260         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
18261         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18262                 (*env)->ExceptionDescribe(env);
18263                 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
18264         }
18265         if (get_jenv_res == JNI_EDETACHED) {
18266                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18267         }
18268 }
18269 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
18270         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18271         JNIEnv *env;
18272         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18273         if (get_jenv_res == JNI_EDETACHED) {
18274                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18275         } else {
18276                 DO_ASSERT(get_jenv_res == JNI_OK);
18277         }
18278         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18279         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18280         LDKAnnouncementSignatures msg_var = *msg;
18281         int64_t msg_ref = 0;
18282         msg_var = AnnouncementSignatures_clone(&msg_var);
18283         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18284         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18285         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18286         CHECK(obj != NULL);
18287         (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
18288         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18289                 (*env)->ExceptionDescribe(env);
18290                 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
18291         }
18292         if (get_jenv_res == JNI_EDETACHED) {
18293                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18294         }
18295 }
18296 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
18297         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18298         JNIEnv *env;
18299         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18300         if (get_jenv_res == JNI_EDETACHED) {
18301                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18302         } else {
18303                 DO_ASSERT(get_jenv_res == JNI_OK);
18304         }
18305         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18306         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18307         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18308         CHECK(obj != NULL);
18309         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
18310         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18311                 (*env)->ExceptionDescribe(env);
18312                 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
18313         }
18314         if (get_jenv_res == JNI_EDETACHED) {
18315                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18316         }
18317 }
18318 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
18319         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18320         JNIEnv *env;
18321         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18322         if (get_jenv_res == JNI_EDETACHED) {
18323                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18324         } else {
18325                 DO_ASSERT(get_jenv_res == JNI_OK);
18326         }
18327         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18328         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18329         LDKInit msg_var = *msg;
18330         int64_t msg_ref = 0;
18331         msg_var = Init_clone(&msg_var);
18332         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18333         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18334         jboolean inbound_conv = inbound;
18335         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18336         CHECK(obj != NULL);
18337         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref, inbound_conv);
18338         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18339                 (*env)->ExceptionDescribe(env);
18340                 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
18341         }
18342         void* ret_ptr = untag_ptr(ret);
18343         CHECK_ACCESS(ret_ptr);
18344         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
18345         FREE(untag_ptr(ret));
18346         if (get_jenv_res == JNI_EDETACHED) {
18347                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18348         }
18349         return ret_conv;
18350 }
18351 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
18352         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18353         JNIEnv *env;
18354         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18355         if (get_jenv_res == JNI_EDETACHED) {
18356                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18357         } else {
18358                 DO_ASSERT(get_jenv_res == JNI_OK);
18359         }
18360         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18361         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18362         LDKChannelReestablish msg_var = *msg;
18363         int64_t msg_ref = 0;
18364         msg_var = ChannelReestablish_clone(&msg_var);
18365         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18366         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18367         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18368         CHECK(obj != NULL);
18369         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
18370         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18371                 (*env)->ExceptionDescribe(env);
18372                 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
18373         }
18374         if (get_jenv_res == JNI_EDETACHED) {
18375                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18376         }
18377 }
18378 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
18379         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18380         JNIEnv *env;
18381         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18382         if (get_jenv_res == JNI_EDETACHED) {
18383                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18384         } else {
18385                 DO_ASSERT(get_jenv_res == JNI_OK);
18386         }
18387         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18388         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18389         LDKChannelUpdate msg_var = *msg;
18390         int64_t msg_ref = 0;
18391         msg_var = ChannelUpdate_clone(&msg_var);
18392         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18393         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18394         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18395         CHECK(obj != NULL);
18396         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
18397         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18398                 (*env)->ExceptionDescribe(env);
18399                 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
18400         }
18401         if (get_jenv_res == JNI_EDETACHED) {
18402                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18403         }
18404 }
18405 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
18406         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18407         JNIEnv *env;
18408         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18409         if (get_jenv_res == JNI_EDETACHED) {
18410                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18411         } else {
18412                 DO_ASSERT(get_jenv_res == JNI_OK);
18413         }
18414         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18415         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18416         LDKErrorMessage msg_var = *msg;
18417         int64_t msg_ref = 0;
18418         msg_var = ErrorMessage_clone(&msg_var);
18419         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
18420         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
18421         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18422         CHECK(obj != NULL);
18423         (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
18424         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18425                 (*env)->ExceptionDescribe(env);
18426                 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
18427         }
18428         if (get_jenv_res == JNI_EDETACHED) {
18429                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18430         }
18431 }
18432 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
18433         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18434         JNIEnv *env;
18435         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18436         if (get_jenv_res == JNI_EDETACHED) {
18437                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18438         } else {
18439                 DO_ASSERT(get_jenv_res == JNI_OK);
18440         }
18441         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18442         CHECK(obj != NULL);
18443         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
18444         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18445                 (*env)->ExceptionDescribe(env);
18446                 (*env)->FatalError(env, "A call to provided_node_features in LDKChannelMessageHandler from rust threw an exception.");
18447         }
18448         LDKNodeFeatures ret_conv;
18449         ret_conv.inner = untag_ptr(ret);
18450         ret_conv.is_owned = ptr_is_owned(ret);
18451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18452         if (get_jenv_res == JNI_EDETACHED) {
18453                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18454         }
18455         return ret_conv;
18456 }
18457 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
18458         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18459         JNIEnv *env;
18460         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18461         if (get_jenv_res == JNI_EDETACHED) {
18462                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18463         } else {
18464                 DO_ASSERT(get_jenv_res == JNI_OK);
18465         }
18466         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
18467         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
18468         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18469         CHECK(obj != NULL);
18470         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
18471         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18472                 (*env)->ExceptionDescribe(env);
18473                 (*env)->FatalError(env, "A call to provided_init_features in LDKChannelMessageHandler from rust threw an exception.");
18474         }
18475         LDKInitFeatures ret_conv;
18476         ret_conv.inner = untag_ptr(ret);
18477         ret_conv.is_owned = ptr_is_owned(ret);
18478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
18479         if (get_jenv_res == JNI_EDETACHED) {
18480                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18481         }
18482         return ret_conv;
18483 }
18484 LDKCOption_CVec_ThirtyTwoBytesZZ get_chain_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
18485         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
18486         JNIEnv *env;
18487         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18488         if (get_jenv_res == JNI_EDETACHED) {
18489                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18490         } else {
18491                 DO_ASSERT(get_jenv_res == JNI_OK);
18492         }
18493         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18494         CHECK(obj != NULL);
18495         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_chain_hashes_meth);
18496         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18497                 (*env)->ExceptionDescribe(env);
18498                 (*env)->FatalError(env, "A call to get_chain_hashes in LDKChannelMessageHandler from rust threw an exception.");
18499         }
18500         void* ret_ptr = untag_ptr(ret);
18501         CHECK_ACCESS(ret_ptr);
18502         LDKCOption_CVec_ThirtyTwoBytesZZ ret_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(ret_ptr);
18503         FREE(untag_ptr(ret));
18504         if (get_jenv_res == JNI_EDETACHED) {
18505                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18506         }
18507         return ret_conv;
18508 }
18509 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
18510         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
18511         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18512         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
18513 }
18514 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
18515         jclass c = (*env)->GetObjectClass(env, o);
18516         CHECK(c != NULL);
18517         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
18518         atomic_init(&calls->refcnt, 1);
18519         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18520         calls->o = (*env)->NewWeakGlobalRef(env, o);
18521         calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJ)V");
18522         CHECK(calls->handle_open_channel_meth != NULL);
18523         calls->handle_open_channel_v2_meth = (*env)->GetMethodID(env, c, "handle_open_channel_v2", "([BJ)V");
18524         CHECK(calls->handle_open_channel_v2_meth != NULL);
18525         calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJ)V");
18526         CHECK(calls->handle_accept_channel_meth != NULL);
18527         calls->handle_accept_channel_v2_meth = (*env)->GetMethodID(env, c, "handle_accept_channel_v2", "([BJ)V");
18528         CHECK(calls->handle_accept_channel_v2_meth != NULL);
18529         calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
18530         CHECK(calls->handle_funding_created_meth != NULL);
18531         calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
18532         CHECK(calls->handle_funding_signed_meth != NULL);
18533         calls->handle_channel_ready_meth = (*env)->GetMethodID(env, c, "handle_channel_ready", "([BJ)V");
18534         CHECK(calls->handle_channel_ready_meth != NULL);
18535         calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
18536         CHECK(calls->handle_shutdown_meth != NULL);
18537         calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
18538         CHECK(calls->handle_closing_signed_meth != NULL);
18539         calls->handle_stfu_meth = (*env)->GetMethodID(env, c, "handle_stfu", "([BJ)V");
18540         CHECK(calls->handle_stfu_meth != NULL);
18541         calls->handle_splice_meth = (*env)->GetMethodID(env, c, "handle_splice", "([BJ)V");
18542         CHECK(calls->handle_splice_meth != NULL);
18543         calls->handle_splice_ack_meth = (*env)->GetMethodID(env, c, "handle_splice_ack", "([BJ)V");
18544         CHECK(calls->handle_splice_ack_meth != NULL);
18545         calls->handle_splice_locked_meth = (*env)->GetMethodID(env, c, "handle_splice_locked", "([BJ)V");
18546         CHECK(calls->handle_splice_locked_meth != NULL);
18547         calls->handle_tx_add_input_meth = (*env)->GetMethodID(env, c, "handle_tx_add_input", "([BJ)V");
18548         CHECK(calls->handle_tx_add_input_meth != NULL);
18549         calls->handle_tx_add_output_meth = (*env)->GetMethodID(env, c, "handle_tx_add_output", "([BJ)V");
18550         CHECK(calls->handle_tx_add_output_meth != NULL);
18551         calls->handle_tx_remove_input_meth = (*env)->GetMethodID(env, c, "handle_tx_remove_input", "([BJ)V");
18552         CHECK(calls->handle_tx_remove_input_meth != NULL);
18553         calls->handle_tx_remove_output_meth = (*env)->GetMethodID(env, c, "handle_tx_remove_output", "([BJ)V");
18554         CHECK(calls->handle_tx_remove_output_meth != NULL);
18555         calls->handle_tx_complete_meth = (*env)->GetMethodID(env, c, "handle_tx_complete", "([BJ)V");
18556         CHECK(calls->handle_tx_complete_meth != NULL);
18557         calls->handle_tx_signatures_meth = (*env)->GetMethodID(env, c, "handle_tx_signatures", "([BJ)V");
18558         CHECK(calls->handle_tx_signatures_meth != NULL);
18559         calls->handle_tx_init_rbf_meth = (*env)->GetMethodID(env, c, "handle_tx_init_rbf", "([BJ)V");
18560         CHECK(calls->handle_tx_init_rbf_meth != NULL);
18561         calls->handle_tx_ack_rbf_meth = (*env)->GetMethodID(env, c, "handle_tx_ack_rbf", "([BJ)V");
18562         CHECK(calls->handle_tx_ack_rbf_meth != NULL);
18563         calls->handle_tx_abort_meth = (*env)->GetMethodID(env, c, "handle_tx_abort", "([BJ)V");
18564         CHECK(calls->handle_tx_abort_meth != NULL);
18565         calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
18566         CHECK(calls->handle_update_add_htlc_meth != NULL);
18567         calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
18568         CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
18569         calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
18570         CHECK(calls->handle_update_fail_htlc_meth != NULL);
18571         calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
18572         CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
18573         calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
18574         CHECK(calls->handle_commitment_signed_meth != NULL);
18575         calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
18576         CHECK(calls->handle_revoke_and_ack_meth != NULL);
18577         calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
18578         CHECK(calls->handle_update_fee_meth != NULL);
18579         calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
18580         CHECK(calls->handle_announcement_signatures_meth != NULL);
18581         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
18582         CHECK(calls->peer_disconnected_meth != NULL);
18583         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
18584         CHECK(calls->peer_connected_meth != NULL);
18585         calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
18586         CHECK(calls->handle_channel_reestablish_meth != NULL);
18587         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
18588         CHECK(calls->handle_channel_update_meth != NULL);
18589         calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
18590         CHECK(calls->handle_error_meth != NULL);
18591         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
18592         CHECK(calls->provided_node_features_meth != NULL);
18593         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
18594         CHECK(calls->provided_init_features_meth != NULL);
18595         calls->get_chain_hashes_meth = (*env)->GetMethodID(env, c, "get_chain_hashes", "()J");
18596         CHECK(calls->get_chain_hashes_meth != NULL);
18597
18598         LDKChannelMessageHandler ret = {
18599                 .this_arg = (void*) calls,
18600                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
18601                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
18602                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
18603                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
18604                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
18605                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
18606                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
18607                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
18608                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
18609                 .handle_stfu = handle_stfu_LDKChannelMessageHandler_jcall,
18610                 .handle_splice = handle_splice_LDKChannelMessageHandler_jcall,
18611                 .handle_splice_ack = handle_splice_ack_LDKChannelMessageHandler_jcall,
18612                 .handle_splice_locked = handle_splice_locked_LDKChannelMessageHandler_jcall,
18613                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
18614                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
18615                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
18616                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
18617                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
18618                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
18619                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
18620                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
18621                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
18622                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
18623                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
18624                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
18625                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
18626                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
18627                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
18628                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
18629                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
18630                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
18631                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
18632                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
18633                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
18634                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
18635                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
18636                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
18637                 .get_chain_hashes = get_chain_hashes_LDKChannelMessageHandler_jcall,
18638                 .free = LDKChannelMessageHandler_JCalls_free,
18639                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
18640         };
18641         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
18642         return ret;
18643 }
18644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
18645         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
18646         *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
18647         return tag_ptr(res_ptr, true);
18648 }
18649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
18650         LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)untag_ptr(arg);
18651         return tag_ptr(&inp->MessageSendEventsProvider, false);
18652 }
18653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1open_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18654         void* this_arg_ptr = untag_ptr(this_arg);
18655         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18656         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18657         LDKPublicKey their_node_id_ref;
18658         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18659         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18660         LDKOpenChannel msg_conv;
18661         msg_conv.inner = untag_ptr(msg);
18662         msg_conv.is_owned = ptr_is_owned(msg);
18663         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18664         msg_conv.is_owned = false;
18665         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18666 }
18667
18668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1open_1channel_1v2(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18669         void* this_arg_ptr = untag_ptr(this_arg);
18670         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18671         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18672         LDKPublicKey their_node_id_ref;
18673         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18674         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18675         LDKOpenChannelV2 msg_conv;
18676         msg_conv.inner = untag_ptr(msg);
18677         msg_conv.is_owned = ptr_is_owned(msg);
18678         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18679         msg_conv.is_owned = false;
18680         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18681 }
18682
18683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1accept_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18684         void* this_arg_ptr = untag_ptr(this_arg);
18685         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18686         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18687         LDKPublicKey their_node_id_ref;
18688         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18689         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18690         LDKAcceptChannel msg_conv;
18691         msg_conv.inner = untag_ptr(msg);
18692         msg_conv.is_owned = ptr_is_owned(msg);
18693         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18694         msg_conv.is_owned = false;
18695         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18696 }
18697
18698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1accept_1channel_1v2(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18699         void* this_arg_ptr = untag_ptr(this_arg);
18700         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18701         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18702         LDKPublicKey their_node_id_ref;
18703         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18704         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18705         LDKAcceptChannelV2 msg_conv;
18706         msg_conv.inner = untag_ptr(msg);
18707         msg_conv.is_owned = ptr_is_owned(msg);
18708         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18709         msg_conv.is_owned = false;
18710         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18711 }
18712
18713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1funding_1created(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18714         void* this_arg_ptr = untag_ptr(this_arg);
18715         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18716         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18717         LDKPublicKey their_node_id_ref;
18718         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18719         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18720         LDKFundingCreated msg_conv;
18721         msg_conv.inner = untag_ptr(msg);
18722         msg_conv.is_owned = ptr_is_owned(msg);
18723         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18724         msg_conv.is_owned = false;
18725         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18726 }
18727
18728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1funding_1signed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18729         void* this_arg_ptr = untag_ptr(this_arg);
18730         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18731         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18732         LDKPublicKey their_node_id_ref;
18733         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18734         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18735         LDKFundingSigned msg_conv;
18736         msg_conv.inner = untag_ptr(msg);
18737         msg_conv.is_owned = ptr_is_owned(msg);
18738         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18739         msg_conv.is_owned = false;
18740         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18741 }
18742
18743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18744         void* this_arg_ptr = untag_ptr(this_arg);
18745         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18746         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18747         LDKPublicKey their_node_id_ref;
18748         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18749         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18750         LDKChannelReady msg_conv;
18751         msg_conv.inner = untag_ptr(msg);
18752         msg_conv.is_owned = ptr_is_owned(msg);
18753         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18754         msg_conv.is_owned = false;
18755         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18756 }
18757
18758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18759         void* this_arg_ptr = untag_ptr(this_arg);
18760         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18761         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18762         LDKPublicKey their_node_id_ref;
18763         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18764         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18765         LDKShutdown msg_conv;
18766         msg_conv.inner = untag_ptr(msg);
18767         msg_conv.is_owned = ptr_is_owned(msg);
18768         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18769         msg_conv.is_owned = false;
18770         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18771 }
18772
18773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1closing_1signed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18774         void* this_arg_ptr = untag_ptr(this_arg);
18775         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18776         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18777         LDKPublicKey their_node_id_ref;
18778         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18779         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18780         LDKClosingSigned msg_conv;
18781         msg_conv.inner = untag_ptr(msg);
18782         msg_conv.is_owned = ptr_is_owned(msg);
18783         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18784         msg_conv.is_owned = false;
18785         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18786 }
18787
18788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1stfu(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18789         void* this_arg_ptr = untag_ptr(this_arg);
18790         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18791         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18792         LDKPublicKey their_node_id_ref;
18793         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18794         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18795         LDKStfu msg_conv;
18796         msg_conv.inner = untag_ptr(msg);
18797         msg_conv.is_owned = ptr_is_owned(msg);
18798         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18799         msg_conv.is_owned = false;
18800         (this_arg_conv->handle_stfu)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18801 }
18802
18803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1splice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18804         void* this_arg_ptr = untag_ptr(this_arg);
18805         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18806         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18807         LDKPublicKey their_node_id_ref;
18808         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18809         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18810         LDKSplice msg_conv;
18811         msg_conv.inner = untag_ptr(msg);
18812         msg_conv.is_owned = ptr_is_owned(msg);
18813         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18814         msg_conv.is_owned = false;
18815         (this_arg_conv->handle_splice)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18816 }
18817
18818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1splice_1ack(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18819         void* this_arg_ptr = untag_ptr(this_arg);
18820         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18821         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18822         LDKPublicKey their_node_id_ref;
18823         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18824         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18825         LDKSpliceAck msg_conv;
18826         msg_conv.inner = untag_ptr(msg);
18827         msg_conv.is_owned = ptr_is_owned(msg);
18828         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18829         msg_conv.is_owned = false;
18830         (this_arg_conv->handle_splice_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18831 }
18832
18833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1splice_1locked(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18834         void* this_arg_ptr = untag_ptr(this_arg);
18835         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18836         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18837         LDKPublicKey their_node_id_ref;
18838         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18839         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18840         LDKSpliceLocked msg_conv;
18841         msg_conv.inner = untag_ptr(msg);
18842         msg_conv.is_owned = ptr_is_owned(msg);
18843         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18844         msg_conv.is_owned = false;
18845         (this_arg_conv->handle_splice_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18846 }
18847
18848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1add_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18849         void* this_arg_ptr = untag_ptr(this_arg);
18850         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18851         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18852         LDKPublicKey their_node_id_ref;
18853         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18854         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18855         LDKTxAddInput msg_conv;
18856         msg_conv.inner = untag_ptr(msg);
18857         msg_conv.is_owned = ptr_is_owned(msg);
18858         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18859         msg_conv.is_owned = false;
18860         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18861 }
18862
18863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1add_1output(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18864         void* this_arg_ptr = untag_ptr(this_arg);
18865         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18866         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18867         LDKPublicKey their_node_id_ref;
18868         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18869         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18870         LDKTxAddOutput msg_conv;
18871         msg_conv.inner = untag_ptr(msg);
18872         msg_conv.is_owned = ptr_is_owned(msg);
18873         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18874         msg_conv.is_owned = false;
18875         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18876 }
18877
18878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1remove_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18879         void* this_arg_ptr = untag_ptr(this_arg);
18880         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18881         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18882         LDKPublicKey their_node_id_ref;
18883         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18884         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18885         LDKTxRemoveInput msg_conv;
18886         msg_conv.inner = untag_ptr(msg);
18887         msg_conv.is_owned = ptr_is_owned(msg);
18888         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18889         msg_conv.is_owned = false;
18890         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18891 }
18892
18893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1remove_1output(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18894         void* this_arg_ptr = untag_ptr(this_arg);
18895         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18896         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18897         LDKPublicKey their_node_id_ref;
18898         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18899         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18900         LDKTxRemoveOutput msg_conv;
18901         msg_conv.inner = untag_ptr(msg);
18902         msg_conv.is_owned = ptr_is_owned(msg);
18903         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18904         msg_conv.is_owned = false;
18905         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18906 }
18907
18908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1complete(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18909         void* this_arg_ptr = untag_ptr(this_arg);
18910         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18911         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18912         LDKPublicKey their_node_id_ref;
18913         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18914         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18915         LDKTxComplete msg_conv;
18916         msg_conv.inner = untag_ptr(msg);
18917         msg_conv.is_owned = ptr_is_owned(msg);
18918         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18919         msg_conv.is_owned = false;
18920         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18921 }
18922
18923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1signatures(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18924         void* this_arg_ptr = untag_ptr(this_arg);
18925         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18926         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18927         LDKPublicKey their_node_id_ref;
18928         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18929         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18930         LDKTxSignatures msg_conv;
18931         msg_conv.inner = untag_ptr(msg);
18932         msg_conv.is_owned = ptr_is_owned(msg);
18933         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18934         msg_conv.is_owned = false;
18935         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18936 }
18937
18938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1init_1rbf(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18939         void* this_arg_ptr = untag_ptr(this_arg);
18940         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18941         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18942         LDKPublicKey their_node_id_ref;
18943         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18944         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18945         LDKTxInitRbf msg_conv;
18946         msg_conv.inner = untag_ptr(msg);
18947         msg_conv.is_owned = ptr_is_owned(msg);
18948         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18949         msg_conv.is_owned = false;
18950         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18951 }
18952
18953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1ack_1rbf(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18954         void* this_arg_ptr = untag_ptr(this_arg);
18955         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18956         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18957         LDKPublicKey their_node_id_ref;
18958         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18959         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18960         LDKTxAckRbf msg_conv;
18961         msg_conv.inner = untag_ptr(msg);
18962         msg_conv.is_owned = ptr_is_owned(msg);
18963         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18964         msg_conv.is_owned = false;
18965         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18966 }
18967
18968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1abort(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18969         void* this_arg_ptr = untag_ptr(this_arg);
18970         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18971         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18972         LDKPublicKey their_node_id_ref;
18973         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18974         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18975         LDKTxAbort msg_conv;
18976         msg_conv.inner = untag_ptr(msg);
18977         msg_conv.is_owned = ptr_is_owned(msg);
18978         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18979         msg_conv.is_owned = false;
18980         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18981 }
18982
18983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1add_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18984         void* this_arg_ptr = untag_ptr(this_arg);
18985         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18986         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
18987         LDKPublicKey their_node_id_ref;
18988         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18989         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18990         LDKUpdateAddHTLC msg_conv;
18991         msg_conv.inner = untag_ptr(msg);
18992         msg_conv.is_owned = ptr_is_owned(msg);
18993         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
18994         msg_conv.is_owned = false;
18995         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
18996 }
18997
18998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fulfill_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
18999         void* this_arg_ptr = untag_ptr(this_arg);
19000         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19001         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19002         LDKPublicKey their_node_id_ref;
19003         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19004         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19005         LDKUpdateFulfillHTLC msg_conv;
19006         msg_conv.inner = untag_ptr(msg);
19007         msg_conv.is_owned = ptr_is_owned(msg);
19008         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19009         msg_conv.is_owned = false;
19010         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
19011 }
19012
19013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fail_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
19014         void* this_arg_ptr = untag_ptr(this_arg);
19015         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19016         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19017         LDKPublicKey their_node_id_ref;
19018         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19019         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19020         LDKUpdateFailHTLC msg_conv;
19021         msg_conv.inner = untag_ptr(msg);
19022         msg_conv.is_owned = ptr_is_owned(msg);
19023         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19024         msg_conv.is_owned = false;
19025         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
19026 }
19027
19028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fail_1malformed_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
19029         void* this_arg_ptr = untag_ptr(this_arg);
19030         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19031         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19032         LDKPublicKey their_node_id_ref;
19033         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19034         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19035         LDKUpdateFailMalformedHTLC msg_conv;
19036         msg_conv.inner = untag_ptr(msg);
19037         msg_conv.is_owned = ptr_is_owned(msg);
19038         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19039         msg_conv.is_owned = false;
19040         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
19041 }
19042
19043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
19044         void* this_arg_ptr = untag_ptr(this_arg);
19045         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19046         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19047         LDKPublicKey their_node_id_ref;
19048         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19049         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19050         LDKCommitmentSigned msg_conv;
19051         msg_conv.inner = untag_ptr(msg);
19052         msg_conv.is_owned = ptr_is_owned(msg);
19053         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19054         msg_conv.is_owned = false;
19055         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
19056 }
19057
19058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1revoke_1and_1ack(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
19059         void* this_arg_ptr = untag_ptr(this_arg);
19060         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19061         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19062         LDKPublicKey their_node_id_ref;
19063         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19064         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19065         LDKRevokeAndACK msg_conv;
19066         msg_conv.inner = untag_ptr(msg);
19067         msg_conv.is_owned = ptr_is_owned(msg);
19068         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19069         msg_conv.is_owned = false;
19070         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
19071 }
19072
19073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fee(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
19074         void* this_arg_ptr = untag_ptr(this_arg);
19075         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19076         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19077         LDKPublicKey their_node_id_ref;
19078         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19079         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19080         LDKUpdateFee msg_conv;
19081         msg_conv.inner = untag_ptr(msg);
19082         msg_conv.is_owned = ptr_is_owned(msg);
19083         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19084         msg_conv.is_owned = false;
19085         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
19086 }
19087
19088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1announcement_1signatures(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
19089         void* this_arg_ptr = untag_ptr(this_arg);
19090         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19091         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19092         LDKPublicKey their_node_id_ref;
19093         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19094         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19095         LDKAnnouncementSignatures msg_conv;
19096         msg_conv.inner = untag_ptr(msg);
19097         msg_conv.is_owned = ptr_is_owned(msg);
19098         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19099         msg_conv.is_owned = false;
19100         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
19101 }
19102
19103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
19104         void* this_arg_ptr = untag_ptr(this_arg);
19105         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19106         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19107         LDKPublicKey their_node_id_ref;
19108         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19109         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19110         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
19111 }
19112
19113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg, jboolean inbound) {
19114         void* this_arg_ptr = untag_ptr(this_arg);
19115         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19116         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19117         LDKPublicKey their_node_id_ref;
19118         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19119         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19120         LDKInit msg_conv;
19121         msg_conv.inner = untag_ptr(msg);
19122         msg_conv.is_owned = ptr_is_owned(msg);
19123         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19124         msg_conv.is_owned = false;
19125         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19126         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
19127         return tag_ptr(ret_conv, true);
19128 }
19129
19130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1channel_1reestablish(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
19131         void* this_arg_ptr = untag_ptr(this_arg);
19132         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19133         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19134         LDKPublicKey their_node_id_ref;
19135         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19136         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19137         LDKChannelReestablish msg_conv;
19138         msg_conv.inner = untag_ptr(msg);
19139         msg_conv.is_owned = ptr_is_owned(msg);
19140         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19141         msg_conv.is_owned = false;
19142         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
19143 }
19144
19145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
19146         void* this_arg_ptr = untag_ptr(this_arg);
19147         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19148         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19149         LDKPublicKey their_node_id_ref;
19150         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19151         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19152         LDKChannelUpdate msg_conv;
19153         msg_conv.inner = untag_ptr(msg);
19154         msg_conv.is_owned = ptr_is_owned(msg);
19155         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19156         msg_conv.is_owned = false;
19157         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
19158 }
19159
19160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1error(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
19161         void* this_arg_ptr = untag_ptr(this_arg);
19162         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19163         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19164         LDKPublicKey their_node_id_ref;
19165         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19166         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19167         LDKErrorMessage msg_conv;
19168         msg_conv.inner = untag_ptr(msg);
19169         msg_conv.is_owned = ptr_is_owned(msg);
19170         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19171         msg_conv.is_owned = false;
19172         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
19173 }
19174
19175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
19176         void* this_arg_ptr = untag_ptr(this_arg);
19177         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19178         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19179         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
19180         int64_t ret_ref = 0;
19181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
19183         return ret_ref;
19184 }
19185
19186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1provided_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
19187         void* this_arg_ptr = untag_ptr(this_arg);
19188         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19189         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19190         LDKPublicKey their_node_id_ref;
19191         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19192         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19193         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
19194         int64_t ret_ref = 0;
19195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
19197         return ret_ref;
19198 }
19199
19200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1get_1chain_1hashes(JNIEnv *env, jclass clz, int64_t this_arg) {
19201         void* this_arg_ptr = untag_ptr(this_arg);
19202         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19203         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
19204         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
19205         *ret_copy = (this_arg_conv->get_chain_hashes)(this_arg_conv->this_arg);
19206         int64_t ret_ref = tag_ptr(ret_copy, true);
19207         return ret_ref;
19208 }
19209
19210 typedef struct LDKOffersMessageHandler_JCalls {
19211         atomic_size_t refcnt;
19212         JavaVM *vm;
19213         jweak o;
19214         jmethodID handle_message_meth;
19215         jmethodID release_pending_messages_meth;
19216 } LDKOffersMessageHandler_JCalls;
19217 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
19218         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
19219         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19220                 JNIEnv *env;
19221                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19222                 if (get_jenv_res == JNI_EDETACHED) {
19223                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19224                 } else {
19225                         DO_ASSERT(get_jenv_res == JNI_OK);
19226                 }
19227                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19228                 if (get_jenv_res == JNI_EDETACHED) {
19229                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19230                 }
19231                 FREE(j_calls);
19232         }
19233 }
19234 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
19235         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
19236         JNIEnv *env;
19237         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19238         if (get_jenv_res == JNI_EDETACHED) {
19239                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19240         } else {
19241                 DO_ASSERT(get_jenv_res == JNI_OK);
19242         }
19243         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
19244         *message_copy = message;
19245         int64_t message_ref = tag_ptr(message_copy, true);
19246         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19247         CHECK(obj != NULL);
19248         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_message_meth, message_ref);
19249         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19250                 (*env)->ExceptionDescribe(env);
19251                 (*env)->FatalError(env, "A call to handle_message in LDKOffersMessageHandler from rust threw an exception.");
19252         }
19253         void* ret_ptr = untag_ptr(ret);
19254         CHECK_ACCESS(ret_ptr);
19255         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
19256         FREE(untag_ptr(ret));
19257         if (get_jenv_res == JNI_EDETACHED) {
19258                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19259         }
19260         return ret_conv;
19261 }
19262 LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ release_pending_messages_LDKOffersMessageHandler_jcall(const void* this_arg) {
19263         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
19264         JNIEnv *env;
19265         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19266         if (get_jenv_res == JNI_EDETACHED) {
19267                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19268         } else {
19269                 DO_ASSERT(get_jenv_res == JNI_OK);
19270         }
19271         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19272         CHECK(obj != NULL);
19273         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_messages_meth);
19274         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19275                 (*env)->ExceptionDescribe(env);
19276                 (*env)->FatalError(env, "A call to release_pending_messages in LDKOffersMessageHandler from rust threw an exception.");
19277         }
19278         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_constr;
19279         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
19280         if (ret_constr.datalen > 0)
19281                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
19282         else
19283                 ret_constr.data = NULL;
19284         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
19285         for (size_t x = 0; x < ret_constr.datalen; x++) {
19286                 int64_t ret_conv_49 = ret_vals[x];
19287                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
19288                 CHECK_ACCESS(ret_conv_49_ptr);
19289                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ ret_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(ret_conv_49_ptr);
19290                 FREE(untag_ptr(ret_conv_49));
19291                 ret_constr.data[x] = ret_conv_49_conv;
19292         }
19293         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
19294         if (get_jenv_res == JNI_EDETACHED) {
19295                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19296         }
19297         return ret_constr;
19298 }
19299 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
19300         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
19301         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19302 }
19303 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
19304         jclass c = (*env)->GetObjectClass(env, o);
19305         CHECK(c != NULL);
19306         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
19307         atomic_init(&calls->refcnt, 1);
19308         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19309         calls->o = (*env)->NewWeakGlobalRef(env, o);
19310         calls->handle_message_meth = (*env)->GetMethodID(env, c, "handle_message", "(J)J");
19311         CHECK(calls->handle_message_meth != NULL);
19312         calls->release_pending_messages_meth = (*env)->GetMethodID(env, c, "release_pending_messages", "()[J");
19313         CHECK(calls->release_pending_messages_meth != NULL);
19314
19315         LDKOffersMessageHandler ret = {
19316                 .this_arg = (void*) calls,
19317                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
19318                 .release_pending_messages = release_pending_messages_LDKOffersMessageHandler_jcall,
19319                 .free = LDKOffersMessageHandler_JCalls_free,
19320         };
19321         return ret;
19322 }
19323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOffersMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
19324         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
19325         *res_ptr = LDKOffersMessageHandler_init(env, clz, o);
19326         return tag_ptr(res_ptr, true);
19327 }
19328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1handle_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t message) {
19329         void* this_arg_ptr = untag_ptr(this_arg);
19330         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19331         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
19332         void* message_ptr = untag_ptr(message);
19333         CHECK_ACCESS(message_ptr);
19334         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
19335         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
19336         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
19337         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
19338         int64_t ret_ref = tag_ptr(ret_copy, true);
19339         return ret_ref;
19340 }
19341
19342 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1release_1pending_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
19343         void* this_arg_ptr = untag_ptr(this_arg);
19344         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19345         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
19346         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_messages)(this_arg_conv->this_arg);
19347         int64_tArray ret_arr = NULL;
19348         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
19349         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
19350         for (size_t x = 0; x < ret_var.datalen; x++) {
19351                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
19352                 *ret_conv_49_conv = ret_var.data[x];
19353                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
19354         }
19355         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
19356         FREE(ret_var.data);
19357         return ret_arr;
19358 }
19359
19360 typedef struct LDKRoutingMessageHandler_JCalls {
19361         atomic_size_t refcnt;
19362         JavaVM *vm;
19363         jweak o;
19364         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
19365         jmethodID handle_node_announcement_meth;
19366         jmethodID handle_channel_announcement_meth;
19367         jmethodID handle_channel_update_meth;
19368         jmethodID get_next_channel_announcement_meth;
19369         jmethodID get_next_node_announcement_meth;
19370         jmethodID peer_connected_meth;
19371         jmethodID handle_reply_channel_range_meth;
19372         jmethodID handle_reply_short_channel_ids_end_meth;
19373         jmethodID handle_query_channel_range_meth;
19374         jmethodID handle_query_short_channel_ids_meth;
19375         jmethodID processing_queue_high_meth;
19376         jmethodID provided_node_features_meth;
19377         jmethodID provided_init_features_meth;
19378 } LDKRoutingMessageHandler_JCalls;
19379 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
19380         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19381         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19382                 JNIEnv *env;
19383                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19384                 if (get_jenv_res == JNI_EDETACHED) {
19385                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19386                 } else {
19387                         DO_ASSERT(get_jenv_res == JNI_OK);
19388                 }
19389                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19390                 if (get_jenv_res == JNI_EDETACHED) {
19391                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19392                 }
19393                 FREE(j_calls);
19394         }
19395 }
19396 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
19397         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19398         JNIEnv *env;
19399         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19400         if (get_jenv_res == JNI_EDETACHED) {
19401                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19402         } else {
19403                 DO_ASSERT(get_jenv_res == JNI_OK);
19404         }
19405         LDKNodeAnnouncement msg_var = *msg;
19406         int64_t msg_ref = 0;
19407         msg_var = NodeAnnouncement_clone(&msg_var);
19408         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19409         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19410         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19411         CHECK(obj != NULL);
19412         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
19413         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19414                 (*env)->ExceptionDescribe(env);
19415                 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
19416         }
19417         void* ret_ptr = untag_ptr(ret);
19418         CHECK_ACCESS(ret_ptr);
19419         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
19420         FREE(untag_ptr(ret));
19421         if (get_jenv_res == JNI_EDETACHED) {
19422                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19423         }
19424         return ret_conv;
19425 }
19426 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
19427         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19428         JNIEnv *env;
19429         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19430         if (get_jenv_res == JNI_EDETACHED) {
19431                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19432         } else {
19433                 DO_ASSERT(get_jenv_res == JNI_OK);
19434         }
19435         LDKChannelAnnouncement msg_var = *msg;
19436         int64_t msg_ref = 0;
19437         msg_var = ChannelAnnouncement_clone(&msg_var);
19438         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19439         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19440         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19441         CHECK(obj != NULL);
19442         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
19443         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19444                 (*env)->ExceptionDescribe(env);
19445                 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
19446         }
19447         void* ret_ptr = untag_ptr(ret);
19448         CHECK_ACCESS(ret_ptr);
19449         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
19450         FREE(untag_ptr(ret));
19451         if (get_jenv_res == JNI_EDETACHED) {
19452                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19453         }
19454         return ret_conv;
19455 }
19456 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
19457         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19458         JNIEnv *env;
19459         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19460         if (get_jenv_res == JNI_EDETACHED) {
19461                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19462         } else {
19463                 DO_ASSERT(get_jenv_res == JNI_OK);
19464         }
19465         LDKChannelUpdate msg_var = *msg;
19466         int64_t msg_ref = 0;
19467         msg_var = ChannelUpdate_clone(&msg_var);
19468         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19469         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19470         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19471         CHECK(obj != NULL);
19472         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
19473         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19474                 (*env)->ExceptionDescribe(env);
19475                 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
19476         }
19477         void* ret_ptr = untag_ptr(ret);
19478         CHECK_ACCESS(ret_ptr);
19479         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
19480         FREE(untag_ptr(ret));
19481         if (get_jenv_res == JNI_EDETACHED) {
19482                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19483         }
19484         return ret_conv;
19485 }
19486 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
19487         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19488         JNIEnv *env;
19489         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19490         if (get_jenv_res == JNI_EDETACHED) {
19491                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19492         } else {
19493                 DO_ASSERT(get_jenv_res == JNI_OK);
19494         }
19495         int64_t starting_point_conv = starting_point;
19496         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19497         CHECK(obj != NULL);
19498         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_channel_announcement_meth, starting_point_conv);
19499         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19500                 (*env)->ExceptionDescribe(env);
19501                 (*env)->FatalError(env, "A call to get_next_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
19502         }
19503         void* ret_ptr = untag_ptr(ret);
19504         CHECK_ACCESS(ret_ptr);
19505         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
19506         FREE(untag_ptr(ret));
19507         if (get_jenv_res == JNI_EDETACHED) {
19508                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19509         }
19510         return ret_conv;
19511 }
19512 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
19513         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19514         JNIEnv *env;
19515         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19516         if (get_jenv_res == JNI_EDETACHED) {
19517                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19518         } else {
19519                 DO_ASSERT(get_jenv_res == JNI_OK);
19520         }
19521         LDKNodeId starting_point_var = starting_point;
19522         int64_t starting_point_ref = 0;
19523         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
19524         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
19525         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19526         CHECK(obj != NULL);
19527         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcement_meth, starting_point_ref);
19528         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19529                 (*env)->ExceptionDescribe(env);
19530                 (*env)->FatalError(env, "A call to get_next_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
19531         }
19532         LDKNodeAnnouncement ret_conv;
19533         ret_conv.inner = untag_ptr(ret);
19534         ret_conv.is_owned = ptr_is_owned(ret);
19535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
19536         if (get_jenv_res == JNI_EDETACHED) {
19537                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19538         }
19539         return ret_conv;
19540 }
19541 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
19542         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19543         JNIEnv *env;
19544         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19545         if (get_jenv_res == JNI_EDETACHED) {
19546                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19547         } else {
19548                 DO_ASSERT(get_jenv_res == JNI_OK);
19549         }
19550         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19551         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19552         LDKInit init_var = *init;
19553         int64_t init_ref = 0;
19554         init_var = Init_clone(&init_var);
19555         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
19556         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
19557         jboolean inbound_conv = inbound;
19558         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19559         CHECK(obj != NULL);
19560         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
19561         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19562                 (*env)->ExceptionDescribe(env);
19563                 (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception.");
19564         }
19565         void* ret_ptr = untag_ptr(ret);
19566         CHECK_ACCESS(ret_ptr);
19567         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
19568         FREE(untag_ptr(ret));
19569         if (get_jenv_res == JNI_EDETACHED) {
19570                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19571         }
19572         return ret_conv;
19573 }
19574 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
19575         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19576         JNIEnv *env;
19577         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19578         if (get_jenv_res == JNI_EDETACHED) {
19579                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19580         } else {
19581                 DO_ASSERT(get_jenv_res == JNI_OK);
19582         }
19583         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19584         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19585         LDKReplyChannelRange msg_var = msg;
19586         int64_t msg_ref = 0;
19587         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19588         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19589         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19590         CHECK(obj != NULL);
19591         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
19592         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19593                 (*env)->ExceptionDescribe(env);
19594                 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
19595         }
19596         void* ret_ptr = untag_ptr(ret);
19597         CHECK_ACCESS(ret_ptr);
19598         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
19599         FREE(untag_ptr(ret));
19600         if (get_jenv_res == JNI_EDETACHED) {
19601                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19602         }
19603         return ret_conv;
19604 }
19605 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
19606         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19607         JNIEnv *env;
19608         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19609         if (get_jenv_res == JNI_EDETACHED) {
19610                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19611         } else {
19612                 DO_ASSERT(get_jenv_res == JNI_OK);
19613         }
19614         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19615         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19616         LDKReplyShortChannelIdsEnd msg_var = msg;
19617         int64_t msg_ref = 0;
19618         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19619         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19620         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19621         CHECK(obj != NULL);
19622         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
19623         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19624                 (*env)->ExceptionDescribe(env);
19625                 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
19626         }
19627         void* ret_ptr = untag_ptr(ret);
19628         CHECK_ACCESS(ret_ptr);
19629         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
19630         FREE(untag_ptr(ret));
19631         if (get_jenv_res == JNI_EDETACHED) {
19632                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19633         }
19634         return ret_conv;
19635 }
19636 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
19637         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19638         JNIEnv *env;
19639         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19640         if (get_jenv_res == JNI_EDETACHED) {
19641                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19642         } else {
19643                 DO_ASSERT(get_jenv_res == JNI_OK);
19644         }
19645         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19646         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19647         LDKQueryChannelRange msg_var = msg;
19648         int64_t msg_ref = 0;
19649         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19650         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19651         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19652         CHECK(obj != NULL);
19653         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
19654         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19655                 (*env)->ExceptionDescribe(env);
19656                 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
19657         }
19658         void* ret_ptr = untag_ptr(ret);
19659         CHECK_ACCESS(ret_ptr);
19660         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
19661         FREE(untag_ptr(ret));
19662         if (get_jenv_res == JNI_EDETACHED) {
19663                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19664         }
19665         return ret_conv;
19666 }
19667 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
19668         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19669         JNIEnv *env;
19670         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19671         if (get_jenv_res == JNI_EDETACHED) {
19672                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19673         } else {
19674                 DO_ASSERT(get_jenv_res == JNI_OK);
19675         }
19676         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19677         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19678         LDKQueryShortChannelIds msg_var = msg;
19679         int64_t msg_ref = 0;
19680         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19681         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19682         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19683         CHECK(obj != NULL);
19684         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
19685         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19686                 (*env)->ExceptionDescribe(env);
19687                 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
19688         }
19689         void* ret_ptr = untag_ptr(ret);
19690         CHECK_ACCESS(ret_ptr);
19691         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
19692         FREE(untag_ptr(ret));
19693         if (get_jenv_res == JNI_EDETACHED) {
19694                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19695         }
19696         return ret_conv;
19697 }
19698 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
19699         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19700         JNIEnv *env;
19701         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19702         if (get_jenv_res == JNI_EDETACHED) {
19703                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19704         } else {
19705                 DO_ASSERT(get_jenv_res == JNI_OK);
19706         }
19707         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19708         CHECK(obj != NULL);
19709         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->processing_queue_high_meth);
19710         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19711                 (*env)->ExceptionDescribe(env);
19712                 (*env)->FatalError(env, "A call to processing_queue_high in LDKRoutingMessageHandler from rust threw an exception.");
19713         }
19714         if (get_jenv_res == JNI_EDETACHED) {
19715                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19716         }
19717         return ret;
19718 }
19719 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
19720         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19721         JNIEnv *env;
19722         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19723         if (get_jenv_res == JNI_EDETACHED) {
19724                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19725         } else {
19726                 DO_ASSERT(get_jenv_res == JNI_OK);
19727         }
19728         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19729         CHECK(obj != NULL);
19730         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
19731         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19732                 (*env)->ExceptionDescribe(env);
19733                 (*env)->FatalError(env, "A call to provided_node_features in LDKRoutingMessageHandler from rust threw an exception.");
19734         }
19735         LDKNodeFeatures ret_conv;
19736         ret_conv.inner = untag_ptr(ret);
19737         ret_conv.is_owned = ptr_is_owned(ret);
19738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
19739         if (get_jenv_res == JNI_EDETACHED) {
19740                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19741         }
19742         return ret_conv;
19743 }
19744 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
19745         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
19746         JNIEnv *env;
19747         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19748         if (get_jenv_res == JNI_EDETACHED) {
19749                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19750         } else {
19751                 DO_ASSERT(get_jenv_res == JNI_OK);
19752         }
19753         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19754         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19755         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19756         CHECK(obj != NULL);
19757         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
19758         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19759                 (*env)->ExceptionDescribe(env);
19760                 (*env)->FatalError(env, "A call to provided_init_features in LDKRoutingMessageHandler from rust threw an exception.");
19761         }
19762         LDKInitFeatures ret_conv;
19763         ret_conv.inner = untag_ptr(ret);
19764         ret_conv.is_owned = ptr_is_owned(ret);
19765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
19766         if (get_jenv_res == JNI_EDETACHED) {
19767                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19768         }
19769         return ret_conv;
19770 }
19771 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
19772         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
19773         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19774         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
19775 }
19776 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
19777         jclass c = (*env)->GetObjectClass(env, o);
19778         CHECK(c != NULL);
19779         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
19780         atomic_init(&calls->refcnt, 1);
19781         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19782         calls->o = (*env)->NewWeakGlobalRef(env, o);
19783         calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
19784         CHECK(calls->handle_node_announcement_meth != NULL);
19785         calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
19786         CHECK(calls->handle_channel_announcement_meth != NULL);
19787         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
19788         CHECK(calls->handle_channel_update_meth != NULL);
19789         calls->get_next_channel_announcement_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcement", "(J)J");
19790         CHECK(calls->get_next_channel_announcement_meth != NULL);
19791         calls->get_next_node_announcement_meth = (*env)->GetMethodID(env, c, "get_next_node_announcement", "(J)J");
19792         CHECK(calls->get_next_node_announcement_meth != NULL);
19793         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
19794         CHECK(calls->peer_connected_meth != NULL);
19795         calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
19796         CHECK(calls->handle_reply_channel_range_meth != NULL);
19797         calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
19798         CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
19799         calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
19800         CHECK(calls->handle_query_channel_range_meth != NULL);
19801         calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
19802         CHECK(calls->handle_query_short_channel_ids_meth != NULL);
19803         calls->processing_queue_high_meth = (*env)->GetMethodID(env, c, "processing_queue_high", "()Z");
19804         CHECK(calls->processing_queue_high_meth != NULL);
19805         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
19806         CHECK(calls->provided_node_features_meth != NULL);
19807         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
19808         CHECK(calls->provided_init_features_meth != NULL);
19809
19810         LDKRoutingMessageHandler ret = {
19811                 .this_arg = (void*) calls,
19812                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
19813                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
19814                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
19815                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
19816                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
19817                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
19818                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
19819                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
19820                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
19821                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
19822                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
19823                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
19824                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
19825                 .free = LDKRoutingMessageHandler_JCalls_free,
19826                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
19827         };
19828         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
19829         return ret;
19830 }
19831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
19832         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
19833         *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
19834         return tag_ptr(res_ptr, true);
19835 }
19836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
19837         LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)untag_ptr(arg);
19838         return tag_ptr(&inp->MessageSendEventsProvider, false);
19839 }
19840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
19841         void* this_arg_ptr = untag_ptr(this_arg);
19842         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19843         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
19844         LDKNodeAnnouncement msg_conv;
19845         msg_conv.inner = untag_ptr(msg);
19846         msg_conv.is_owned = ptr_is_owned(msg);
19847         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19848         msg_conv.is_owned = false;
19849         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19850         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
19851         return tag_ptr(ret_conv, true);
19852 }
19853
19854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
19855         void* this_arg_ptr = untag_ptr(this_arg);
19856         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19857         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
19858         LDKChannelAnnouncement msg_conv;
19859         msg_conv.inner = untag_ptr(msg);
19860         msg_conv.is_owned = ptr_is_owned(msg);
19861         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19862         msg_conv.is_owned = false;
19863         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19864         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
19865         return tag_ptr(ret_conv, true);
19866 }
19867
19868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
19869         void* this_arg_ptr = untag_ptr(this_arg);
19870         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19871         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
19872         LDKChannelUpdate msg_conv;
19873         msg_conv.inner = untag_ptr(msg);
19874         msg_conv.is_owned = ptr_is_owned(msg);
19875         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19876         msg_conv.is_owned = false;
19877         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19878         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
19879         return tag_ptr(ret_conv, true);
19880 }
19881
19882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t starting_point) {
19883         void* this_arg_ptr = untag_ptr(this_arg);
19884         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19885         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
19886         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19887         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
19888         int64_t ret_ref = tag_ptr(ret_copy, true);
19889         return ret_ref;
19890 }
19891
19892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t starting_point) {
19893         void* this_arg_ptr = untag_ptr(this_arg);
19894         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19895         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
19896         LDKNodeId starting_point_conv;
19897         starting_point_conv.inner = untag_ptr(starting_point);
19898         starting_point_conv.is_owned = ptr_is_owned(starting_point);
19899         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
19900         starting_point_conv = NodeId_clone(&starting_point_conv);
19901         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
19902         int64_t ret_ref = 0;
19903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
19905         return ret_ref;
19906 }
19907
19908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init, jboolean inbound) {
19909         void* this_arg_ptr = untag_ptr(this_arg);
19910         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19911         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
19912         LDKPublicKey their_node_id_ref;
19913         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19914         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19915         LDKInit init_conv;
19916         init_conv.inner = untag_ptr(init);
19917         init_conv.is_owned = ptr_is_owned(init);
19918         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
19919         init_conv.is_owned = false;
19920         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19921         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
19922         return tag_ptr(ret_conv, true);
19923 }
19924
19925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1reply_1channel_1range(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
19926         void* this_arg_ptr = untag_ptr(this_arg);
19927         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19928         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
19929         LDKPublicKey their_node_id_ref;
19930         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19931         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19932         LDKReplyChannelRange msg_conv;
19933         msg_conv.inner = untag_ptr(msg);
19934         msg_conv.is_owned = ptr_is_owned(msg);
19935         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19936         msg_conv = ReplyChannelRange_clone(&msg_conv);
19937         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19938         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
19939         return tag_ptr(ret_conv, true);
19940 }
19941
19942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1reply_1short_1channel_1ids_1end(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
19943         void* this_arg_ptr = untag_ptr(this_arg);
19944         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19945         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
19946         LDKPublicKey their_node_id_ref;
19947         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19948         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19949         LDKReplyShortChannelIdsEnd msg_conv;
19950         msg_conv.inner = untag_ptr(msg);
19951         msg_conv.is_owned = ptr_is_owned(msg);
19952         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19953         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
19954         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19955         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
19956         return tag_ptr(ret_conv, true);
19957 }
19958
19959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1query_1channel_1range(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
19960         void* this_arg_ptr = untag_ptr(this_arg);
19961         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19962         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
19963         LDKPublicKey their_node_id_ref;
19964         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19965         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19966         LDKQueryChannelRange msg_conv;
19967         msg_conv.inner = untag_ptr(msg);
19968         msg_conv.is_owned = ptr_is_owned(msg);
19969         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19970         msg_conv = QueryChannelRange_clone(&msg_conv);
19971         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19972         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
19973         return tag_ptr(ret_conv, true);
19974 }
19975
19976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1query_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
19977         void* this_arg_ptr = untag_ptr(this_arg);
19978         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19979         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
19980         LDKPublicKey their_node_id_ref;
19981         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
19982         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
19983         LDKQueryShortChannelIds msg_conv;
19984         msg_conv.inner = untag_ptr(msg);
19985         msg_conv.is_owned = ptr_is_owned(msg);
19986         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19987         msg_conv = QueryShortChannelIds_clone(&msg_conv);
19988         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19989         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
19990         return tag_ptr(ret_conv, true);
19991 }
19992
19993 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1processing_1queue_1high(JNIEnv *env, jclass clz, int64_t this_arg) {
19994         void* this_arg_ptr = untag_ptr(this_arg);
19995         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19996         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
19997         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
19998         return ret_conv;
19999 }
20000
20001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
20002         void* this_arg_ptr = untag_ptr(this_arg);
20003         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20004         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
20005         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
20006         int64_t ret_ref = 0;
20007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20009         return ret_ref;
20010 }
20011
20012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1provided_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
20013         void* this_arg_ptr = untag_ptr(this_arg);
20014         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20015         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
20016         LDKPublicKey their_node_id_ref;
20017         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20018         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20019         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
20020         int64_t ret_ref = 0;
20021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20023         return ret_ref;
20024 }
20025
20026 typedef struct LDKOnionMessageHandler_JCalls {
20027         atomic_size_t refcnt;
20028         JavaVM *vm;
20029         jweak o;
20030         jmethodID get_and_clear_connections_needed_meth;
20031         jmethodID handle_onion_message_meth;
20032         jmethodID next_onion_message_for_peer_meth;
20033         jmethodID peer_connected_meth;
20034         jmethodID peer_disconnected_meth;
20035         jmethodID timer_tick_occurred_meth;
20036         jmethodID provided_node_features_meth;
20037         jmethodID provided_init_features_meth;
20038 } LDKOnionMessageHandler_JCalls;
20039 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
20040         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
20041         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20042                 JNIEnv *env;
20043                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20044                 if (get_jenv_res == JNI_EDETACHED) {
20045                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20046                 } else {
20047                         DO_ASSERT(get_jenv_res == JNI_OK);
20048                 }
20049                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20050                 if (get_jenv_res == JNI_EDETACHED) {
20051                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20052                 }
20053                 FREE(j_calls);
20054         }
20055 }
20056 LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ get_and_clear_connections_needed_LDKOnionMessageHandler_jcall(const void* this_arg) {
20057         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
20058         JNIEnv *env;
20059         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20060         if (get_jenv_res == JNI_EDETACHED) {
20061                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20062         } else {
20063                 DO_ASSERT(get_jenv_res == JNI_OK);
20064         }
20065         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20066         CHECK(obj != NULL);
20067         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_connections_needed_meth);
20068         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20069                 (*env)->ExceptionDescribe(env);
20070                 (*env)->FatalError(env, "A call to get_and_clear_connections_needed in LDKOnionMessageHandler from rust threw an exception.");
20071         }
20072         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_constr;
20073         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
20074         if (ret_constr.datalen > 0)
20075                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
20076         else
20077                 ret_constr.data = NULL;
20078         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
20079         for (size_t o = 0; o < ret_constr.datalen; o++) {
20080                 int64_t ret_conv_40 = ret_vals[o];
20081                 void* ret_conv_40_ptr = untag_ptr(ret_conv_40);
20082                 CHECK_ACCESS(ret_conv_40_ptr);
20083                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ ret_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(ret_conv_40_ptr);
20084                 FREE(untag_ptr(ret_conv_40));
20085                 ret_constr.data[o] = ret_conv_40_conv;
20086         }
20087         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
20088         if (get_jenv_res == JNI_EDETACHED) {
20089                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20090         }
20091         return ret_constr;
20092 }
20093 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
20094         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
20095         JNIEnv *env;
20096         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20097         if (get_jenv_res == JNI_EDETACHED) {
20098                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20099         } else {
20100                 DO_ASSERT(get_jenv_res == JNI_OK);
20101         }
20102         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
20103         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
20104         LDKOnionMessage msg_var = *msg;
20105         int64_t msg_ref = 0;
20106         msg_var = OnionMessage_clone(&msg_var);
20107         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
20108         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
20109         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20110         CHECK(obj != NULL);
20111         (*env)->CallVoidMethod(env, obj, j_calls->handle_onion_message_meth, peer_node_id_arr, msg_ref);
20112         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20113                 (*env)->ExceptionDescribe(env);
20114                 (*env)->FatalError(env, "A call to handle_onion_message in LDKOnionMessageHandler from rust threw an exception.");
20115         }
20116         if (get_jenv_res == JNI_EDETACHED) {
20117                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20118         }
20119 }
20120 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
20121         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
20122         JNIEnv *env;
20123         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20124         if (get_jenv_res == JNI_EDETACHED) {
20125                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20126         } else {
20127                 DO_ASSERT(get_jenv_res == JNI_OK);
20128         }
20129         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
20130         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
20131         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20132         CHECK(obj != NULL);
20133         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->next_onion_message_for_peer_meth, peer_node_id_arr);
20134         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20135                 (*env)->ExceptionDescribe(env);
20136                 (*env)->FatalError(env, "A call to next_onion_message_for_peer in LDKOnionMessageHandler from rust threw an exception.");
20137         }
20138         LDKOnionMessage ret_conv;
20139         ret_conv.inner = untag_ptr(ret);
20140         ret_conv.is_owned = ptr_is_owned(ret);
20141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
20142         if (get_jenv_res == JNI_EDETACHED) {
20143                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20144         }
20145         return ret_conv;
20146 }
20147 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
20148         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
20149         JNIEnv *env;
20150         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20151         if (get_jenv_res == JNI_EDETACHED) {
20152                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20153         } else {
20154                 DO_ASSERT(get_jenv_res == JNI_OK);
20155         }
20156         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
20157         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
20158         LDKInit init_var = *init;
20159         int64_t init_ref = 0;
20160         init_var = Init_clone(&init_var);
20161         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
20162         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
20163         jboolean inbound_conv = inbound;
20164         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20165         CHECK(obj != NULL);
20166         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
20167         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20168                 (*env)->ExceptionDescribe(env);
20169                 (*env)->FatalError(env, "A call to peer_connected in LDKOnionMessageHandler from rust threw an exception.");
20170         }
20171         void* ret_ptr = untag_ptr(ret);
20172         CHECK_ACCESS(ret_ptr);
20173         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
20174         FREE(untag_ptr(ret));
20175         if (get_jenv_res == JNI_EDETACHED) {
20176                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20177         }
20178         return ret_conv;
20179 }
20180 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
20181         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
20182         JNIEnv *env;
20183         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20184         if (get_jenv_res == JNI_EDETACHED) {
20185                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20186         } else {
20187                 DO_ASSERT(get_jenv_res == JNI_OK);
20188         }
20189         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
20190         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
20191         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20192         CHECK(obj != NULL);
20193         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
20194         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20195                 (*env)->ExceptionDescribe(env);
20196                 (*env)->FatalError(env, "A call to peer_disconnected in LDKOnionMessageHandler from rust threw an exception.");
20197         }
20198         if (get_jenv_res == JNI_EDETACHED) {
20199                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20200         }
20201 }
20202 void timer_tick_occurred_LDKOnionMessageHandler_jcall(const void* this_arg) {
20203         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
20204         JNIEnv *env;
20205         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20206         if (get_jenv_res == JNI_EDETACHED) {
20207                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20208         } else {
20209                 DO_ASSERT(get_jenv_res == JNI_OK);
20210         }
20211         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20212         CHECK(obj != NULL);
20213         (*env)->CallVoidMethod(env, obj, j_calls->timer_tick_occurred_meth);
20214         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20215                 (*env)->ExceptionDescribe(env);
20216                 (*env)->FatalError(env, "A call to timer_tick_occurred in LDKOnionMessageHandler from rust threw an exception.");
20217         }
20218         if (get_jenv_res == JNI_EDETACHED) {
20219                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20220         }
20221 }
20222 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
20223         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
20224         JNIEnv *env;
20225         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20226         if (get_jenv_res == JNI_EDETACHED) {
20227                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20228         } else {
20229                 DO_ASSERT(get_jenv_res == JNI_OK);
20230         }
20231         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20232         CHECK(obj != NULL);
20233         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
20234         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20235                 (*env)->ExceptionDescribe(env);
20236                 (*env)->FatalError(env, "A call to provided_node_features in LDKOnionMessageHandler from rust threw an exception.");
20237         }
20238         LDKNodeFeatures ret_conv;
20239         ret_conv.inner = untag_ptr(ret);
20240         ret_conv.is_owned = ptr_is_owned(ret);
20241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
20242         if (get_jenv_res == JNI_EDETACHED) {
20243                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20244         }
20245         return ret_conv;
20246 }
20247 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
20248         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
20249         JNIEnv *env;
20250         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20251         if (get_jenv_res == JNI_EDETACHED) {
20252                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20253         } else {
20254                 DO_ASSERT(get_jenv_res == JNI_OK);
20255         }
20256         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
20257         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
20258         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20259         CHECK(obj != NULL);
20260         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
20261         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20262                 (*env)->ExceptionDescribe(env);
20263                 (*env)->FatalError(env, "A call to provided_init_features in LDKOnionMessageHandler from rust threw an exception.");
20264         }
20265         LDKInitFeatures ret_conv;
20266         ret_conv.inner = untag_ptr(ret);
20267         ret_conv.is_owned = ptr_is_owned(ret);
20268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
20269         if (get_jenv_res == JNI_EDETACHED) {
20270                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20271         }
20272         return ret_conv;
20273 }
20274 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
20275         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
20276         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
20277 }
20278 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
20279         jclass c = (*env)->GetObjectClass(env, o);
20280         CHECK(c != NULL);
20281         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
20282         atomic_init(&calls->refcnt, 1);
20283         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
20284         calls->o = (*env)->NewWeakGlobalRef(env, o);
20285         calls->get_and_clear_connections_needed_meth = (*env)->GetMethodID(env, c, "get_and_clear_connections_needed", "()[J");
20286         CHECK(calls->get_and_clear_connections_needed_meth != NULL);
20287         calls->handle_onion_message_meth = (*env)->GetMethodID(env, c, "handle_onion_message", "([BJ)V");
20288         CHECK(calls->handle_onion_message_meth != NULL);
20289         calls->next_onion_message_for_peer_meth = (*env)->GetMethodID(env, c, "next_onion_message_for_peer", "([B)J");
20290         CHECK(calls->next_onion_message_for_peer_meth != NULL);
20291         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
20292         CHECK(calls->peer_connected_meth != NULL);
20293         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
20294         CHECK(calls->peer_disconnected_meth != NULL);
20295         calls->timer_tick_occurred_meth = (*env)->GetMethodID(env, c, "timer_tick_occurred", "()V");
20296         CHECK(calls->timer_tick_occurred_meth != NULL);
20297         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
20298         CHECK(calls->provided_node_features_meth != NULL);
20299         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
20300         CHECK(calls->provided_init_features_meth != NULL);
20301
20302         LDKOnionMessageHandler ret = {
20303                 .this_arg = (void*) calls,
20304                 .get_and_clear_connections_needed = get_and_clear_connections_needed_LDKOnionMessageHandler_jcall,
20305                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
20306                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageHandler_jcall,
20307                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
20308                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
20309                 .timer_tick_occurred = timer_tick_occurred_LDKOnionMessageHandler_jcall,
20310                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
20311                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
20312                 .free = LDKOnionMessageHandler_JCalls_free,
20313         };
20314         return ret;
20315 }
20316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
20317         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
20318         *res_ptr = LDKOnionMessageHandler_init(env, clz, o);
20319         return tag_ptr(res_ptr, true);
20320 }
20321 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1get_1and_1clear_1connections_1needed(JNIEnv *env, jclass clz, int64_t this_arg) {
20322         void* this_arg_ptr = untag_ptr(this_arg);
20323         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20324         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
20325         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_var = (this_arg_conv->get_and_clear_connections_needed)(this_arg_conv->this_arg);
20326         int64_tArray ret_arr = NULL;
20327         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
20328         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
20329         for (size_t o = 0; o < ret_var.datalen; o++) {
20330                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
20331                 *ret_conv_40_conv = ret_var.data[o];
20332                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
20333         }
20334         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
20335         FREE(ret_var.data);
20336         return ret_arr;
20337 }
20338
20339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1handle_1onion_1message(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray peer_node_id, int64_t msg) {
20340         void* this_arg_ptr = untag_ptr(this_arg);
20341         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20342         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
20343         LDKPublicKey peer_node_id_ref;
20344         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
20345         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
20346         LDKOnionMessage msg_conv;
20347         msg_conv.inner = untag_ptr(msg);
20348         msg_conv.is_owned = ptr_is_owned(msg);
20349         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20350         msg_conv.is_owned = false;
20351         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
20352 }
20353
20354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1next_1onion_1message_1for_1peer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray peer_node_id) {
20355         void* this_arg_ptr = untag_ptr(this_arg);
20356         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20357         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
20358         LDKPublicKey peer_node_id_ref;
20359         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
20360         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
20361         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
20362         int64_t ret_ref = 0;
20363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20365         return ret_ref;
20366 }
20367
20368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init, jboolean inbound) {
20369         void* this_arg_ptr = untag_ptr(this_arg);
20370         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20371         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
20372         LDKPublicKey their_node_id_ref;
20373         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20374         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20375         LDKInit init_conv;
20376         init_conv.inner = untag_ptr(init);
20377         init_conv.is_owned = ptr_is_owned(init);
20378         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
20379         init_conv.is_owned = false;
20380         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
20381         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
20382         return tag_ptr(ret_conv, true);
20383 }
20384
20385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
20386         void* this_arg_ptr = untag_ptr(this_arg);
20387         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20388         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
20389         LDKPublicKey their_node_id_ref;
20390         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20391         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20392         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
20393 }
20394
20395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
20396         void* this_arg_ptr = untag_ptr(this_arg);
20397         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20398         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
20399         (this_arg_conv->timer_tick_occurred)(this_arg_conv->this_arg);
20400 }
20401
20402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
20403         void* this_arg_ptr = untag_ptr(this_arg);
20404         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20405         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
20406         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
20407         int64_t ret_ref = 0;
20408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20410         return ret_ref;
20411 }
20412
20413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1provided_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
20414         void* this_arg_ptr = untag_ptr(this_arg);
20415         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20416         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
20417         LDKPublicKey their_node_id_ref;
20418         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20419         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20420         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
20421         int64_t ret_ref = 0;
20422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20424         return ret_ref;
20425 }
20426
20427 typedef struct LDKCustomMessageReader_JCalls {
20428         atomic_size_t refcnt;
20429         JavaVM *vm;
20430         jweak o;
20431         jmethodID read_meth;
20432 } LDKCustomMessageReader_JCalls;
20433 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
20434         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
20435         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20436                 JNIEnv *env;
20437                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20438                 if (get_jenv_res == JNI_EDETACHED) {
20439                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20440                 } else {
20441                         DO_ASSERT(get_jenv_res == JNI_OK);
20442                 }
20443                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20444                 if (get_jenv_res == JNI_EDETACHED) {
20445                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20446                 }
20447                 FREE(j_calls);
20448         }
20449 }
20450 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
20451         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
20452         JNIEnv *env;
20453         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20454         if (get_jenv_res == JNI_EDETACHED) {
20455                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20456         } else {
20457                 DO_ASSERT(get_jenv_res == JNI_OK);
20458         }
20459         int16_t message_type_conv = message_type;
20460         LDKu8slice buffer_var = buffer;
20461         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
20462         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
20463         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20464         CHECK(obj != NULL);
20465         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type_conv, buffer_arr);
20466         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20467                 (*env)->ExceptionDescribe(env);
20468                 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
20469         }
20470         void* ret_ptr = untag_ptr(ret);
20471         CHECK_ACCESS(ret_ptr);
20472         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
20473         FREE(untag_ptr(ret));
20474         if (get_jenv_res == JNI_EDETACHED) {
20475                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20476         }
20477         return ret_conv;
20478 }
20479 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
20480         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
20481         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
20482 }
20483 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
20484         jclass c = (*env)->GetObjectClass(env, o);
20485         CHECK(c != NULL);
20486         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
20487         atomic_init(&calls->refcnt, 1);
20488         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
20489         calls->o = (*env)->NewWeakGlobalRef(env, o);
20490         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
20491         CHECK(calls->read_meth != NULL);
20492
20493         LDKCustomMessageReader ret = {
20494                 .this_arg = (void*) calls,
20495                 .read = read_LDKCustomMessageReader_jcall,
20496                 .free = LDKCustomMessageReader_JCalls_free,
20497         };
20498         return ret;
20499 }
20500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
20501         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
20502         *res_ptr = LDKCustomMessageReader_init(env, clz, o);
20503         return tag_ptr(res_ptr, true);
20504 }
20505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1read(JNIEnv *env, jclass clz, int64_t this_arg, int16_t message_type, int8_tArray buffer) {
20506         void* this_arg_ptr = untag_ptr(this_arg);
20507         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20508         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
20509         LDKu8slice buffer_ref;
20510         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
20511         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
20512         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
20513         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
20514         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
20515         return tag_ptr(ret_conv, true);
20516 }
20517
20518 typedef struct LDKCustomMessageHandler_JCalls {
20519         atomic_size_t refcnt;
20520         JavaVM *vm;
20521         jweak o;
20522         LDKCustomMessageReader_JCalls* CustomMessageReader;
20523         jmethodID handle_custom_message_meth;
20524         jmethodID get_and_clear_pending_msg_meth;
20525         jmethodID provided_node_features_meth;
20526         jmethodID provided_init_features_meth;
20527 } LDKCustomMessageHandler_JCalls;
20528 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
20529         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
20530         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20531                 JNIEnv *env;
20532                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20533                 if (get_jenv_res == JNI_EDETACHED) {
20534                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20535                 } else {
20536                         DO_ASSERT(get_jenv_res == JNI_OK);
20537                 }
20538                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20539                 if (get_jenv_res == JNI_EDETACHED) {
20540                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20541                 }
20542                 FREE(j_calls);
20543         }
20544 }
20545 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
20546         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
20547         JNIEnv *env;
20548         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20549         if (get_jenv_res == JNI_EDETACHED) {
20550                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20551         } else {
20552                 DO_ASSERT(get_jenv_res == JNI_OK);
20553         }
20554         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
20555         *msg_ret = msg;
20556         int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
20557         (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
20558         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20559         CHECK(obj != NULL);
20560         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true), sender_node_id_arr);
20561         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20562                 (*env)->ExceptionDescribe(env);
20563                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
20564         }
20565         void* ret_ptr = untag_ptr(ret);
20566         CHECK_ACCESS(ret_ptr);
20567         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
20568         FREE(untag_ptr(ret));
20569         if (get_jenv_res == JNI_EDETACHED) {
20570                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20571         }
20572         return ret_conv;
20573 }
20574 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
20575         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
20576         JNIEnv *env;
20577         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20578         if (get_jenv_res == JNI_EDETACHED) {
20579                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20580         } else {
20581                 DO_ASSERT(get_jenv_res == JNI_OK);
20582         }
20583         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20584         CHECK(obj != NULL);
20585         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
20586         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20587                 (*env)->ExceptionDescribe(env);
20588                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
20589         }
20590         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
20591         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
20592         if (ret_constr.datalen > 0)
20593                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
20594         else
20595                 ret_constr.data = NULL;
20596         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
20597         for (size_t z = 0; z < ret_constr.datalen; z++) {
20598                 int64_t ret_conv_25 = ret_vals[z];
20599                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
20600                 CHECK_ACCESS(ret_conv_25_ptr);
20601                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
20602                 FREE(untag_ptr(ret_conv_25));
20603                 ret_constr.data[z] = ret_conv_25_conv;
20604         }
20605         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
20606         if (get_jenv_res == JNI_EDETACHED) {
20607                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20608         }
20609         return ret_constr;
20610 }
20611 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
20612         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
20613         JNIEnv *env;
20614         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20615         if (get_jenv_res == JNI_EDETACHED) {
20616                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20617         } else {
20618                 DO_ASSERT(get_jenv_res == JNI_OK);
20619         }
20620         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20621         CHECK(obj != NULL);
20622         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
20623         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20624                 (*env)->ExceptionDescribe(env);
20625                 (*env)->FatalError(env, "A call to provided_node_features in LDKCustomMessageHandler from rust threw an exception.");
20626         }
20627         LDKNodeFeatures ret_conv;
20628         ret_conv.inner = untag_ptr(ret);
20629         ret_conv.is_owned = ptr_is_owned(ret);
20630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
20631         if (get_jenv_res == JNI_EDETACHED) {
20632                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20633         }
20634         return ret_conv;
20635 }
20636 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
20637         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
20638         JNIEnv *env;
20639         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20640         if (get_jenv_res == JNI_EDETACHED) {
20641                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20642         } else {
20643                 DO_ASSERT(get_jenv_res == JNI_OK);
20644         }
20645         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
20646         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
20647         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20648         CHECK(obj != NULL);
20649         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
20650         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20651                 (*env)->ExceptionDescribe(env);
20652                 (*env)->FatalError(env, "A call to provided_init_features in LDKCustomMessageHandler from rust threw an exception.");
20653         }
20654         LDKInitFeatures ret_conv;
20655         ret_conv.inner = untag_ptr(ret);
20656         ret_conv.is_owned = ptr_is_owned(ret);
20657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
20658         if (get_jenv_res == JNI_EDETACHED) {
20659                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20660         }
20661         return ret_conv;
20662 }
20663 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
20664         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
20665         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
20666         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
20667 }
20668 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
20669         jclass c = (*env)->GetObjectClass(env, o);
20670         CHECK(c != NULL);
20671         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
20672         atomic_init(&calls->refcnt, 1);
20673         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
20674         calls->o = (*env)->NewWeakGlobalRef(env, o);
20675         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
20676         CHECK(calls->handle_custom_message_meth != NULL);
20677         calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
20678         CHECK(calls->get_and_clear_pending_msg_meth != NULL);
20679         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
20680         CHECK(calls->provided_node_features_meth != NULL);
20681         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
20682         CHECK(calls->provided_init_features_meth != NULL);
20683
20684         LDKCustomMessageHandler ret = {
20685                 .this_arg = (void*) calls,
20686                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
20687                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
20688                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
20689                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
20690                 .free = LDKCustomMessageHandler_JCalls_free,
20691                 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
20692         };
20693         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
20694         return ret;
20695 }
20696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
20697         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
20698         *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
20699         return tag_ptr(res_ptr, true);
20700 }
20701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
20702         LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)untag_ptr(arg);
20703         return tag_ptr(&inp->CustomMessageReader, false);
20704 }
20705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1handle_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int8_tArray sender_node_id) {
20706         void* this_arg_ptr = untag_ptr(this_arg);
20707         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20708         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
20709         void* msg_ptr = untag_ptr(msg);
20710         CHECK_ACCESS(msg_ptr);
20711         LDKType msg_conv = *(LDKType*)(msg_ptr);
20712         if (msg_conv.free == LDKType_JCalls_free) {
20713                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20714                 LDKType_JCalls_cloned(&msg_conv);
20715         }
20716         LDKPublicKey sender_node_id_ref;
20717         CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
20718         (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
20719         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20720         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
20721         return tag_ptr(ret_conv, true);
20722 }
20723
20724 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
20725         void* this_arg_ptr = untag_ptr(this_arg);
20726         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20727         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
20728         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
20729         int64_tArray ret_arr = NULL;
20730         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
20731         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
20732         for (size_t z = 0; z < ret_var.datalen; z++) {
20733                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
20734                 *ret_conv_25_conv = ret_var.data[z];
20735                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
20736         }
20737         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
20738         FREE(ret_var.data);
20739         return ret_arr;
20740 }
20741
20742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
20743         void* this_arg_ptr = untag_ptr(this_arg);
20744         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20745         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
20746         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
20747         int64_t ret_ref = 0;
20748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20750         return ret_ref;
20751 }
20752
20753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1provided_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
20754         void* this_arg_ptr = untag_ptr(this_arg);
20755         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20756         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
20757         LDKPublicKey their_node_id_ref;
20758         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20759         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20760         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
20761         int64_t ret_ref = 0;
20762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20764         return ret_ref;
20765 }
20766
20767 typedef struct LDKCustomOnionMessageHandler_JCalls {
20768         atomic_size_t refcnt;
20769         JavaVM *vm;
20770         jweak o;
20771         jmethodID handle_custom_message_meth;
20772         jmethodID read_custom_message_meth;
20773         jmethodID release_pending_custom_messages_meth;
20774 } LDKCustomOnionMessageHandler_JCalls;
20775 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
20776         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
20777         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20778                 JNIEnv *env;
20779                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20780                 if (get_jenv_res == JNI_EDETACHED) {
20781                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20782                 } else {
20783                         DO_ASSERT(get_jenv_res == JNI_OK);
20784                 }
20785                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20786                 if (get_jenv_res == JNI_EDETACHED) {
20787                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20788                 }
20789                 FREE(j_calls);
20790         }
20791 }
20792 LDKCOption_OnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKOnionMessageContents msg) {
20793         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
20794         JNIEnv *env;
20795         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20796         if (get_jenv_res == JNI_EDETACHED) {
20797                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20798         } else {
20799                 DO_ASSERT(get_jenv_res == JNI_OK);
20800         }
20801         LDKOnionMessageContents* msg_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
20802         *msg_ret = msg;
20803         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20804         CHECK(obj != NULL);
20805         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true));
20806         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20807                 (*env)->ExceptionDescribe(env);
20808                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
20809         }
20810         void* ret_ptr = untag_ptr(ret);
20811         CHECK_ACCESS(ret_ptr);
20812         LDKCOption_OnionMessageContentsZ ret_conv = *(LDKCOption_OnionMessageContentsZ*)(ret_ptr);
20813         FREE(untag_ptr(ret));
20814         if (get_jenv_res == JNI_EDETACHED) {
20815                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20816         }
20817         return ret_conv;
20818 }
20819 LDKCResult_COption_OnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
20820         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
20821         JNIEnv *env;
20822         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20823         if (get_jenv_res == JNI_EDETACHED) {
20824                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20825         } else {
20826                 DO_ASSERT(get_jenv_res == JNI_OK);
20827         }
20828         int64_t message_type_conv = message_type;
20829         LDKu8slice buffer_var = buffer;
20830         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
20831         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
20832         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20833         CHECK(obj != NULL);
20834         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_custom_message_meth, message_type_conv, buffer_arr);
20835         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20836                 (*env)->ExceptionDescribe(env);
20837                 (*env)->FatalError(env, "A call to read_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
20838         }
20839         void* ret_ptr = untag_ptr(ret);
20840         CHECK_ACCESS(ret_ptr);
20841         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(ret_ptr);
20842         FREE(untag_ptr(ret));
20843         if (get_jenv_res == JNI_EDETACHED) {
20844                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20845         }
20846         return ret_conv;
20847 }
20848 LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall(const void* this_arg) {
20849         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
20850         JNIEnv *env;
20851         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20852         if (get_jenv_res == JNI_EDETACHED) {
20853                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20854         } else {
20855                 DO_ASSERT(get_jenv_res == JNI_OK);
20856         }
20857         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20858         CHECK(obj != NULL);
20859         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_custom_messages_meth);
20860         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20861                 (*env)->ExceptionDescribe(env);
20862                 (*env)->FatalError(env, "A call to release_pending_custom_messages in LDKCustomOnionMessageHandler from rust threw an exception.");
20863         }
20864         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_constr;
20865         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
20866         if (ret_constr.datalen > 0)
20867                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
20868         else
20869                 ret_constr.data = NULL;
20870         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
20871         for (size_t e = 0; e < ret_constr.datalen; e++) {
20872                 int64_t ret_conv_56 = ret_vals[e];
20873                 void* ret_conv_56_ptr = untag_ptr(ret_conv_56);
20874                 CHECK_ACCESS(ret_conv_56_ptr);
20875                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ ret_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(ret_conv_56_ptr);
20876                 FREE(untag_ptr(ret_conv_56));
20877                 ret_constr.data[e] = ret_conv_56_conv;
20878         }
20879         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
20880         if (get_jenv_res == JNI_EDETACHED) {
20881                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20882         }
20883         return ret_constr;
20884 }
20885 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
20886         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
20887         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
20888 }
20889 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
20890         jclass c = (*env)->GetObjectClass(env, o);
20891         CHECK(c != NULL);
20892         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
20893         atomic_init(&calls->refcnt, 1);
20894         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
20895         calls->o = (*env)->NewWeakGlobalRef(env, o);
20896         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J)J");
20897         CHECK(calls->handle_custom_message_meth != NULL);
20898         calls->read_custom_message_meth = (*env)->GetMethodID(env, c, "read_custom_message", "(J[B)J");
20899         CHECK(calls->read_custom_message_meth != NULL);
20900         calls->release_pending_custom_messages_meth = (*env)->GetMethodID(env, c, "release_pending_custom_messages", "()[J");
20901         CHECK(calls->release_pending_custom_messages_meth != NULL);
20902
20903         LDKCustomOnionMessageHandler ret = {
20904                 .this_arg = (void*) calls,
20905                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
20906                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
20907                 .release_pending_custom_messages = release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall,
20908                 .free = LDKCustomOnionMessageHandler_JCalls_free,
20909         };
20910         return ret;
20911 }
20912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
20913         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
20914         *res_ptr = LDKCustomOnionMessageHandler_init(env, clz, o);
20915         return tag_ptr(res_ptr, true);
20916 }
20917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1handle_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
20918         void* this_arg_ptr = untag_ptr(this_arg);
20919         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20920         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
20921         void* msg_ptr = untag_ptr(msg);
20922         CHECK_ACCESS(msg_ptr);
20923         LDKOnionMessageContents msg_conv = *(LDKOnionMessageContents*)(msg_ptr);
20924         if (msg_conv.free == LDKOnionMessageContents_JCalls_free) {
20925                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20926                 LDKOnionMessageContents_JCalls_cloned(&msg_conv);
20927         }
20928         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
20929         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
20930         int64_t ret_ref = tag_ptr(ret_copy, true);
20931         return ret_ref;
20932 }
20933
20934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1read_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t message_type, int8_tArray buffer) {
20935         void* this_arg_ptr = untag_ptr(this_arg);
20936         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20937         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
20938         LDKu8slice buffer_ref;
20939         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
20940         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
20941         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
20942         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
20943         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
20944         return tag_ptr(ret_conv, true);
20945 }
20946
20947 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1release_1pending_1custom_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
20948         void* this_arg_ptr = untag_ptr(this_arg);
20949         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20950         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
20951         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_custom_messages)(this_arg_conv->this_arg);
20952         int64_tArray ret_arr = NULL;
20953         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
20954         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
20955         for (size_t e = 0; e < ret_var.datalen; e++) {
20956                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv_56_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
20957                 *ret_conv_56_conv = ret_var.data[e];
20958                 ret_arr_ptr[e] = tag_ptr(ret_conv_56_conv, true);
20959         }
20960         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
20961         FREE(ret_var.data);
20962         return ret_arr;
20963 }
20964
20965 typedef struct LDKSocketDescriptor_JCalls {
20966         atomic_size_t refcnt;
20967         JavaVM *vm;
20968         jweak o;
20969         jmethodID send_data_meth;
20970         jmethodID disconnect_socket_meth;
20971         jmethodID eq_meth;
20972         jmethodID hash_meth;
20973 } LDKSocketDescriptor_JCalls;
20974 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
20975         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
20976         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20977                 JNIEnv *env;
20978                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20979                 if (get_jenv_res == JNI_EDETACHED) {
20980                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20981                 } else {
20982                         DO_ASSERT(get_jenv_res == JNI_OK);
20983                 }
20984                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20985                 if (get_jenv_res == JNI_EDETACHED) {
20986                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20987                 }
20988                 FREE(j_calls);
20989         }
20990 }
20991 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
20992         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
20993         JNIEnv *env;
20994         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20995         if (get_jenv_res == JNI_EDETACHED) {
20996                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20997         } else {
20998                 DO_ASSERT(get_jenv_res == JNI_OK);
20999         }
21000         LDKu8slice data_var = data;
21001         int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
21002         (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
21003         jboolean resume_read_conv = resume_read;
21004         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21005         CHECK(obj != NULL);
21006         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read_conv);
21007         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21008                 (*env)->ExceptionDescribe(env);
21009                 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
21010         }
21011         if (get_jenv_res == JNI_EDETACHED) {
21012                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21013         }
21014         return ret;
21015 }
21016 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
21017         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
21018         JNIEnv *env;
21019         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21020         if (get_jenv_res == JNI_EDETACHED) {
21021                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21022         } else {
21023                 DO_ASSERT(get_jenv_res == JNI_OK);
21024         }
21025         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21026         CHECK(obj != NULL);
21027         (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
21028         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21029                 (*env)->ExceptionDescribe(env);
21030                 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
21031         }
21032         if (get_jenv_res == JNI_EDETACHED) {
21033                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21034         }
21035 }
21036 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
21037         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
21038         JNIEnv *env;
21039         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21040         if (get_jenv_res == JNI_EDETACHED) {
21041                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21042         } else {
21043                 DO_ASSERT(get_jenv_res == JNI_OK);
21044         }
21045         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
21046         *other_arg_clone = SocketDescriptor_clone(other_arg);
21047         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21048         CHECK(obj != NULL);
21049         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, tag_ptr(other_arg_clone, true));
21050         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21051                 (*env)->ExceptionDescribe(env);
21052                 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
21053         }
21054         if (get_jenv_res == JNI_EDETACHED) {
21055                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21056         }
21057         return ret;
21058 }
21059 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
21060         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
21061         JNIEnv *env;
21062         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21063         if (get_jenv_res == JNI_EDETACHED) {
21064                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21065         } else {
21066                 DO_ASSERT(get_jenv_res == JNI_OK);
21067         }
21068         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21069         CHECK(obj != NULL);
21070         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
21071         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21072                 (*env)->ExceptionDescribe(env);
21073                 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
21074         }
21075         if (get_jenv_res == JNI_EDETACHED) {
21076                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21077         }
21078         return ret;
21079 }
21080 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
21081         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
21082         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
21083 }
21084 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
21085         jclass c = (*env)->GetObjectClass(env, o);
21086         CHECK(c != NULL);
21087         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
21088         atomic_init(&calls->refcnt, 1);
21089         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
21090         calls->o = (*env)->NewWeakGlobalRef(env, o);
21091         calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
21092         CHECK(calls->send_data_meth != NULL);
21093         calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
21094         CHECK(calls->disconnect_socket_meth != NULL);
21095         calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
21096         CHECK(calls->eq_meth != NULL);
21097         calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
21098         CHECK(calls->hash_meth != NULL);
21099
21100         LDKSocketDescriptor ret = {
21101                 .this_arg = (void*) calls,
21102                 .send_data = send_data_LDKSocketDescriptor_jcall,
21103                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
21104                 .eq = eq_LDKSocketDescriptor_jcall,
21105                 .hash = hash_LDKSocketDescriptor_jcall,
21106                 .cloned = LDKSocketDescriptor_JCalls_cloned,
21107                 .free = LDKSocketDescriptor_JCalls_free,
21108         };
21109         return ret;
21110 }
21111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
21112         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
21113         *res_ptr = LDKSocketDescriptor_init(env, clz, o);
21114         return tag_ptr(res_ptr, true);
21115 }
21116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray data, jboolean resume_read) {
21117         void* this_arg_ptr = untag_ptr(this_arg);
21118         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21119         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
21120         LDKu8slice data_ref;
21121         data_ref.datalen = (*env)->GetArrayLength(env, data);
21122         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
21123         int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
21124         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
21125         return ret_conv;
21126 }
21127
21128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
21129         void* this_arg_ptr = untag_ptr(this_arg);
21130         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21131         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
21132         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
21133 }
21134
21135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
21136         void* this_arg_ptr = untag_ptr(this_arg);
21137         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21138         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
21139         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
21140         return ret_conv;
21141 }
21142
21143 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
21144 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
21145 static jclass LDKEffectiveCapacity_AdvertisedMaxHTLC_class = NULL;
21146 static jmethodID LDKEffectiveCapacity_AdvertisedMaxHTLC_meth = NULL;
21147 static jclass LDKEffectiveCapacity_Total_class = NULL;
21148 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
21149 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
21150 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
21151 static jclass LDKEffectiveCapacity_HintMaxHTLC_class = NULL;
21152 static jmethodID LDKEffectiveCapacity_HintMaxHTLC_meth = NULL;
21153 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
21154 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
21155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
21156         LDKEffectiveCapacity_ExactLiquidity_class =
21157                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
21158         CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
21159         LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
21160         CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
21161         LDKEffectiveCapacity_AdvertisedMaxHTLC_class =
21162                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$AdvertisedMaxHTLC"));
21163         CHECK(LDKEffectiveCapacity_AdvertisedMaxHTLC_class != NULL);
21164         LDKEffectiveCapacity_AdvertisedMaxHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_AdvertisedMaxHTLC_class, "<init>", "(J)V");
21165         CHECK(LDKEffectiveCapacity_AdvertisedMaxHTLC_meth != NULL);
21166         LDKEffectiveCapacity_Total_class =
21167                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
21168         CHECK(LDKEffectiveCapacity_Total_class != NULL);
21169         LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(JJ)V");
21170         CHECK(LDKEffectiveCapacity_Total_meth != NULL);
21171         LDKEffectiveCapacity_Infinite_class =
21172                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
21173         CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
21174         LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
21175         CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
21176         LDKEffectiveCapacity_HintMaxHTLC_class =
21177                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$HintMaxHTLC"));
21178         CHECK(LDKEffectiveCapacity_HintMaxHTLC_class != NULL);
21179         LDKEffectiveCapacity_HintMaxHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_HintMaxHTLC_class, "<init>", "(J)V");
21180         CHECK(LDKEffectiveCapacity_HintMaxHTLC_meth != NULL);
21181         LDKEffectiveCapacity_Unknown_class =
21182                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
21183         CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
21184         LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
21185         CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
21186 }
21187 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
21188         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
21189         switch(obj->tag) {
21190                 case LDKEffectiveCapacity_ExactLiquidity: {
21191                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
21192                         return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, liquidity_msat_conv);
21193                 }
21194                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: {
21195                         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
21196                         return (*env)->NewObject(env, LDKEffectiveCapacity_AdvertisedMaxHTLC_class, LDKEffectiveCapacity_AdvertisedMaxHTLC_meth, amount_msat_conv);
21197                 }
21198                 case LDKEffectiveCapacity_Total: {
21199                         int64_t capacity_msat_conv = obj->total.capacity_msat;
21200                         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
21201                         return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, capacity_msat_conv, htlc_maximum_msat_conv);
21202                 }
21203                 case LDKEffectiveCapacity_Infinite: {
21204                         return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
21205                 }
21206                 case LDKEffectiveCapacity_HintMaxHTLC: {
21207                         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
21208                         return (*env)->NewObject(env, LDKEffectiveCapacity_HintMaxHTLC_class, LDKEffectiveCapacity_HintMaxHTLC_meth, amount_msat_conv);
21209                 }
21210                 case LDKEffectiveCapacity_Unknown: {
21211                         return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
21212                 }
21213                 default: abort();
21214         }
21215 }
21216 static jclass LDKPayee_Blinded_class = NULL;
21217 static jmethodID LDKPayee_Blinded_meth = NULL;
21218 static jclass LDKPayee_Clear_class = NULL;
21219 static jmethodID LDKPayee_Clear_meth = NULL;
21220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPayee_init (JNIEnv *env, jclass clz) {
21221         LDKPayee_Blinded_class =
21222                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPayee$Blinded"));
21223         CHECK(LDKPayee_Blinded_class != NULL);
21224         LDKPayee_Blinded_meth = (*env)->GetMethodID(env, LDKPayee_Blinded_class, "<init>", "([JJ)V");
21225         CHECK(LDKPayee_Blinded_meth != NULL);
21226         LDKPayee_Clear_class =
21227                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPayee$Clear"));
21228         CHECK(LDKPayee_Clear_class != NULL);
21229         LDKPayee_Clear_meth = (*env)->GetMethodID(env, LDKPayee_Clear_class, "<init>", "([B[JJI)V");
21230         CHECK(LDKPayee_Clear_meth != NULL);
21231 }
21232 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPayee_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
21233         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
21234         switch(obj->tag) {
21235                 case LDKPayee_Blinded: {
21236                         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
21237                         int64_tArray route_hints_arr = NULL;
21238                         route_hints_arr = (*env)->NewLongArray(env, route_hints_var.datalen);
21239                         int64_t *route_hints_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, route_hints_arr, NULL);
21240                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
21241                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
21242                                 *route_hints_conv_37_conv = route_hints_var.data[l];
21243                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
21244                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
21245                         }
21246                         (*env)->ReleasePrimitiveArrayCritical(env, route_hints_arr, route_hints_arr_ptr, 0);
21247                         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
21248                         int64_t features_ref = 0;
21249                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
21250                         features_ref = tag_ptr(features_var.inner, false);
21251                         return (*env)->NewObject(env, LDKPayee_Blinded_class, LDKPayee_Blinded_meth, route_hints_arr, features_ref);
21252                 }
21253                 case LDKPayee_Clear: {
21254                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
21255                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->clear.node_id.compressed_form);
21256                         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
21257                         int64_tArray route_hints_arr = NULL;
21258                         route_hints_arr = (*env)->NewLongArray(env, route_hints_var.datalen);
21259                         int64_t *route_hints_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, route_hints_arr, NULL);
21260                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
21261                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
21262                                 int64_t route_hints_conv_11_ref = 0;
21263                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
21264                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
21265                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
21266                         }
21267                         (*env)->ReleasePrimitiveArrayCritical(env, route_hints_arr, route_hints_arr_ptr, 0);
21268                         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
21269                         int64_t features_ref = 0;
21270                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
21271                         features_ref = tag_ptr(features_var.inner, false);
21272                         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
21273                         return (*env)->NewObject(env, LDKPayee_Clear_class, LDKPayee_Clear_meth, node_id_arr, route_hints_arr, features_ref, final_cltv_expiry_delta_conv);
21274                 }
21275                 default: abort();
21276         }
21277 }
21278 typedef struct LDKScore_JCalls {
21279         atomic_size_t refcnt;
21280         JavaVM *vm;
21281         jweak o;
21282         LDKScoreLookUp_JCalls* ScoreLookUp;
21283         LDKScoreUpdate_JCalls* ScoreUpdate;
21284         jmethodID write_meth;
21285 } LDKScore_JCalls;
21286 static void LDKScore_JCalls_free(void* this_arg) {
21287         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
21288         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
21289                 JNIEnv *env;
21290                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21291                 if (get_jenv_res == JNI_EDETACHED) {
21292                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21293                 } else {
21294                         DO_ASSERT(get_jenv_res == JNI_OK);
21295                 }
21296                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
21297                 if (get_jenv_res == JNI_EDETACHED) {
21298                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21299                 }
21300                 FREE(j_calls);
21301         }
21302 }
21303 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
21304         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
21305         JNIEnv *env;
21306         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21307         if (get_jenv_res == JNI_EDETACHED) {
21308                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21309         } else {
21310                 DO_ASSERT(get_jenv_res == JNI_OK);
21311         }
21312         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21313         CHECK(obj != NULL);
21314         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
21315         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21316                 (*env)->ExceptionDescribe(env);
21317                 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
21318         }
21319         LDKCVec_u8Z ret_ref;
21320         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
21321         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
21322         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
21323         if (get_jenv_res == JNI_EDETACHED) {
21324                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21325         }
21326         return ret_ref;
21327 }
21328 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
21329         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
21330         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
21331         atomic_fetch_add_explicit(&j_calls->ScoreLookUp->refcnt, 1, memory_order_release);
21332         atomic_fetch_add_explicit(&j_calls->ScoreUpdate->refcnt, 1, memory_order_release);
21333 }
21334 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o, jobject ScoreLookUp, jobject ScoreUpdate) {
21335         jclass c = (*env)->GetObjectClass(env, o);
21336         CHECK(c != NULL);
21337         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
21338         atomic_init(&calls->refcnt, 1);
21339         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
21340         calls->o = (*env)->NewWeakGlobalRef(env, o);
21341         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
21342         CHECK(calls->write_meth != NULL);
21343
21344         LDKScore ret = {
21345                 .this_arg = (void*) calls,
21346                 .write = write_LDKScore_jcall,
21347                 .free = LDKScore_JCalls_free,
21348                 .ScoreLookUp = LDKScoreLookUp_init(env, clz, ScoreLookUp),
21349                 .ScoreUpdate = LDKScoreUpdate_init(env, clz, ScoreUpdate),
21350         };
21351         calls->ScoreLookUp = ret.ScoreLookUp.this_arg;
21352         calls->ScoreUpdate = ret.ScoreUpdate.this_arg;
21353         return ret;
21354 }
21355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o, jobject ScoreLookUp, jobject ScoreUpdate) {
21356         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
21357         *res_ptr = LDKScore_init(env, clz, o, ScoreLookUp, ScoreUpdate);
21358         return tag_ptr(res_ptr, true);
21359 }
21360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1get_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t arg) {
21361         LDKScore *inp = (LDKScore *)untag_ptr(arg);
21362         return tag_ptr(&inp->ScoreLookUp, false);
21363 }
21364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1get_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t arg) {
21365         LDKScore *inp = (LDKScore *)untag_ptr(arg);
21366         return tag_ptr(&inp->ScoreUpdate, false);
21367 }
21368 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
21369         void* this_arg_ptr = untag_ptr(this_arg);
21370         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21371         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
21372         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
21373         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21374         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21375         CVec_u8Z_free(ret_var);
21376         return ret_arr;
21377 }
21378
21379 typedef struct LDKCoinSelectionSource_JCalls {
21380         atomic_size_t refcnt;
21381         JavaVM *vm;
21382         jweak o;
21383         jmethodID select_confirmed_utxos_meth;
21384         jmethodID sign_psbt_meth;
21385 } LDKCoinSelectionSource_JCalls;
21386 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
21387         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
21388         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
21389                 JNIEnv *env;
21390                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21391                 if (get_jenv_res == JNI_EDETACHED) {
21392                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21393                 } else {
21394                         DO_ASSERT(get_jenv_res == JNI_OK);
21395                 }
21396                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
21397                 if (get_jenv_res == JNI_EDETACHED) {
21398                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21399                 }
21400                 FREE(j_calls);
21401         }
21402 }
21403 LDKCResult_CoinSelectionNoneZ select_confirmed_utxos_LDKCoinSelectionSource_jcall(const void* this_arg, LDKThirtyTwoBytes claim_id, LDKCVec_InputZ must_spend, LDKCVec_TxOutZ must_pay_to, uint32_t target_feerate_sat_per_1000_weight) {
21404         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
21405         JNIEnv *env;
21406         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21407         if (get_jenv_res == JNI_EDETACHED) {
21408                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21409         } else {
21410                 DO_ASSERT(get_jenv_res == JNI_OK);
21411         }
21412         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
21413         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, claim_id.data);
21414         LDKCVec_InputZ must_spend_var = must_spend;
21415         int64_tArray must_spend_arr = NULL;
21416         must_spend_arr = (*env)->NewLongArray(env, must_spend_var.datalen);
21417         int64_t *must_spend_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, must_spend_arr, NULL);
21418         for (size_t h = 0; h < must_spend_var.datalen; h++) {
21419                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
21420                 int64_t must_spend_conv_7_ref = 0;
21421                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
21422                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
21423                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
21424         }
21425         (*env)->ReleasePrimitiveArrayCritical(env, must_spend_arr, must_spend_arr_ptr, 0);
21426         FREE(must_spend_var.data);
21427         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
21428         int64_tArray must_pay_to_arr = NULL;
21429         must_pay_to_arr = (*env)->NewLongArray(env, must_pay_to_var.datalen);
21430         int64_t *must_pay_to_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, must_pay_to_arr, NULL);
21431         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
21432                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
21433                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
21434                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
21435         }
21436         (*env)->ReleasePrimitiveArrayCritical(env, must_pay_to_arr, must_pay_to_arr_ptr, 0);
21437         FREE(must_pay_to_var.data);
21438         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
21439         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21440         CHECK(obj != NULL);
21441         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->select_confirmed_utxos_meth, claim_id_arr, must_spend_arr, must_pay_to_arr, target_feerate_sat_per_1000_weight_conv);
21442         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21443                 (*env)->ExceptionDescribe(env);
21444                 (*env)->FatalError(env, "A call to select_confirmed_utxos in LDKCoinSelectionSource from rust threw an exception.");
21445         }
21446         void* ret_ptr = untag_ptr(ret);
21447         CHECK_ACCESS(ret_ptr);
21448         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
21449         FREE(untag_ptr(ret));
21450         if (get_jenv_res == JNI_EDETACHED) {
21451                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21452         }
21453         return ret_conv;
21454 }
21455 LDKCResult_TransactionNoneZ sign_psbt_LDKCoinSelectionSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
21456         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
21457         JNIEnv *env;
21458         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21459         if (get_jenv_res == JNI_EDETACHED) {
21460                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21461         } else {
21462                 DO_ASSERT(get_jenv_res == JNI_OK);
21463         }
21464         LDKCVec_u8Z psbt_var = psbt;
21465         int8_tArray psbt_arr = (*env)->NewByteArray(env, psbt_var.datalen);
21466         (*env)->SetByteArrayRegion(env, psbt_arr, 0, psbt_var.datalen, psbt_var.data);
21467         CVec_u8Z_free(psbt_var);
21468         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21469         CHECK(obj != NULL);
21470         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_psbt_meth, psbt_arr);
21471         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21472                 (*env)->ExceptionDescribe(env);
21473                 (*env)->FatalError(env, "A call to sign_psbt in LDKCoinSelectionSource from rust threw an exception.");
21474         }
21475         void* ret_ptr = untag_ptr(ret);
21476         CHECK_ACCESS(ret_ptr);
21477         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
21478         FREE(untag_ptr(ret));
21479         if (get_jenv_res == JNI_EDETACHED) {
21480                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21481         }
21482         return ret_conv;
21483 }
21484 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
21485         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
21486         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
21487 }
21488 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (JNIEnv *env, jclass clz, jobject o) {
21489         jclass c = (*env)->GetObjectClass(env, o);
21490         CHECK(c != NULL);
21491         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
21492         atomic_init(&calls->refcnt, 1);
21493         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
21494         calls->o = (*env)->NewWeakGlobalRef(env, o);
21495         calls->select_confirmed_utxos_meth = (*env)->GetMethodID(env, c, "select_confirmed_utxos", "([B[J[JI)J");
21496         CHECK(calls->select_confirmed_utxos_meth != NULL);
21497         calls->sign_psbt_meth = (*env)->GetMethodID(env, c, "sign_psbt", "([B)J");
21498         CHECK(calls->sign_psbt_meth != NULL);
21499
21500         LDKCoinSelectionSource ret = {
21501                 .this_arg = (void*) calls,
21502                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
21503                 .sign_psbt = sign_psbt_LDKCoinSelectionSource_jcall,
21504                 .free = LDKCoinSelectionSource_JCalls_free,
21505         };
21506         return ret;
21507 }
21508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCoinSelectionSource_1new(JNIEnv *env, jclass clz, jobject o) {
21509         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
21510         *res_ptr = LDKCoinSelectionSource_init(env, clz, o);
21511         return tag_ptr(res_ptr, true);
21512 }
21513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1select_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray claim_id, int64_tArray must_spend, int64_tArray must_pay_to, int32_t target_feerate_sat_per_1000_weight) {
21514         void* this_arg_ptr = untag_ptr(this_arg);
21515         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21516         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
21517         LDKThirtyTwoBytes claim_id_ref;
21518         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
21519         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
21520         LDKCVec_InputZ must_spend_constr;
21521         must_spend_constr.datalen = (*env)->GetArrayLength(env, must_spend);
21522         if (must_spend_constr.datalen > 0)
21523                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
21524         else
21525                 must_spend_constr.data = NULL;
21526         int64_t* must_spend_vals = (*env)->GetLongArrayElements (env, must_spend, NULL);
21527         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
21528                 int64_t must_spend_conv_7 = must_spend_vals[h];
21529                 LDKInput must_spend_conv_7_conv;
21530                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
21531                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
21532                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
21533                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
21534                 must_spend_constr.data[h] = must_spend_conv_7_conv;
21535         }
21536         (*env)->ReleaseLongArrayElements(env, must_spend, must_spend_vals, 0);
21537         LDKCVec_TxOutZ must_pay_to_constr;
21538         must_pay_to_constr.datalen = (*env)->GetArrayLength(env, must_pay_to);
21539         if (must_pay_to_constr.datalen > 0)
21540                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
21541         else
21542                 must_pay_to_constr.data = NULL;
21543         int64_t* must_pay_to_vals = (*env)->GetLongArrayElements (env, must_pay_to, NULL);
21544         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
21545                 int64_t must_pay_to_conv_7 = must_pay_to_vals[h];
21546                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
21547                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
21548                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
21549                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
21550                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
21551         }
21552         (*env)->ReleaseLongArrayElements(env, must_pay_to, must_pay_to_vals, 0);
21553         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
21554         *ret_conv = (this_arg_conv->select_confirmed_utxos)(this_arg_conv->this_arg, claim_id_ref, must_spend_constr, must_pay_to_constr, target_feerate_sat_per_1000_weight);
21555         return tag_ptr(ret_conv, true);
21556 }
21557
21558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1sign_1psbt(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray psbt) {
21559         void* this_arg_ptr = untag_ptr(this_arg);
21560         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21561         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
21562         LDKCVec_u8Z psbt_ref;
21563         psbt_ref.datalen = (*env)->GetArrayLength(env, psbt);
21564         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
21565         (*env)->GetByteArrayRegion(env, psbt, 0, psbt_ref.datalen, psbt_ref.data);
21566         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
21567         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
21568         return tag_ptr(ret_conv, true);
21569 }
21570
21571 typedef struct LDKWalletSource_JCalls {
21572         atomic_size_t refcnt;
21573         JavaVM *vm;
21574         jweak o;
21575         jmethodID list_confirmed_utxos_meth;
21576         jmethodID get_change_script_meth;
21577         jmethodID sign_psbt_meth;
21578 } LDKWalletSource_JCalls;
21579 static void LDKWalletSource_JCalls_free(void* this_arg) {
21580         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
21581         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
21582                 JNIEnv *env;
21583                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21584                 if (get_jenv_res == JNI_EDETACHED) {
21585                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21586                 } else {
21587                         DO_ASSERT(get_jenv_res == JNI_OK);
21588                 }
21589                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
21590                 if (get_jenv_res == JNI_EDETACHED) {
21591                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21592                 }
21593                 FREE(j_calls);
21594         }
21595 }
21596 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
21597         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
21598         JNIEnv *env;
21599         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21600         if (get_jenv_res == JNI_EDETACHED) {
21601                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21602         } else {
21603                 DO_ASSERT(get_jenv_res == JNI_OK);
21604         }
21605         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21606         CHECK(obj != NULL);
21607         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->list_confirmed_utxos_meth);
21608         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21609                 (*env)->ExceptionDescribe(env);
21610                 (*env)->FatalError(env, "A call to list_confirmed_utxos in LDKWalletSource from rust threw an exception.");
21611         }
21612         void* ret_ptr = untag_ptr(ret);
21613         CHECK_ACCESS(ret_ptr);
21614         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
21615         FREE(untag_ptr(ret));
21616         if (get_jenv_res == JNI_EDETACHED) {
21617                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21618         }
21619         return ret_conv;
21620 }
21621 LDKCResult_CVec_u8ZNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
21622         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
21623         JNIEnv *env;
21624         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21625         if (get_jenv_res == JNI_EDETACHED) {
21626                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21627         } else {
21628                 DO_ASSERT(get_jenv_res == JNI_OK);
21629         }
21630         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21631         CHECK(obj != NULL);
21632         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_change_script_meth);
21633         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21634                 (*env)->ExceptionDescribe(env);
21635                 (*env)->FatalError(env, "A call to get_change_script in LDKWalletSource from rust threw an exception.");
21636         }
21637         void* ret_ptr = untag_ptr(ret);
21638         CHECK_ACCESS(ret_ptr);
21639         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
21640         FREE(untag_ptr(ret));
21641         if (get_jenv_res == JNI_EDETACHED) {
21642                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21643         }
21644         return ret_conv;
21645 }
21646 LDKCResult_TransactionNoneZ sign_psbt_LDKWalletSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
21647         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
21648         JNIEnv *env;
21649         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21650         if (get_jenv_res == JNI_EDETACHED) {
21651                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21652         } else {
21653                 DO_ASSERT(get_jenv_res == JNI_OK);
21654         }
21655         LDKCVec_u8Z psbt_var = psbt;
21656         int8_tArray psbt_arr = (*env)->NewByteArray(env, psbt_var.datalen);
21657         (*env)->SetByteArrayRegion(env, psbt_arr, 0, psbt_var.datalen, psbt_var.data);
21658         CVec_u8Z_free(psbt_var);
21659         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21660         CHECK(obj != NULL);
21661         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_psbt_meth, psbt_arr);
21662         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21663                 (*env)->ExceptionDescribe(env);
21664                 (*env)->FatalError(env, "A call to sign_psbt in LDKWalletSource from rust threw an exception.");
21665         }
21666         void* ret_ptr = untag_ptr(ret);
21667         CHECK_ACCESS(ret_ptr);
21668         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
21669         FREE(untag_ptr(ret));
21670         if (get_jenv_res == JNI_EDETACHED) {
21671                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21672         }
21673         return ret_conv;
21674 }
21675 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
21676         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
21677         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
21678 }
21679 static inline LDKWalletSource LDKWalletSource_init (JNIEnv *env, jclass clz, jobject o) {
21680         jclass c = (*env)->GetObjectClass(env, o);
21681         CHECK(c != NULL);
21682         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
21683         atomic_init(&calls->refcnt, 1);
21684         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
21685         calls->o = (*env)->NewWeakGlobalRef(env, o);
21686         calls->list_confirmed_utxos_meth = (*env)->GetMethodID(env, c, "list_confirmed_utxos", "()J");
21687         CHECK(calls->list_confirmed_utxos_meth != NULL);
21688         calls->get_change_script_meth = (*env)->GetMethodID(env, c, "get_change_script", "()J");
21689         CHECK(calls->get_change_script_meth != NULL);
21690         calls->sign_psbt_meth = (*env)->GetMethodID(env, c, "sign_psbt", "([B)J");
21691         CHECK(calls->sign_psbt_meth != NULL);
21692
21693         LDKWalletSource ret = {
21694                 .this_arg = (void*) calls,
21695                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
21696                 .get_change_script = get_change_script_LDKWalletSource_jcall,
21697                 .sign_psbt = sign_psbt_LDKWalletSource_jcall,
21698                 .free = LDKWalletSource_JCalls_free,
21699         };
21700         return ret;
21701 }
21702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWalletSource_1new(JNIEnv *env, jclass clz, jobject o) {
21703         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
21704         *res_ptr = LDKWalletSource_init(env, clz, o);
21705         return tag_ptr(res_ptr, true);
21706 }
21707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1list_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_arg) {
21708         void* this_arg_ptr = untag_ptr(this_arg);
21709         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21710         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
21711         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
21712         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
21713         return tag_ptr(ret_conv, true);
21714 }
21715
21716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1get_1change_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
21717         void* this_arg_ptr = untag_ptr(this_arg);
21718         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21719         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
21720         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
21721         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
21722         return tag_ptr(ret_conv, true);
21723 }
21724
21725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1sign_1psbt(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray psbt) {
21726         void* this_arg_ptr = untag_ptr(this_arg);
21727         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21728         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
21729         LDKCVec_u8Z psbt_ref;
21730         psbt_ref.datalen = (*env)->GetArrayLength(env, psbt);
21731         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
21732         (*env)->GetByteArrayRegion(env, psbt, 0, psbt_ref.datalen, psbt_ref.data);
21733         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
21734         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
21735         return tag_ptr(ret_conv, true);
21736 }
21737
21738 static jclass LDKGossipSync_P2P_class = NULL;
21739 static jmethodID LDKGossipSync_P2P_meth = NULL;
21740 static jclass LDKGossipSync_Rapid_class = NULL;
21741 static jmethodID LDKGossipSync_Rapid_meth = NULL;
21742 static jclass LDKGossipSync_None_class = NULL;
21743 static jmethodID LDKGossipSync_None_meth = NULL;
21744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGossipSync_init (JNIEnv *env, jclass clz) {
21745         LDKGossipSync_P2P_class =
21746                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$P2P"));
21747         CHECK(LDKGossipSync_P2P_class != NULL);
21748         LDKGossipSync_P2P_meth = (*env)->GetMethodID(env, LDKGossipSync_P2P_class, "<init>", "(J)V");
21749         CHECK(LDKGossipSync_P2P_meth != NULL);
21750         LDKGossipSync_Rapid_class =
21751                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$Rapid"));
21752         CHECK(LDKGossipSync_Rapid_class != NULL);
21753         LDKGossipSync_Rapid_meth = (*env)->GetMethodID(env, LDKGossipSync_Rapid_class, "<init>", "(J)V");
21754         CHECK(LDKGossipSync_Rapid_meth != NULL);
21755         LDKGossipSync_None_class =
21756                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$None"));
21757         CHECK(LDKGossipSync_None_class != NULL);
21758         LDKGossipSync_None_meth = (*env)->GetMethodID(env, LDKGossipSync_None_class, "<init>", "()V");
21759         CHECK(LDKGossipSync_None_meth != NULL);
21760 }
21761 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGossipSync_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
21762         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
21763         switch(obj->tag) {
21764                 case LDKGossipSync_P2P: {
21765                         LDKP2PGossipSync p2p_var = obj->p2p;
21766                         int64_t p2p_ref = 0;
21767                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
21768                         p2p_ref = tag_ptr(p2p_var.inner, false);
21769                         return (*env)->NewObject(env, LDKGossipSync_P2P_class, LDKGossipSync_P2P_meth, p2p_ref);
21770                 }
21771                 case LDKGossipSync_Rapid: {
21772                         LDKRapidGossipSync rapid_var = obj->rapid;
21773                         int64_t rapid_ref = 0;
21774                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
21775                         rapid_ref = tag_ptr(rapid_var.inner, false);
21776                         return (*env)->NewObject(env, LDKGossipSync_Rapid_class, LDKGossipSync_Rapid_meth, rapid_ref);
21777                 }
21778                 case LDKGossipSync_None: {
21779                         return (*env)->NewObject(env, LDKGossipSync_None_class, LDKGossipSync_None_meth);
21780                 }
21781                 default: abort();
21782         }
21783 }
21784 static jclass LDKFallback_SegWitProgram_class = NULL;
21785 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
21786 static jclass LDKFallback_PubKeyHash_class = NULL;
21787 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
21788 static jclass LDKFallback_ScriptHash_class = NULL;
21789 static jmethodID LDKFallback_ScriptHash_meth = NULL;
21790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
21791         LDKFallback_SegWitProgram_class =
21792                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
21793         CHECK(LDKFallback_SegWitProgram_class != NULL);
21794         LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
21795         CHECK(LDKFallback_SegWitProgram_meth != NULL);
21796         LDKFallback_PubKeyHash_class =
21797                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
21798         CHECK(LDKFallback_PubKeyHash_class != NULL);
21799         LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
21800         CHECK(LDKFallback_PubKeyHash_meth != NULL);
21801         LDKFallback_ScriptHash_class =
21802                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
21803         CHECK(LDKFallback_ScriptHash_class != NULL);
21804         LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
21805         CHECK(LDKFallback_ScriptHash_meth != NULL);
21806 }
21807 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
21808         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
21809         switch(obj->tag) {
21810                 case LDKFallback_SegWitProgram: {
21811                         uint8_t version_val = obj->seg_wit_program.version._0;
21812                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
21813                         int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
21814                         (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
21815                         return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
21816                 }
21817                 case LDKFallback_PubKeyHash: {
21818                         int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
21819                         (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
21820                         return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
21821                 }
21822                 case LDKFallback_ScriptHash: {
21823                         int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
21824                         (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
21825                         return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
21826                 }
21827                 default: abort();
21828         }
21829 }
21830 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
21831         LDKStr ret_str = _ldk_get_compiled_version();
21832         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
21833         Str_free(ret_str);
21834         return ret_conv;
21835 }
21836
21837 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
21838         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
21839         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
21840         Str_free(ret_str);
21841         return ret_conv;
21842 }
21843
21844 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1le_1bytes(JNIEnv *env, jclass clz, int8_tArray val) {
21845         LDKU128 val_ref;
21846         CHECK((*env)->GetArrayLength(env, val) == 16);
21847         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
21848         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
21849         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_le_bytes(val_ref).data);
21850         return ret_arr;
21851 }
21852
21853 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1new(JNIEnv *env, jclass clz, int8_tArray le_bytes) {
21854         LDKSixteenBytes le_bytes_ref;
21855         CHECK((*env)->GetArrayLength(env, le_bytes) == 16);
21856         (*env)->GetByteArrayRegion(env, le_bytes, 0, 16, le_bytes_ref.data);
21857         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
21858         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_new(le_bytes_ref).le_bytes);
21859         return ret_arr;
21860 }
21861
21862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1new(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
21863         
21864         LDKCVec_u8Z program_ref;
21865         program_ref.datalen = (*env)->GetArrayLength(env, program);
21866         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
21867         (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
21868         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
21869         *ret_ref = WitnessProgram_new((LDKWitnessVersion){ ._0 = version }, program_ref);
21870         return tag_ptr(ret_ref, true);
21871 }
21872
21873 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1get_1version(JNIEnv *env, jclass clz, int64_t prog) {
21874         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
21875         uint8_t ret_val = WitnessProgram_get_version(prog_conv)._0;
21876         return ret_val;
21877 }
21878
21879 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1get_1program(JNIEnv *env, jclass clz, int64_t prog) {
21880         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
21881         LDKu8slice ret_var = WitnessProgram_get_program(prog_conv);
21882         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21883         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21884         return ret_arr;
21885 }
21886
21887 static inline uint64_t WitnessProgram_clone_ptr(LDKWitnessProgram *NONNULL_PTR arg) {
21888         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
21889         *ret_ref = WitnessProgram_clone(arg);
21890         return tag_ptr(ret_ref, true);
21891 }
21892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21893         LDKWitnessProgram* arg_conv = (LDKWitnessProgram*)untag_ptr(arg);
21894         int64_t ret_conv = WitnessProgram_clone_ptr(arg_conv);
21895         return ret_conv;
21896 }
21897
21898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21899         LDKWitnessProgram* orig_conv = (LDKWitnessProgram*)untag_ptr(orig);
21900         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
21901         *ret_ref = WitnessProgram_clone(orig_conv);
21902         return tag_ptr(ret_ref, true);
21903 }
21904
21905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1free(JNIEnv *env, jclass clz, int64_t o) {
21906         if (!ptr_is_owned(o)) return;
21907         void* o_ptr = untag_ptr(o);
21908         CHECK_ACCESS(o_ptr);
21909         LDKWitnessProgram o_conv = *(LDKWitnessProgram*)(o_ptr);
21910         FREE(untag_ptr(o));
21911         WitnessProgram_free(o_conv);
21912 }
21913
21914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1new(JNIEnv *env, jclass clz, int8_tArray big_endian_bytes) {
21915         LDKThirtyTwoBytes big_endian_bytes_ref;
21916         CHECK((*env)->GetArrayLength(env, big_endian_bytes) == 32);
21917         (*env)->GetByteArrayRegion(env, big_endian_bytes, 0, 32, big_endian_bytes_ref.data);
21918         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
21919         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
21920         return tag_ptr(ret_ref, true);
21921 }
21922
21923 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
21924         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
21925         *ret_copy = Bech32Error_clone(arg);
21926         int64_t ret_ref = tag_ptr(ret_copy, true);
21927         return ret_ref;
21928 }
21929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21930         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
21931         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
21932         return ret_conv;
21933 }
21934
21935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21936         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
21937         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
21938         *ret_copy = Bech32Error_clone(orig_conv);
21939         int64_t ret_ref = tag_ptr(ret_copy, true);
21940         return ret_ref;
21941 }
21942
21943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) {
21944         if (!ptr_is_owned(o)) return;
21945         void* o_ptr = untag_ptr(o);
21946         CHECK_ACCESS(o_ptr);
21947         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
21948         FREE(untag_ptr(o));
21949         Bech32Error_free(o_conv);
21950 }
21951
21952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
21953         LDKTransaction _res_ref;
21954         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
21955         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
21956         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
21957         _res_ref.data_is_owned = true;
21958         Transaction_free(_res_ref);
21959 }
21960
21961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Witness_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
21962         LDKWitness _res_ref;
21963         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
21964         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
21965         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
21966         _res_ref.data_is_owned = true;
21967         Witness_free(_res_ref);
21968 }
21969
21970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxIn_1new(JNIEnv *env, jclass clz, int8_tArray witness, int8_tArray script_sig, int32_t sequence, int8_tArray previous_txid, int32_t previous_vout) {
21971         LDKWitness witness_ref;
21972         witness_ref.datalen = (*env)->GetArrayLength(env, witness);
21973         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
21974         (*env)->GetByteArrayRegion(env, witness, 0, witness_ref.datalen, witness_ref.data);
21975         witness_ref.data_is_owned = true;
21976         LDKCVec_u8Z script_sig_ref;
21977         script_sig_ref.datalen = (*env)->GetArrayLength(env, script_sig);
21978         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
21979         (*env)->GetByteArrayRegion(env, script_sig, 0, script_sig_ref.datalen, script_sig_ref.data);
21980         LDKThirtyTwoBytes previous_txid_ref;
21981         CHECK((*env)->GetArrayLength(env, previous_txid) == 32);
21982         (*env)->GetByteArrayRegion(env, previous_txid, 0, 32, previous_txid_ref.data);
21983         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
21984         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
21985         return tag_ptr(ret_ref, true);
21986 }
21987
21988 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1witness(JNIEnv *env, jclass clz, int64_t txin) {
21989         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
21990         LDKWitness ret_var = TxIn_get_witness(txin_conv);
21991         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21992         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21993         Witness_free(ret_var);
21994         return ret_arr;
21995 }
21996
21997 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1script_1sig(JNIEnv *env, jclass clz, int64_t txin) {
21998         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
21999         LDKu8slice ret_var = TxIn_get_script_sig(txin_conv);
22000         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22001         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22002         return ret_arr;
22003 }
22004
22005 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1sequence(JNIEnv *env, jclass clz, int64_t txin) {
22006         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
22007         int32_t ret_conv = TxIn_get_sequence(txin_conv);
22008         return ret_conv;
22009 }
22010
22011 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1previous_1txid(JNIEnv *env, jclass clz, int64_t txin) {
22012         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
22013         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22014         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TxIn_get_previous_txid(txin_conv).data);
22015         return ret_arr;
22016 }
22017
22018 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1previous_1vout(JNIEnv *env, jclass clz, int64_t txin) {
22019         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
22020         int32_t ret_conv = TxIn_get_previous_vout(txin_conv);
22021         return ret_conv;
22022 }
22023
22024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxIn_1free(JNIEnv *env, jclass clz, int64_t _res) {
22025         if (!ptr_is_owned(_res)) return;
22026         void* _res_ptr = untag_ptr(_res);
22027         CHECK_ACCESS(_res_ptr);
22028         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
22029         FREE(untag_ptr(_res));
22030         TxIn_free(_res_conv);
22031 }
22032
22033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
22034         LDKCVec_u8Z script_pubkey_ref;
22035         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
22036         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
22037         (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
22038         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
22039         *ret_ref = TxOut_new(script_pubkey_ref, value);
22040         return tag_ptr(ret_ref, true);
22041 }
22042
22043 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t txout) {
22044         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
22045         LDKu8slice ret_var = TxOut_get_script_pubkey(txout_conv);
22046         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22047         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22048         return ret_arr;
22049 }
22050
22051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1value(JNIEnv *env, jclass clz, int64_t txout) {
22052         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
22053         int64_t ret_conv = TxOut_get_value(txout_conv);
22054         return ret_conv;
22055 }
22056
22057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
22058         if (!ptr_is_owned(_res)) return;
22059         void* _res_ptr = untag_ptr(_res);
22060         CHECK_ACCESS(_res_ptr);
22061         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
22062         FREE(untag_ptr(_res));
22063         TxOut_free(_res_conv);
22064 }
22065
22066 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
22067         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
22068         *ret_ref = TxOut_clone(arg);
22069         return tag_ptr(ret_ref, true);
22070 }
22071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22072         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
22073         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
22074         return ret_conv;
22075 }
22076
22077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22078         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
22079         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
22080         *ret_ref = TxOut_clone(orig_conv);
22081         return tag_ptr(ret_ref, true);
22082 }
22083
22084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
22085         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
22086         Str_free(dummy);
22087 }
22088
22089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
22090         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
22091         *ret_copy = COption_u64Z_some(o);
22092         int64_t ret_ref = tag_ptr(ret_copy, true);
22093         return ret_ref;
22094 }
22095
22096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
22097         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
22098         *ret_copy = COption_u64Z_none();
22099         int64_t ret_ref = tag_ptr(ret_copy, true);
22100         return ret_ref;
22101 }
22102
22103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
22104         if (!ptr_is_owned(_res)) return;
22105         void* _res_ptr = untag_ptr(_res);
22106         CHECK_ACCESS(_res_ptr);
22107         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
22108         FREE(untag_ptr(_res));
22109         COption_u64Z_free(_res_conv);
22110 }
22111
22112 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
22113         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
22114         *ret_copy = COption_u64Z_clone(arg);
22115         int64_t ret_ref = tag_ptr(ret_copy, true);
22116         return ret_ref;
22117 }
22118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22119         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
22120         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
22121         return ret_conv;
22122 }
22123
22124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22125         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
22126         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
22127         *ret_copy = COption_u64Z_clone(orig_conv);
22128         int64_t ret_ref = tag_ptr(ret_copy, true);
22129         return ret_ref;
22130 }
22131
22132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BlindedPathZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22133         LDKCVec_BlindedPathZ _res_constr;
22134         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22135         if (_res_constr.datalen > 0)
22136                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
22137         else
22138                 _res_constr.data = NULL;
22139         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22140         for (size_t n = 0; n < _res_constr.datalen; n++) {
22141                 int64_t _res_conv_13 = _res_vals[n];
22142                 LDKBlindedPath _res_conv_13_conv;
22143                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
22144                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
22145                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
22146                 _res_constr.data[n] = _res_conv_13_conv;
22147         }
22148         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22149         CVec_BlindedPathZ_free(_res_constr);
22150 }
22151
22152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22153         LDKRefund o_conv;
22154         o_conv.inner = untag_ptr(o);
22155         o_conv.is_owned = ptr_is_owned(o);
22156         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22157         o_conv = Refund_clone(&o_conv);
22158         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
22159         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
22160         return tag_ptr(ret_conv, true);
22161 }
22162
22163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22164         LDKBolt12ParseError e_conv;
22165         e_conv.inner = untag_ptr(e);
22166         e_conv.is_owned = ptr_is_owned(e);
22167         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22168         e_conv = Bolt12ParseError_clone(&e_conv);
22169         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
22170         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
22171         return tag_ptr(ret_conv, true);
22172 }
22173
22174 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22175         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
22176         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
22177         return ret_conv;
22178 }
22179
22180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22181         if (!ptr_is_owned(_res)) return;
22182         void* _res_ptr = untag_ptr(_res);
22183         CHECK_ACCESS(_res_ptr);
22184         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
22185         FREE(untag_ptr(_res));
22186         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
22187 }
22188
22189 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
22190         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
22191         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
22192         return tag_ptr(ret_conv, true);
22193 }
22194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22195         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
22196         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
22197         return ret_conv;
22198 }
22199
22200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22201         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
22202         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
22203         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
22204         return tag_ptr(ret_conv, true);
22205 }
22206
22207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22208         void* o_ptr = untag_ptr(o);
22209         CHECK_ACCESS(o_ptr);
22210         LDKRetry o_conv = *(LDKRetry*)(o_ptr);
22211         o_conv = Retry_clone((LDKRetry*)untag_ptr(o));
22212         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
22213         *ret_conv = CResult_RetryDecodeErrorZ_ok(o_conv);
22214         return tag_ptr(ret_conv, true);
22215 }
22216
22217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22218         void* e_ptr = untag_ptr(e);
22219         CHECK_ACCESS(e_ptr);
22220         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22221         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22222         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
22223         *ret_conv = CResult_RetryDecodeErrorZ_err(e_conv);
22224         return tag_ptr(ret_conv, true);
22225 }
22226
22227 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22228         LDKCResult_RetryDecodeErrorZ* o_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(o);
22229         jboolean ret_conv = CResult_RetryDecodeErrorZ_is_ok(o_conv);
22230         return ret_conv;
22231 }
22232
22233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22234         if (!ptr_is_owned(_res)) return;
22235         void* _res_ptr = untag_ptr(_res);
22236         CHECK_ACCESS(_res_ptr);
22237         LDKCResult_RetryDecodeErrorZ _res_conv = *(LDKCResult_RetryDecodeErrorZ*)(_res_ptr);
22238         FREE(untag_ptr(_res));
22239         CResult_RetryDecodeErrorZ_free(_res_conv);
22240 }
22241
22242 static inline uint64_t CResult_RetryDecodeErrorZ_clone_ptr(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR arg) {
22243         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
22244         *ret_conv = CResult_RetryDecodeErrorZ_clone(arg);
22245         return tag_ptr(ret_conv, true);
22246 }
22247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22248         LDKCResult_RetryDecodeErrorZ* arg_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(arg);
22249         int64_t ret_conv = CResult_RetryDecodeErrorZ_clone_ptr(arg_conv);
22250         return ret_conv;
22251 }
22252
22253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22254         LDKCResult_RetryDecodeErrorZ* orig_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(orig);
22255         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
22256         *ret_conv = CResult_RetryDecodeErrorZ_clone(orig_conv);
22257         return tag_ptr(ret_conv, true);
22258 }
22259
22260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
22261         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
22262         *ret_conv = CResult_NoneAPIErrorZ_ok();
22263         return tag_ptr(ret_conv, true);
22264 }
22265
22266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22267         void* e_ptr = untag_ptr(e);
22268         CHECK_ACCESS(e_ptr);
22269         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
22270         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
22271         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
22272         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
22273         return tag_ptr(ret_conv, true);
22274 }
22275
22276 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22277         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
22278         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
22279         return ret_conv;
22280 }
22281
22282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22283         if (!ptr_is_owned(_res)) return;
22284         void* _res_ptr = untag_ptr(_res);
22285         CHECK_ACCESS(_res_ptr);
22286         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
22287         FREE(untag_ptr(_res));
22288         CResult_NoneAPIErrorZ_free(_res_conv);
22289 }
22290
22291 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
22292         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
22293         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
22294         return tag_ptr(ret_conv, true);
22295 }
22296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22297         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
22298         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
22299         return ret_conv;
22300 }
22301
22302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22303         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
22304         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
22305         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
22306         return tag_ptr(ret_conv, true);
22307 }
22308
22309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22310         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
22311         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22312         if (_res_constr.datalen > 0)
22313                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
22314         else
22315                 _res_constr.data = NULL;
22316         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22317         for (size_t w = 0; w < _res_constr.datalen; w++) {
22318                 int64_t _res_conv_22 = _res_vals[w];
22319                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
22320                 CHECK_ACCESS(_res_conv_22_ptr);
22321                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
22322                 FREE(untag_ptr(_res_conv_22));
22323                 _res_constr.data[w] = _res_conv_22_conv;
22324         }
22325         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22326         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
22327 }
22328
22329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22330         LDKCVec_APIErrorZ _res_constr;
22331         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22332         if (_res_constr.datalen > 0)
22333                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
22334         else
22335                 _res_constr.data = NULL;
22336         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22337         for (size_t k = 0; k < _res_constr.datalen; k++) {
22338                 int64_t _res_conv_10 = _res_vals[k];
22339                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
22340                 CHECK_ACCESS(_res_conv_10_ptr);
22341                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
22342                 FREE(untag_ptr(_res_conv_10));
22343                 _res_constr.data[k] = _res_conv_10_conv;
22344         }
22345         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22346         CVec_APIErrorZ_free(_res_constr);
22347 }
22348
22349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
22350         LDKThirtyTwoBytes o_ref;
22351         CHECK((*env)->GetArrayLength(env, o) == 32);
22352         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
22353         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
22354         *ret_copy = COption_ThirtyTwoBytesZ_some(o_ref);
22355         int64_t ret_ref = tag_ptr(ret_copy, true);
22356         return ret_ref;
22357 }
22358
22359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1none(JNIEnv *env, jclass clz) {
22360         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
22361         *ret_copy = COption_ThirtyTwoBytesZ_none();
22362         int64_t ret_ref = tag_ptr(ret_copy, true);
22363         return ret_ref;
22364 }
22365
22366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22367         if (!ptr_is_owned(_res)) return;
22368         void* _res_ptr = untag_ptr(_res);
22369         CHECK_ACCESS(_res_ptr);
22370         LDKCOption_ThirtyTwoBytesZ _res_conv = *(LDKCOption_ThirtyTwoBytesZ*)(_res_ptr);
22371         FREE(untag_ptr(_res));
22372         COption_ThirtyTwoBytesZ_free(_res_conv);
22373 }
22374
22375 static inline uint64_t COption_ThirtyTwoBytesZ_clone_ptr(LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR arg) {
22376         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
22377         *ret_copy = COption_ThirtyTwoBytesZ_clone(arg);
22378         int64_t ret_ref = tag_ptr(ret_copy, true);
22379         return ret_ref;
22380 }
22381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22382         LDKCOption_ThirtyTwoBytesZ* arg_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(arg);
22383         int64_t ret_conv = COption_ThirtyTwoBytesZ_clone_ptr(arg_conv);
22384         return ret_conv;
22385 }
22386
22387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22388         LDKCOption_ThirtyTwoBytesZ* orig_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(orig);
22389         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
22390         *ret_copy = COption_ThirtyTwoBytesZ_clone(orig_conv);
22391         int64_t ret_ref = tag_ptr(ret_copy, true);
22392         return ret_ref;
22393 }
22394
22395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
22396         LDKCVec_u8Z _res_ref;
22397         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
22398         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
22399         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
22400         CVec_u8Z_free(_res_ref);
22401 }
22402
22403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
22404         LDKCVec_u8Z o_ref;
22405         o_ref.datalen = (*env)->GetArrayLength(env, o);
22406         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
22407         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
22408         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
22409         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
22410         int64_t ret_ref = tag_ptr(ret_copy, true);
22411         return ret_ref;
22412 }
22413
22414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1none(JNIEnv *env, jclass clz) {
22415         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
22416         *ret_copy = COption_CVec_u8ZZ_none();
22417         int64_t ret_ref = tag_ptr(ret_copy, true);
22418         return ret_ref;
22419 }
22420
22421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22422         if (!ptr_is_owned(_res)) return;
22423         void* _res_ptr = untag_ptr(_res);
22424         CHECK_ACCESS(_res_ptr);
22425         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
22426         FREE(untag_ptr(_res));
22427         COption_CVec_u8ZZ_free(_res_conv);
22428 }
22429
22430 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
22431         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
22432         *ret_copy = COption_CVec_u8ZZ_clone(arg);
22433         int64_t ret_ref = tag_ptr(ret_copy, true);
22434         return ret_ref;
22435 }
22436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22437         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
22438         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
22439         return ret_conv;
22440 }
22441
22442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22443         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
22444         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
22445         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
22446         int64_t ret_ref = tag_ptr(ret_copy, true);
22447         return ret_ref;
22448 }
22449
22450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22451         LDKRecipientOnionFields o_conv;
22452         o_conv.inner = untag_ptr(o);
22453         o_conv.is_owned = ptr_is_owned(o);
22454         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22455         o_conv = RecipientOnionFields_clone(&o_conv);
22456         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
22457         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
22458         return tag_ptr(ret_conv, true);
22459 }
22460
22461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22462         void* e_ptr = untag_ptr(e);
22463         CHECK_ACCESS(e_ptr);
22464         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22465         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22466         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
22467         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
22468         return tag_ptr(ret_conv, true);
22469 }
22470
22471 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22472         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
22473         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
22474         return ret_conv;
22475 }
22476
22477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22478         if (!ptr_is_owned(_res)) return;
22479         void* _res_ptr = untag_ptr(_res);
22480         CHECK_ACCESS(_res_ptr);
22481         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
22482         FREE(untag_ptr(_res));
22483         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
22484 }
22485
22486 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
22487         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
22488         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
22489         return tag_ptr(ret_conv, true);
22490 }
22491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22492         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
22493         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
22494         return ret_conv;
22495 }
22496
22497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22498         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
22499         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
22500         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
22501         return tag_ptr(ret_conv, true);
22502 }
22503
22504 static inline uint64_t C2Tuple_u64CVec_u8ZZ_clone_ptr(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR arg) {
22505         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
22506         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(arg);
22507         return tag_ptr(ret_conv, true);
22508 }
22509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22510         LDKC2Tuple_u64CVec_u8ZZ* arg_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(arg);
22511         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_clone_ptr(arg_conv);
22512         return ret_conv;
22513 }
22514
22515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22516         LDKC2Tuple_u64CVec_u8ZZ* orig_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(orig);
22517         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
22518         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(orig_conv);
22519         return tag_ptr(ret_conv, true);
22520 }
22521
22522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
22523         LDKCVec_u8Z b_ref;
22524         b_ref.datalen = (*env)->GetArrayLength(env, b);
22525         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
22526         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
22527         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
22528         *ret_conv = C2Tuple_u64CVec_u8ZZ_new(a, b_ref);
22529         return tag_ptr(ret_conv, true);
22530 }
22531
22532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22533         if (!ptr_is_owned(_res)) return;
22534         void* _res_ptr = untag_ptr(_res);
22535         CHECK_ACCESS(_res_ptr);
22536         LDKC2Tuple_u64CVec_u8ZZ _res_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_ptr);
22537         FREE(untag_ptr(_res));
22538         C2Tuple_u64CVec_u8ZZ_free(_res_conv);
22539 }
22540
22541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u64CVec_1u8ZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22542         LDKCVec_C2Tuple_u64CVec_u8ZZZ _res_constr;
22543         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22544         if (_res_constr.datalen > 0)
22545                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
22546         else
22547                 _res_constr.data = NULL;
22548         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22549         for (size_t x = 0; x < _res_constr.datalen; x++) {
22550                 int64_t _res_conv_23 = _res_vals[x];
22551                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
22552                 CHECK_ACCESS(_res_conv_23_ptr);
22553                 LDKC2Tuple_u64CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_conv_23_ptr);
22554                 FREE(untag_ptr(_res_conv_23));
22555                 _res_constr.data[x] = _res_conv_23_conv;
22556         }
22557         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22558         CVec_C2Tuple_u64CVec_u8ZZZ_free(_res_constr);
22559 }
22560
22561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22562         LDKRecipientOnionFields o_conv;
22563         o_conv.inner = untag_ptr(o);
22564         o_conv.is_owned = ptr_is_owned(o);
22565         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22566         o_conv = RecipientOnionFields_clone(&o_conv);
22567         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
22568         *ret_conv = CResult_RecipientOnionFieldsNoneZ_ok(o_conv);
22569         return tag_ptr(ret_conv, true);
22570 }
22571
22572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1err(JNIEnv *env, jclass clz) {
22573         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
22574         *ret_conv = CResult_RecipientOnionFieldsNoneZ_err();
22575         return tag_ptr(ret_conv, true);
22576 }
22577
22578 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22579         LDKCResult_RecipientOnionFieldsNoneZ* o_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(o);
22580         jboolean ret_conv = CResult_RecipientOnionFieldsNoneZ_is_ok(o_conv);
22581         return ret_conv;
22582 }
22583
22584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22585         if (!ptr_is_owned(_res)) return;
22586         void* _res_ptr = untag_ptr(_res);
22587         CHECK_ACCESS(_res_ptr);
22588         LDKCResult_RecipientOnionFieldsNoneZ _res_conv = *(LDKCResult_RecipientOnionFieldsNoneZ*)(_res_ptr);
22589         FREE(untag_ptr(_res));
22590         CResult_RecipientOnionFieldsNoneZ_free(_res_conv);
22591 }
22592
22593 static inline uint64_t CResult_RecipientOnionFieldsNoneZ_clone_ptr(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR arg) {
22594         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
22595         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(arg);
22596         return tag_ptr(ret_conv, true);
22597 }
22598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22599         LDKCResult_RecipientOnionFieldsNoneZ* arg_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(arg);
22600         int64_t ret_conv = CResult_RecipientOnionFieldsNoneZ_clone_ptr(arg_conv);
22601         return ret_conv;
22602 }
22603
22604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22605         LDKCResult_RecipientOnionFieldsNoneZ* orig_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(orig);
22606         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
22607         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(orig_conv);
22608         return tag_ptr(ret_conv, true);
22609 }
22610
22611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
22612         LDKCVec_ThirtyTwoBytesZ _res_constr;
22613         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22614         if (_res_constr.datalen > 0)
22615                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
22616         else
22617                 _res_constr.data = NULL;
22618         for (size_t i = 0; i < _res_constr.datalen; i++) {
22619                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
22620                 LDKThirtyTwoBytes _res_conv_8_ref;
22621                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
22622                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
22623                 _res_constr.data[i] = _res_conv_8_ref;
22624         }
22625         CVec_ThirtyTwoBytesZ_free(_res_constr);
22626 }
22627
22628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1some(JNIEnv *env, jclass clz, jobjectArray o) {
22629         LDKCVec_ThirtyTwoBytesZ o_constr;
22630         o_constr.datalen = (*env)->GetArrayLength(env, o);
22631         if (o_constr.datalen > 0)
22632                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
22633         else
22634                 o_constr.data = NULL;
22635         for (size_t i = 0; i < o_constr.datalen; i++) {
22636                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
22637                 LDKThirtyTwoBytes o_conv_8_ref;
22638                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 32);
22639                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 32, o_conv_8_ref.data);
22640                 o_constr.data[i] = o_conv_8_ref;
22641         }
22642         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
22643         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_some(o_constr);
22644         int64_t ret_ref = tag_ptr(ret_copy, true);
22645         return ret_ref;
22646 }
22647
22648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1none(JNIEnv *env, jclass clz) {
22649         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
22650         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_none();
22651         int64_t ret_ref = tag_ptr(ret_copy, true);
22652         return ret_ref;
22653 }
22654
22655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22656         if (!ptr_is_owned(_res)) return;
22657         void* _res_ptr = untag_ptr(_res);
22658         CHECK_ACCESS(_res_ptr);
22659         LDKCOption_CVec_ThirtyTwoBytesZZ _res_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(_res_ptr);
22660         FREE(untag_ptr(_res));
22661         COption_CVec_ThirtyTwoBytesZZ_free(_res_conv);
22662 }
22663
22664 static inline uint64_t COption_CVec_ThirtyTwoBytesZZ_clone_ptr(LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
22665         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
22666         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(arg);
22667         int64_t ret_ref = tag_ptr(ret_copy, true);
22668         return ret_ref;
22669 }
22670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22671         LDKCOption_CVec_ThirtyTwoBytesZZ* arg_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(arg);
22672         int64_t ret_conv = COption_CVec_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
22673         return ret_conv;
22674 }
22675
22676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22677         LDKCOption_CVec_ThirtyTwoBytesZZ* orig_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(orig);
22678         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
22679         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(orig_conv);
22680         int64_t ret_ref = tag_ptr(ret_copy, true);
22681         return ret_ref;
22682 }
22683
22684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
22685         LDKThirtyTwoBytes o_ref;
22686         CHECK((*env)->GetArrayLength(env, o) == 32);
22687         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
22688         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
22689         *ret_conv = CResult_ThirtyTwoBytesNoneZ_ok(o_ref);
22690         return tag_ptr(ret_conv, true);
22691 }
22692
22693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1err(JNIEnv *env, jclass clz) {
22694         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
22695         *ret_conv = CResult_ThirtyTwoBytesNoneZ_err();
22696         return tag_ptr(ret_conv, true);
22697 }
22698
22699 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22700         LDKCResult_ThirtyTwoBytesNoneZ* o_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(o);
22701         jboolean ret_conv = CResult_ThirtyTwoBytesNoneZ_is_ok(o_conv);
22702         return ret_conv;
22703 }
22704
22705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22706         if (!ptr_is_owned(_res)) return;
22707         void* _res_ptr = untag_ptr(_res);
22708         CHECK_ACCESS(_res_ptr);
22709         LDKCResult_ThirtyTwoBytesNoneZ _res_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(_res_ptr);
22710         FREE(untag_ptr(_res));
22711         CResult_ThirtyTwoBytesNoneZ_free(_res_conv);
22712 }
22713
22714 static inline uint64_t CResult_ThirtyTwoBytesNoneZ_clone_ptr(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR arg) {
22715         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
22716         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(arg);
22717         return tag_ptr(ret_conv, true);
22718 }
22719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22720         LDKCResult_ThirtyTwoBytesNoneZ* arg_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(arg);
22721         int64_t ret_conv = CResult_ThirtyTwoBytesNoneZ_clone_ptr(arg_conv);
22722         return ret_conv;
22723 }
22724
22725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22726         LDKCResult_ThirtyTwoBytesNoneZ* orig_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(orig);
22727         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
22728         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(orig_conv);
22729         return tag_ptr(ret_conv, true);
22730 }
22731
22732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22733         LDKBlindedPayInfo o_conv;
22734         o_conv.inner = untag_ptr(o);
22735         o_conv.is_owned = ptr_is_owned(o);
22736         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22737         o_conv = BlindedPayInfo_clone(&o_conv);
22738         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
22739         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
22740         return tag_ptr(ret_conv, true);
22741 }
22742
22743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22744         void* e_ptr = untag_ptr(e);
22745         CHECK_ACCESS(e_ptr);
22746         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22747         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22748         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
22749         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
22750         return tag_ptr(ret_conv, true);
22751 }
22752
22753 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22754         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
22755         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
22756         return ret_conv;
22757 }
22758
22759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22760         if (!ptr_is_owned(_res)) return;
22761         void* _res_ptr = untag_ptr(_res);
22762         CHECK_ACCESS(_res_ptr);
22763         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
22764         FREE(untag_ptr(_res));
22765         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
22766 }
22767
22768 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
22769         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
22770         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
22771         return tag_ptr(ret_conv, true);
22772 }
22773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22774         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
22775         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
22776         return ret_conv;
22777 }
22778
22779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22780         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
22781         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
22782         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
22783         return tag_ptr(ret_conv, true);
22784 }
22785
22786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22787         LDKDelayedPaymentOutputDescriptor o_conv;
22788         o_conv.inner = untag_ptr(o);
22789         o_conv.is_owned = ptr_is_owned(o);
22790         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22791         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
22792         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
22793         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
22794         return tag_ptr(ret_conv, true);
22795 }
22796
22797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22798         void* e_ptr = untag_ptr(e);
22799         CHECK_ACCESS(e_ptr);
22800         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22801         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22802         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
22803         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
22804         return tag_ptr(ret_conv, true);
22805 }
22806
22807 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22808         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
22809         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
22810         return ret_conv;
22811 }
22812
22813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22814         if (!ptr_is_owned(_res)) return;
22815         void* _res_ptr = untag_ptr(_res);
22816         CHECK_ACCESS(_res_ptr);
22817         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
22818         FREE(untag_ptr(_res));
22819         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
22820 }
22821
22822 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
22823         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
22824         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
22825         return tag_ptr(ret_conv, true);
22826 }
22827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22828         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
22829         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
22830         return ret_conv;
22831 }
22832
22833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22834         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
22835         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
22836         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
22837         return tag_ptr(ret_conv, true);
22838 }
22839
22840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22841         LDKStaticPaymentOutputDescriptor o_conv;
22842         o_conv.inner = untag_ptr(o);
22843         o_conv.is_owned = ptr_is_owned(o);
22844         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22845         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
22846         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
22847         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
22848         return tag_ptr(ret_conv, true);
22849 }
22850
22851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22852         void* e_ptr = untag_ptr(e);
22853         CHECK_ACCESS(e_ptr);
22854         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22855         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22856         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
22857         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
22858         return tag_ptr(ret_conv, true);
22859 }
22860
22861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22862         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
22863         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
22864         return ret_conv;
22865 }
22866
22867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22868         if (!ptr_is_owned(_res)) return;
22869         void* _res_ptr = untag_ptr(_res);
22870         CHECK_ACCESS(_res_ptr);
22871         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
22872         FREE(untag_ptr(_res));
22873         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
22874 }
22875
22876 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
22877         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
22878         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
22879         return tag_ptr(ret_conv, true);
22880 }
22881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22882         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
22883         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
22884         return ret_conv;
22885 }
22886
22887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22888         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
22889         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
22890         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
22891         return tag_ptr(ret_conv, true);
22892 }
22893
22894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22895         void* o_ptr = untag_ptr(o);
22896         CHECK_ACCESS(o_ptr);
22897         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
22898         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
22899         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
22900         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
22901         return tag_ptr(ret_conv, true);
22902 }
22903
22904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22905         void* e_ptr = untag_ptr(e);
22906         CHECK_ACCESS(e_ptr);
22907         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22908         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22909         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
22910         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
22911         return tag_ptr(ret_conv, true);
22912 }
22913
22914 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22915         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
22916         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
22917         return ret_conv;
22918 }
22919
22920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22921         if (!ptr_is_owned(_res)) return;
22922         void* _res_ptr = untag_ptr(_res);
22923         CHECK_ACCESS(_res_ptr);
22924         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
22925         FREE(untag_ptr(_res));
22926         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
22927 }
22928
22929 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
22930         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
22931         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
22932         return tag_ptr(ret_conv, true);
22933 }
22934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22935         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
22936         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
22937         return ret_conv;
22938 }
22939
22940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22941         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
22942         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
22943         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
22944         return tag_ptr(ret_conv, true);
22945 }
22946
22947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22948         LDKCVec_SpendableOutputDescriptorZ _res_constr;
22949         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22950         if (_res_constr.datalen > 0)
22951                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
22952         else
22953                 _res_constr.data = NULL;
22954         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22955         for (size_t b = 0; b < _res_constr.datalen; b++) {
22956                 int64_t _res_conv_27 = _res_vals[b];
22957                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
22958                 CHECK_ACCESS(_res_conv_27_ptr);
22959                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
22960                 FREE(untag_ptr(_res_conv_27));
22961                 _res_constr.data[b] = _res_conv_27_conv;
22962         }
22963         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22964         CVec_SpendableOutputDescriptorZ_free(_res_constr);
22965 }
22966
22967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22968         LDKCVec_TxOutZ _res_constr;
22969         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22970         if (_res_constr.datalen > 0)
22971                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
22972         else
22973                 _res_constr.data = NULL;
22974         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22975         for (size_t h = 0; h < _res_constr.datalen; h++) {
22976                 int64_t _res_conv_7 = _res_vals[h];
22977                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
22978                 CHECK_ACCESS(_res_conv_7_ptr);
22979                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
22980                 FREE(untag_ptr(_res_conv_7));
22981                 _res_constr.data[h] = _res_conv_7_conv;
22982         }
22983         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22984         CVec_TxOutZ_free(_res_constr);
22985 }
22986
22987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
22988         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
22989         *ret_copy = COption_u32Z_some(o);
22990         int64_t ret_ref = tag_ptr(ret_copy, true);
22991         return ret_ref;
22992 }
22993
22994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
22995         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
22996         *ret_copy = COption_u32Z_none();
22997         int64_t ret_ref = tag_ptr(ret_copy, true);
22998         return ret_ref;
22999 }
23000
23001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23002         if (!ptr_is_owned(_res)) return;
23003         void* _res_ptr = untag_ptr(_res);
23004         CHECK_ACCESS(_res_ptr);
23005         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
23006         FREE(untag_ptr(_res));
23007         COption_u32Z_free(_res_conv);
23008 }
23009
23010 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
23011         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
23012         *ret_copy = COption_u32Z_clone(arg);
23013         int64_t ret_ref = tag_ptr(ret_copy, true);
23014         return ret_ref;
23015 }
23016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23017         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
23018         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
23019         return ret_conv;
23020 }
23021
23022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23023         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
23024         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
23025         *ret_copy = COption_u32Z_clone(orig_conv);
23026         int64_t ret_ref = tag_ptr(ret_copy, true);
23027         return ret_ref;
23028 }
23029
23030 static inline uint64_t C2Tuple_CVec_u8Zu64Z_clone_ptr(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR arg) {
23031         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
23032         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(arg);
23033         return tag_ptr(ret_conv, true);
23034 }
23035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23036         LDKC2Tuple_CVec_u8Zu64Z* arg_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(arg);
23037         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_clone_ptr(arg_conv);
23038         return ret_conv;
23039 }
23040
23041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23042         LDKC2Tuple_CVec_u8Zu64Z* orig_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(orig);
23043         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
23044         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(orig_conv);
23045         return tag_ptr(ret_conv, true);
23046 }
23047
23048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
23049         LDKCVec_u8Z a_ref;
23050         a_ref.datalen = (*env)->GetArrayLength(env, a);
23051         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
23052         (*env)->GetByteArrayRegion(env, a, 0, a_ref.datalen, a_ref.data);
23053         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
23054         *ret_conv = C2Tuple_CVec_u8Zu64Z_new(a_ref, b);
23055         return tag_ptr(ret_conv, true);
23056 }
23057
23058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23059         if (!ptr_is_owned(_res)) return;
23060         void* _res_ptr = untag_ptr(_res);
23061         CHECK_ACCESS(_res_ptr);
23062         LDKC2Tuple_CVec_u8Zu64Z _res_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(_res_ptr);
23063         FREE(untag_ptr(_res));
23064         C2Tuple_CVec_u8Zu64Z_free(_res_conv);
23065 }
23066
23067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23068         void* o_ptr = untag_ptr(o);
23069         CHECK_ACCESS(o_ptr);
23070         LDKC2Tuple_CVec_u8Zu64Z o_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(o_ptr);
23071         o_conv = C2Tuple_CVec_u8Zu64Z_clone((LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(o));
23072         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
23073         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(o_conv);
23074         return tag_ptr(ret_conv, true);
23075 }
23076
23077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1err(JNIEnv *env, jclass clz) {
23078         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
23079         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err();
23080         return tag_ptr(ret_conv, true);
23081 }
23082
23083 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23084         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* o_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(o);
23085         jboolean ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(o_conv);
23086         return ret_conv;
23087 }
23088
23089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23090         if (!ptr_is_owned(_res)) return;
23091         void* _res_ptr = untag_ptr(_res);
23092         CHECK_ACCESS(_res_ptr);
23093         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ _res_conv = *(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)(_res_ptr);
23094         FREE(untag_ptr(_res));
23095         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(_res_conv);
23096 }
23097
23098 static inline uint64_t CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR arg) {
23099         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
23100         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(arg);
23101         return tag_ptr(ret_conv, true);
23102 }
23103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23104         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* arg_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(arg);
23105         int64_t ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(arg_conv);
23106         return ret_conv;
23107 }
23108
23109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23110         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* orig_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(orig);
23111         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
23112         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(orig_conv);
23113         return tag_ptr(ret_conv, true);
23114 }
23115
23116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23117         LDKChannelDerivationParameters o_conv;
23118         o_conv.inner = untag_ptr(o);
23119         o_conv.is_owned = ptr_is_owned(o);
23120         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23121         o_conv = ChannelDerivationParameters_clone(&o_conv);
23122         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
23123         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv);
23124         return tag_ptr(ret_conv, true);
23125 }
23126
23127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23128         void* e_ptr = untag_ptr(e);
23129         CHECK_ACCESS(e_ptr);
23130         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23131         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23132         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
23133         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv);
23134         return tag_ptr(ret_conv, true);
23135 }
23136
23137 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23138         LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o);
23139         jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv);
23140         return ret_conv;
23141 }
23142
23143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23144         if (!ptr_is_owned(_res)) return;
23145         void* _res_ptr = untag_ptr(_res);
23146         CHECK_ACCESS(_res_ptr);
23147         LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr);
23148         FREE(untag_ptr(_res));
23149         CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv);
23150 }
23151
23152 static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) {
23153         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
23154         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg);
23155         return tag_ptr(ret_conv, true);
23156 }
23157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23158         LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg);
23159         int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv);
23160         return ret_conv;
23161 }
23162
23163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23164         LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig);
23165         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
23166         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv);
23167         return tag_ptr(ret_conv, true);
23168 }
23169
23170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23171         LDKHTLCDescriptor o_conv;
23172         o_conv.inner = untag_ptr(o);
23173         o_conv.is_owned = ptr_is_owned(o);
23174         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23175         o_conv = HTLCDescriptor_clone(&o_conv);
23176         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
23177         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv);
23178         return tag_ptr(ret_conv, true);
23179 }
23180
23181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23182         void* e_ptr = untag_ptr(e);
23183         CHECK_ACCESS(e_ptr);
23184         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23185         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23186         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
23187         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv);
23188         return tag_ptr(ret_conv, true);
23189 }
23190
23191 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23192         LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o);
23193         jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv);
23194         return ret_conv;
23195 }
23196
23197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23198         if (!ptr_is_owned(_res)) return;
23199         void* _res_ptr = untag_ptr(_res);
23200         CHECK_ACCESS(_res_ptr);
23201         LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr);
23202         FREE(untag_ptr(_res));
23203         CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv);
23204 }
23205
23206 static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) {
23207         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
23208         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg);
23209         return tag_ptr(ret_conv, true);
23210 }
23211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23212         LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg);
23213         int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv);
23214         return ret_conv;
23215 }
23216
23217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23218         LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig);
23219         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
23220         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv);
23221         return tag_ptr(ret_conv, true);
23222 }
23223
23224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
23225         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
23226         *ret_conv = CResult_NoneNoneZ_ok();
23227         return tag_ptr(ret_conv, true);
23228 }
23229
23230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
23231         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
23232         *ret_conv = CResult_NoneNoneZ_err();
23233         return tag_ptr(ret_conv, true);
23234 }
23235
23236 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23237         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
23238         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
23239         return ret_conv;
23240 }
23241
23242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23243         if (!ptr_is_owned(_res)) return;
23244         void* _res_ptr = untag_ptr(_res);
23245         CHECK_ACCESS(_res_ptr);
23246         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
23247         FREE(untag_ptr(_res));
23248         CResult_NoneNoneZ_free(_res_conv);
23249 }
23250
23251 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
23252         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
23253         *ret_conv = CResult_NoneNoneZ_clone(arg);
23254         return tag_ptr(ret_conv, true);
23255 }
23256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23257         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
23258         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
23259         return ret_conv;
23260 }
23261
23262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23263         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
23264         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
23265         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
23266         return tag_ptr(ret_conv, true);
23267 }
23268
23269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
23270         LDKPublicKey o_ref;
23271         CHECK((*env)->GetArrayLength(env, o) == 33);
23272         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
23273         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
23274         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
23275         return tag_ptr(ret_conv, true);
23276 }
23277
23278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1err(JNIEnv *env, jclass clz) {
23279         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
23280         *ret_conv = CResult_PublicKeyNoneZ_err();
23281         return tag_ptr(ret_conv, true);
23282 }
23283
23284 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23285         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
23286         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
23287         return ret_conv;
23288 }
23289
23290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23291         if (!ptr_is_owned(_res)) return;
23292         void* _res_ptr = untag_ptr(_res);
23293         CHECK_ACCESS(_res_ptr);
23294         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
23295         FREE(untag_ptr(_res));
23296         CResult_PublicKeyNoneZ_free(_res_conv);
23297 }
23298
23299 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
23300         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
23301         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
23302         return tag_ptr(ret_conv, true);
23303 }
23304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23305         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
23306         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
23307         return ret_conv;
23308 }
23309
23310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23311         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
23312         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
23313         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
23314         return tag_ptr(ret_conv, true);
23315 }
23316
23317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1some(JNIEnv *env, jclass clz, int64_t o) {
23318         void* o_ptr = untag_ptr(o);
23319         CHECK_ACCESS(o_ptr);
23320         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
23321         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
23322         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
23323         *ret_copy = COption_BigEndianScalarZ_some(o_conv);
23324         int64_t ret_ref = tag_ptr(ret_copy, true);
23325         return ret_ref;
23326 }
23327
23328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1none(JNIEnv *env, jclass clz) {
23329         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
23330         *ret_copy = COption_BigEndianScalarZ_none();
23331         int64_t ret_ref = tag_ptr(ret_copy, true);
23332         return ret_ref;
23333 }
23334
23335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23336         if (!ptr_is_owned(_res)) return;
23337         void* _res_ptr = untag_ptr(_res);
23338         CHECK_ACCESS(_res_ptr);
23339         LDKCOption_BigEndianScalarZ _res_conv = *(LDKCOption_BigEndianScalarZ*)(_res_ptr);
23340         FREE(untag_ptr(_res));
23341         COption_BigEndianScalarZ_free(_res_conv);
23342 }
23343
23344 static inline uint64_t COption_BigEndianScalarZ_clone_ptr(LDKCOption_BigEndianScalarZ *NONNULL_PTR arg) {
23345         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
23346         *ret_copy = COption_BigEndianScalarZ_clone(arg);
23347         int64_t ret_ref = tag_ptr(ret_copy, true);
23348         return ret_ref;
23349 }
23350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23351         LDKCOption_BigEndianScalarZ* arg_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(arg);
23352         int64_t ret_conv = COption_BigEndianScalarZ_clone_ptr(arg_conv);
23353         return ret_conv;
23354 }
23355
23356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23357         LDKCOption_BigEndianScalarZ* orig_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(orig);
23358         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
23359         *ret_copy = COption_BigEndianScalarZ_clone(orig_conv);
23360         int64_t ret_ref = tag_ptr(ret_copy, true);
23361         return ret_ref;
23362 }
23363
23364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1U5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
23365         LDKCVec_U5Z _res_constr;
23366         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23367         if (_res_constr.datalen > 0)
23368                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
23369         else
23370                 _res_constr.data = NULL;
23371         int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
23372         for (size_t h = 0; h < _res_constr.datalen; h++) {
23373                 int8_t _res_conv_7 = _res_vals[h];
23374                 
23375                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
23376         }
23377         (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
23378         CVec_U5Z_free(_res_constr);
23379 }
23380
23381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
23382         LDKRecoverableSignature o_ref;
23383         CHECK((*env)->GetArrayLength(env, o) == 68);
23384         (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
23385         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
23386         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
23387         return tag_ptr(ret_conv, true);
23388 }
23389
23390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
23391         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
23392         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
23393         return tag_ptr(ret_conv, true);
23394 }
23395
23396 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23397         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
23398         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
23399         return ret_conv;
23400 }
23401
23402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23403         if (!ptr_is_owned(_res)) return;
23404         void* _res_ptr = untag_ptr(_res);
23405         CHECK_ACCESS(_res_ptr);
23406         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
23407         FREE(untag_ptr(_res));
23408         CResult_RecoverableSignatureNoneZ_free(_res_conv);
23409 }
23410
23411 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
23412         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
23413         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
23414         return tag_ptr(ret_conv, true);
23415 }
23416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23417         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
23418         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
23419         return ret_conv;
23420 }
23421
23422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23423         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
23424         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
23425         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
23426         return tag_ptr(ret_conv, true);
23427 }
23428
23429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
23430         LDKSchnorrSignature o_ref;
23431         CHECK((*env)->GetArrayLength(env, o) == 64);
23432         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
23433         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
23434         *ret_conv = CResult_SchnorrSignatureNoneZ_ok(o_ref);
23435         return tag_ptr(ret_conv, true);
23436 }
23437
23438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
23439         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
23440         *ret_conv = CResult_SchnorrSignatureNoneZ_err();
23441         return tag_ptr(ret_conv, true);
23442 }
23443
23444 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23445         LDKCResult_SchnorrSignatureNoneZ* o_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(o);
23446         jboolean ret_conv = CResult_SchnorrSignatureNoneZ_is_ok(o_conv);
23447         return ret_conv;
23448 }
23449
23450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23451         if (!ptr_is_owned(_res)) return;
23452         void* _res_ptr = untag_ptr(_res);
23453         CHECK_ACCESS(_res_ptr);
23454         LDKCResult_SchnorrSignatureNoneZ _res_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(_res_ptr);
23455         FREE(untag_ptr(_res));
23456         CResult_SchnorrSignatureNoneZ_free(_res_conv);
23457 }
23458
23459 static inline uint64_t CResult_SchnorrSignatureNoneZ_clone_ptr(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR arg) {
23460         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
23461         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(arg);
23462         return tag_ptr(ret_conv, true);
23463 }
23464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23465         LDKCResult_SchnorrSignatureNoneZ* arg_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(arg);
23466         int64_t ret_conv = CResult_SchnorrSignatureNoneZ_clone_ptr(arg_conv);
23467         return ret_conv;
23468 }
23469
23470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23471         LDKCResult_SchnorrSignatureNoneZ* orig_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(orig);
23472         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
23473         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(orig_conv);
23474         return tag_ptr(ret_conv, true);
23475 }
23476
23477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
23478         LDKECDSASignature o_ref;
23479         CHECK((*env)->GetArrayLength(env, o) == 64);
23480         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
23481         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
23482         *ret_conv = CResult_ECDSASignatureNoneZ_ok(o_ref);
23483         return tag_ptr(ret_conv, true);
23484 }
23485
23486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1err(JNIEnv *env, jclass clz) {
23487         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
23488         *ret_conv = CResult_ECDSASignatureNoneZ_err();
23489         return tag_ptr(ret_conv, true);
23490 }
23491
23492 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23493         LDKCResult_ECDSASignatureNoneZ* o_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(o);
23494         jboolean ret_conv = CResult_ECDSASignatureNoneZ_is_ok(o_conv);
23495         return ret_conv;
23496 }
23497
23498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23499         if (!ptr_is_owned(_res)) return;
23500         void* _res_ptr = untag_ptr(_res);
23501         CHECK_ACCESS(_res_ptr);
23502         LDKCResult_ECDSASignatureNoneZ _res_conv = *(LDKCResult_ECDSASignatureNoneZ*)(_res_ptr);
23503         FREE(untag_ptr(_res));
23504         CResult_ECDSASignatureNoneZ_free(_res_conv);
23505 }
23506
23507 static inline uint64_t CResult_ECDSASignatureNoneZ_clone_ptr(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR arg) {
23508         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
23509         *ret_conv = CResult_ECDSASignatureNoneZ_clone(arg);
23510         return tag_ptr(ret_conv, true);
23511 }
23512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23513         LDKCResult_ECDSASignatureNoneZ* arg_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(arg);
23514         int64_t ret_conv = CResult_ECDSASignatureNoneZ_clone_ptr(arg_conv);
23515         return ret_conv;
23516 }
23517
23518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23519         LDKCResult_ECDSASignatureNoneZ* orig_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(orig);
23520         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
23521         *ret_conv = CResult_ECDSASignatureNoneZ_clone(orig_conv);
23522         return tag_ptr(ret_conv, true);
23523 }
23524
23525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23526         void* o_ptr = untag_ptr(o);
23527         CHECK_ACCESS(o_ptr);
23528         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
23529         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
23530                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23531                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
23532         }
23533         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
23534         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
23535         return tag_ptr(ret_conv, true);
23536 }
23537
23538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23539         void* e_ptr = untag_ptr(e);
23540         CHECK_ACCESS(e_ptr);
23541         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23542         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23543         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
23544         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
23545         return tag_ptr(ret_conv, true);
23546 }
23547
23548 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23549         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
23550         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
23551         return ret_conv;
23552 }
23553
23554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23555         if (!ptr_is_owned(_res)) return;
23556         void* _res_ptr = untag_ptr(_res);
23557         CHECK_ACCESS(_res_ptr);
23558         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
23559         FREE(untag_ptr(_res));
23560         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
23561 }
23562
23563 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
23564         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
23565         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
23566         return tag_ptr(ret_conv, true);
23567 }
23568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23569         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
23570         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
23571         return ret_conv;
23572 }
23573
23574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23575         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
23576         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
23577         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
23578         return tag_ptr(ret_conv, true);
23579 }
23580
23581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
23582         LDKCVec_u8Z o_ref;
23583         o_ref.datalen = (*env)->GetArrayLength(env, o);
23584         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
23585         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
23586         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
23587         *ret_conv = CResult_CVec_u8ZNoneZ_ok(o_ref);
23588         return tag_ptr(ret_conv, true);
23589 }
23590
23591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1err(JNIEnv *env, jclass clz) {
23592         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
23593         *ret_conv = CResult_CVec_u8ZNoneZ_err();
23594         return tag_ptr(ret_conv, true);
23595 }
23596
23597 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23598         LDKCResult_CVec_u8ZNoneZ* o_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(o);
23599         jboolean ret_conv = CResult_CVec_u8ZNoneZ_is_ok(o_conv);
23600         return ret_conv;
23601 }
23602
23603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23604         if (!ptr_is_owned(_res)) return;
23605         void* _res_ptr = untag_ptr(_res);
23606         CHECK_ACCESS(_res_ptr);
23607         LDKCResult_CVec_u8ZNoneZ _res_conv = *(LDKCResult_CVec_u8ZNoneZ*)(_res_ptr);
23608         FREE(untag_ptr(_res));
23609         CResult_CVec_u8ZNoneZ_free(_res_conv);
23610 }
23611
23612 static inline uint64_t CResult_CVec_u8ZNoneZ_clone_ptr(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR arg) {
23613         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
23614         *ret_conv = CResult_CVec_u8ZNoneZ_clone(arg);
23615         return tag_ptr(ret_conv, true);
23616 }
23617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23618         LDKCResult_CVec_u8ZNoneZ* arg_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(arg);
23619         int64_t ret_conv = CResult_CVec_u8ZNoneZ_clone_ptr(arg_conv);
23620         return ret_conv;
23621 }
23622
23623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23624         LDKCResult_CVec_u8ZNoneZ* orig_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(orig);
23625         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
23626         *ret_conv = CResult_CVec_u8ZNoneZ_clone(orig_conv);
23627         return tag_ptr(ret_conv, true);
23628 }
23629
23630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23631         LDKShutdownScript o_conv;
23632         o_conv.inner = untag_ptr(o);
23633         o_conv.is_owned = ptr_is_owned(o);
23634         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23635         o_conv = ShutdownScript_clone(&o_conv);
23636         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
23637         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
23638         return tag_ptr(ret_conv, true);
23639 }
23640
23641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1err(JNIEnv *env, jclass clz) {
23642         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
23643         *ret_conv = CResult_ShutdownScriptNoneZ_err();
23644         return tag_ptr(ret_conv, true);
23645 }
23646
23647 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23648         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
23649         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
23650         return ret_conv;
23651 }
23652
23653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23654         if (!ptr_is_owned(_res)) return;
23655         void* _res_ptr = untag_ptr(_res);
23656         CHECK_ACCESS(_res_ptr);
23657         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
23658         FREE(untag_ptr(_res));
23659         CResult_ShutdownScriptNoneZ_free(_res_conv);
23660 }
23661
23662 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
23663         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
23664         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
23665         return tag_ptr(ret_conv, true);
23666 }
23667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23668         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
23669         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
23670         return ret_conv;
23671 }
23672
23673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23674         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
23675         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
23676         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
23677         return tag_ptr(ret_conv, true);
23678 }
23679
23680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
23681         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
23682         *ret_copy = COption_u16Z_some(o);
23683         int64_t ret_ref = tag_ptr(ret_copy, true);
23684         return ret_ref;
23685 }
23686
23687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
23688         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
23689         *ret_copy = COption_u16Z_none();
23690         int64_t ret_ref = tag_ptr(ret_copy, true);
23691         return ret_ref;
23692 }
23693
23694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23695         if (!ptr_is_owned(_res)) return;
23696         void* _res_ptr = untag_ptr(_res);
23697         CHECK_ACCESS(_res_ptr);
23698         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
23699         FREE(untag_ptr(_res));
23700         COption_u16Z_free(_res_conv);
23701 }
23702
23703 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
23704         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
23705         *ret_copy = COption_u16Z_clone(arg);
23706         int64_t ret_ref = tag_ptr(ret_copy, true);
23707         return ret_ref;
23708 }
23709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23710         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
23711         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
23712         return ret_conv;
23713 }
23714
23715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23716         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
23717         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
23718         *ret_copy = COption_u16Z_clone(orig_conv);
23719         int64_t ret_ref = tag_ptr(ret_copy, true);
23720         return ret_ref;
23721 }
23722
23723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1some(JNIEnv *env, jclass clz, jboolean o) {
23724         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
23725         *ret_copy = COption_boolZ_some(o);
23726         int64_t ret_ref = tag_ptr(ret_copy, true);
23727         return ret_ref;
23728 }
23729
23730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1none(JNIEnv *env, jclass clz) {
23731         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
23732         *ret_copy = COption_boolZ_none();
23733         int64_t ret_ref = tag_ptr(ret_copy, true);
23734         return ret_ref;
23735 }
23736
23737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23738         if (!ptr_is_owned(_res)) return;
23739         void* _res_ptr = untag_ptr(_res);
23740         CHECK_ACCESS(_res_ptr);
23741         LDKCOption_boolZ _res_conv = *(LDKCOption_boolZ*)(_res_ptr);
23742         FREE(untag_ptr(_res));
23743         COption_boolZ_free(_res_conv);
23744 }
23745
23746 static inline uint64_t COption_boolZ_clone_ptr(LDKCOption_boolZ *NONNULL_PTR arg) {
23747         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
23748         *ret_copy = COption_boolZ_clone(arg);
23749         int64_t ret_ref = tag_ptr(ret_copy, true);
23750         return ret_ref;
23751 }
23752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23753         LDKCOption_boolZ* arg_conv = (LDKCOption_boolZ*)untag_ptr(arg);
23754         int64_t ret_conv = COption_boolZ_clone_ptr(arg_conv);
23755         return ret_conv;
23756 }
23757
23758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23759         LDKCOption_boolZ* orig_conv = (LDKCOption_boolZ*)untag_ptr(orig);
23760         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
23761         *ret_copy = COption_boolZ_clone(orig_conv);
23762         int64_t ret_ref = tag_ptr(ret_copy, true);
23763         return ret_ref;
23764 }
23765
23766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
23767         LDKWitness o_ref;
23768         o_ref.datalen = (*env)->GetArrayLength(env, o);
23769         o_ref.data = MALLOC(o_ref.datalen, "LDKWitness Bytes");
23770         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
23771         o_ref.data_is_owned = true;
23772         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
23773         *ret_conv = CResult_WitnessNoneZ_ok(o_ref);
23774         return tag_ptr(ret_conv, true);
23775 }
23776
23777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1err(JNIEnv *env, jclass clz) {
23778         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
23779         *ret_conv = CResult_WitnessNoneZ_err();
23780         return tag_ptr(ret_conv, true);
23781 }
23782
23783 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23784         LDKCResult_WitnessNoneZ* o_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(o);
23785         jboolean ret_conv = CResult_WitnessNoneZ_is_ok(o_conv);
23786         return ret_conv;
23787 }
23788
23789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23790         if (!ptr_is_owned(_res)) return;
23791         void* _res_ptr = untag_ptr(_res);
23792         CHECK_ACCESS(_res_ptr);
23793         LDKCResult_WitnessNoneZ _res_conv = *(LDKCResult_WitnessNoneZ*)(_res_ptr);
23794         FREE(untag_ptr(_res));
23795         CResult_WitnessNoneZ_free(_res_conv);
23796 }
23797
23798 static inline uint64_t CResult_WitnessNoneZ_clone_ptr(LDKCResult_WitnessNoneZ *NONNULL_PTR arg) {
23799         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
23800         *ret_conv = CResult_WitnessNoneZ_clone(arg);
23801         return tag_ptr(ret_conv, true);
23802 }
23803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23804         LDKCResult_WitnessNoneZ* arg_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(arg);
23805         int64_t ret_conv = CResult_WitnessNoneZ_clone_ptr(arg_conv);
23806         return ret_conv;
23807 }
23808
23809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23810         LDKCResult_WitnessNoneZ* orig_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(orig);
23811         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
23812         *ret_conv = CResult_WitnessNoneZ_clone(orig_conv);
23813         return tag_ptr(ret_conv, true);
23814 }
23815
23816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ECDSASignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
23817         LDKCVec_ECDSASignatureZ _res_constr;
23818         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23819         if (_res_constr.datalen > 0)
23820                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
23821         else
23822                 _res_constr.data = NULL;
23823         for (size_t i = 0; i < _res_constr.datalen; i++) {
23824                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
23825                 LDKECDSASignature _res_conv_8_ref;
23826                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
23827                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
23828                 _res_constr.data[i] = _res_conv_8_ref;
23829         }
23830         CVec_ECDSASignatureZ_free(_res_constr);
23831 }
23832
23833 static inline uint64_t C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR arg) {
23834         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
23835         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(arg);
23836         return tag_ptr(ret_conv, true);
23837 }
23838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23839         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* arg_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(arg);
23840         int64_t ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(arg_conv);
23841         return ret_conv;
23842 }
23843
23844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23845         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* orig_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(orig);
23846         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
23847         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig_conv);
23848         return tag_ptr(ret_conv, true);
23849 }
23850
23851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
23852         LDKECDSASignature a_ref;
23853         CHECK((*env)->GetArrayLength(env, a) == 64);
23854         (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
23855         LDKCVec_ECDSASignatureZ b_constr;
23856         b_constr.datalen = (*env)->GetArrayLength(env, b);
23857         if (b_constr.datalen > 0)
23858                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
23859         else
23860                 b_constr.data = NULL;
23861         for (size_t i = 0; i < b_constr.datalen; i++) {
23862                 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
23863                 LDKECDSASignature b_conv_8_ref;
23864                 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
23865                 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
23866                 b_constr.data[i] = b_conv_8_ref;
23867         }
23868         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
23869         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a_ref, b_constr);
23870         return tag_ptr(ret_conv, true);
23871 }
23872
23873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23874         if (!ptr_is_owned(_res)) return;
23875         void* _res_ptr = untag_ptr(_res);
23876         CHECK_ACCESS(_res_ptr);
23877         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(_res_ptr);
23878         FREE(untag_ptr(_res));
23879         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res_conv);
23880 }
23881
23882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23883         void* o_ptr = untag_ptr(o);
23884         CHECK_ACCESS(o_ptr);
23885         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(o_ptr);
23886         o_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone((LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(o));
23887         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
23888         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o_conv);
23889         return tag_ptr(ret_conv, true);
23890 }
23891
23892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
23893         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
23894         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err();
23895         return tag_ptr(ret_conv, true);
23896 }
23897
23898 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23899         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(o);
23900         jboolean ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o_conv);
23901         return ret_conv;
23902 }
23903
23904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23905         if (!ptr_is_owned(_res)) return;
23906         void* _res_ptr = untag_ptr(_res);
23907         CHECK_ACCESS(_res_ptr);
23908         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(_res_ptr);
23909         FREE(untag_ptr(_res));
23910         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res_conv);
23911 }
23912
23913 static inline uint64_t CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR arg) {
23914         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
23915         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(arg);
23916         return tag_ptr(ret_conv, true);
23917 }
23918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23919         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(arg);
23920         int64_t ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(arg_conv);
23921         return ret_conv;
23922 }
23923
23924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23925         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(orig);
23926         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
23927         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig_conv);
23928         return tag_ptr(ret_conv, true);
23929 }
23930
23931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23932         LDKInMemorySigner o_conv;
23933         o_conv.inner = untag_ptr(o);
23934         o_conv.is_owned = ptr_is_owned(o);
23935         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23936         o_conv = InMemorySigner_clone(&o_conv);
23937         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
23938         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
23939         return tag_ptr(ret_conv, true);
23940 }
23941
23942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23943         void* e_ptr = untag_ptr(e);
23944         CHECK_ACCESS(e_ptr);
23945         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23946         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23947         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
23948         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
23949         return tag_ptr(ret_conv, true);
23950 }
23951
23952 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23953         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
23954         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
23955         return ret_conv;
23956 }
23957
23958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23959         if (!ptr_is_owned(_res)) return;
23960         void* _res_ptr = untag_ptr(_res);
23961         CHECK_ACCESS(_res_ptr);
23962         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
23963         FREE(untag_ptr(_res));
23964         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
23965 }
23966
23967 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
23968         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
23969         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
23970         return tag_ptr(ret_conv, true);
23971 }
23972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23973         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
23974         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
23975         return ret_conv;
23976 }
23977
23978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23979         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
23980         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
23981         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
23982         return tag_ptr(ret_conv, true);
23983 }
23984
23985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
23986         LDKTransaction o_ref;
23987         o_ref.datalen = (*env)->GetArrayLength(env, o);
23988         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
23989         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
23990         o_ref.data_is_owned = true;
23991         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
23992         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
23993         return tag_ptr(ret_conv, true);
23994 }
23995
23996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
23997         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
23998         *ret_conv = CResult_TransactionNoneZ_err();
23999         return tag_ptr(ret_conv, true);
24000 }
24001
24002 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24003         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
24004         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
24005         return ret_conv;
24006 }
24007
24008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24009         if (!ptr_is_owned(_res)) return;
24010         void* _res_ptr = untag_ptr(_res);
24011         CHECK_ACCESS(_res_ptr);
24012         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
24013         FREE(untag_ptr(_res));
24014         CResult_TransactionNoneZ_free(_res_conv);
24015 }
24016
24017 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
24018         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
24019         *ret_conv = CResult_TransactionNoneZ_clone(arg);
24020         return tag_ptr(ret_conv, true);
24021 }
24022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24023         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
24024         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
24025         return ret_conv;
24026 }
24027
24028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24029         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
24030         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
24031         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
24032         return tag_ptr(ret_conv, true);
24033 }
24034
24035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1some(JNIEnv *env, jclass clz, int64_t o) {
24036         void* o_ptr = untag_ptr(o);
24037         CHECK_ACCESS(o_ptr);
24038         LDKWriteableScore o_conv = *(LDKWriteableScore*)(o_ptr);
24039         if (o_conv.free == LDKWriteableScore_JCalls_free) {
24040                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24041                 LDKWriteableScore_JCalls_cloned(&o_conv);
24042         }
24043         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
24044         *ret_copy = COption_WriteableScoreZ_some(o_conv);
24045         int64_t ret_ref = tag_ptr(ret_copy, true);
24046         return ret_ref;
24047 }
24048
24049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1none(JNIEnv *env, jclass clz) {
24050         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
24051         *ret_copy = COption_WriteableScoreZ_none();
24052         int64_t ret_ref = tag_ptr(ret_copy, true);
24053         return ret_ref;
24054 }
24055
24056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24057         if (!ptr_is_owned(_res)) return;
24058         void* _res_ptr = untag_ptr(_res);
24059         CHECK_ACCESS(_res_ptr);
24060         LDKCOption_WriteableScoreZ _res_conv = *(LDKCOption_WriteableScoreZ*)(_res_ptr);
24061         FREE(untag_ptr(_res));
24062         COption_WriteableScoreZ_free(_res_conv);
24063 }
24064
24065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1ok(JNIEnv *env, jclass clz) {
24066         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
24067         *ret_conv = CResult_NoneIOErrorZ_ok();
24068         return tag_ptr(ret_conv, true);
24069 }
24070
24071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
24072         LDKIOError e_conv = LDKIOError_from_java(env, e);
24073         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
24074         *ret_conv = CResult_NoneIOErrorZ_err(e_conv);
24075         return tag_ptr(ret_conv, true);
24076 }
24077
24078 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24079         LDKCResult_NoneIOErrorZ* o_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(o);
24080         jboolean ret_conv = CResult_NoneIOErrorZ_is_ok(o_conv);
24081         return ret_conv;
24082 }
24083
24084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24085         if (!ptr_is_owned(_res)) return;
24086         void* _res_ptr = untag_ptr(_res);
24087         CHECK_ACCESS(_res_ptr);
24088         LDKCResult_NoneIOErrorZ _res_conv = *(LDKCResult_NoneIOErrorZ*)(_res_ptr);
24089         FREE(untag_ptr(_res));
24090         CResult_NoneIOErrorZ_free(_res_conv);
24091 }
24092
24093 static inline uint64_t CResult_NoneIOErrorZ_clone_ptr(LDKCResult_NoneIOErrorZ *NONNULL_PTR arg) {
24094         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
24095         *ret_conv = CResult_NoneIOErrorZ_clone(arg);
24096         return tag_ptr(ret_conv, true);
24097 }
24098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24099         LDKCResult_NoneIOErrorZ* arg_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(arg);
24100         int64_t ret_conv = CResult_NoneIOErrorZ_clone_ptr(arg_conv);
24101         return ret_conv;
24102 }
24103
24104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24105         LDKCResult_NoneIOErrorZ* orig_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(orig);
24106         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
24107         *ret_conv = CResult_NoneIOErrorZ_clone(orig_conv);
24108         return tag_ptr(ret_conv, true);
24109 }
24110
24111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24112         LDKCVec_ChannelDetailsZ _res_constr;
24113         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24114         if (_res_constr.datalen > 0)
24115                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
24116         else
24117                 _res_constr.data = NULL;
24118         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24119         for (size_t q = 0; q < _res_constr.datalen; q++) {
24120                 int64_t _res_conv_16 = _res_vals[q];
24121                 LDKChannelDetails _res_conv_16_conv;
24122                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
24123                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
24124                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
24125                 _res_constr.data[q] = _res_conv_16_conv;
24126         }
24127         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24128         CVec_ChannelDetailsZ_free(_res_constr);
24129 }
24130
24131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24132         LDKRoute o_conv;
24133         o_conv.inner = untag_ptr(o);
24134         o_conv.is_owned = ptr_is_owned(o);
24135         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24136         o_conv = Route_clone(&o_conv);
24137         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
24138         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
24139         return tag_ptr(ret_conv, true);
24140 }
24141
24142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24143         LDKLightningError e_conv;
24144         e_conv.inner = untag_ptr(e);
24145         e_conv.is_owned = ptr_is_owned(e);
24146         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24147         e_conv = LightningError_clone(&e_conv);
24148         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
24149         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
24150         return tag_ptr(ret_conv, true);
24151 }
24152
24153 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24154         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
24155         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
24156         return ret_conv;
24157 }
24158
24159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24160         if (!ptr_is_owned(_res)) return;
24161         void* _res_ptr = untag_ptr(_res);
24162         CHECK_ACCESS(_res_ptr);
24163         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
24164         FREE(untag_ptr(_res));
24165         CResult_RouteLightningErrorZ_free(_res_conv);
24166 }
24167
24168 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
24169         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
24170         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
24171         return tag_ptr(ret_conv, true);
24172 }
24173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24174         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
24175         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
24176         return ret_conv;
24177 }
24178
24179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24180         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
24181         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
24182         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
24183         return tag_ptr(ret_conv, true);
24184 }
24185
24186 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
24187         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
24188         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
24189         return tag_ptr(ret_conv, true);
24190 }
24191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24192         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
24193         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
24194         return ret_conv;
24195 }
24196
24197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24198         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
24199         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
24200         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
24201         return tag_ptr(ret_conv, true);
24202 }
24203
24204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24205         LDKBlindedPayInfo a_conv;
24206         a_conv.inner = untag_ptr(a);
24207         a_conv.is_owned = ptr_is_owned(a);
24208         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24209         a_conv = BlindedPayInfo_clone(&a_conv);
24210         LDKBlindedPath b_conv;
24211         b_conv.inner = untag_ptr(b);
24212         b_conv.is_owned = ptr_is_owned(b);
24213         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24214         b_conv = BlindedPath_clone(&b_conv);
24215         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
24216         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
24217         return tag_ptr(ret_conv, true);
24218 }
24219
24220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24221         if (!ptr_is_owned(_res)) return;
24222         void* _res_ptr = untag_ptr(_res);
24223         CHECK_ACCESS(_res_ptr);
24224         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
24225         FREE(untag_ptr(_res));
24226         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
24227 }
24228
24229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24230         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
24231         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24232         if (_res_constr.datalen > 0)
24233                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
24234         else
24235                 _res_constr.data = NULL;
24236         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24237         for (size_t l = 0; l < _res_constr.datalen; l++) {
24238                 int64_t _res_conv_37 = _res_vals[l];
24239                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
24240                 CHECK_ACCESS(_res_conv_37_ptr);
24241                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
24242                 FREE(untag_ptr(_res_conv_37));
24243                 _res_constr.data[l] = _res_conv_37_conv;
24244         }
24245         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24246         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
24247 }
24248
24249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
24250         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ o_constr;
24251         o_constr.datalen = (*env)->GetArrayLength(env, o);
24252         if (o_constr.datalen > 0)
24253                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
24254         else
24255                 o_constr.data = NULL;
24256         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
24257         for (size_t l = 0; l < o_constr.datalen; l++) {
24258                 int64_t o_conv_37 = o_vals[l];
24259                 void* o_conv_37_ptr = untag_ptr(o_conv_37);
24260                 CHECK_ACCESS(o_conv_37_ptr);
24261                 LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_conv_37_ptr);
24262                 o_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o_conv_37));
24263                 o_constr.data[l] = o_conv_37_conv;
24264         }
24265         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
24266         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
24267         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(o_constr);
24268         return tag_ptr(ret_conv, true);
24269 }
24270
24271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1err(JNIEnv *env, jclass clz) {
24272         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
24273         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err();
24274         return tag_ptr(ret_conv, true);
24275 }
24276
24277 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24278         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* o_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(o);
24279         jboolean ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(o_conv);
24280         return ret_conv;
24281 }
24282
24283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24284         if (!ptr_is_owned(_res)) return;
24285         void* _res_ptr = untag_ptr(_res);
24286         CHECK_ACCESS(_res_ptr);
24287         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(_res_ptr);
24288         FREE(untag_ptr(_res));
24289         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(_res_conv);
24290 }
24291
24292 static inline uint64_t CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR arg) {
24293         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
24294         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(arg);
24295         return tag_ptr(ret_conv, true);
24296 }
24297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24298         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(arg);
24299         int64_t ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(arg_conv);
24300         return ret_conv;
24301 }
24302
24303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24304         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(orig);
24305         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
24306         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(orig_conv);
24307         return tag_ptr(ret_conv, true);
24308 }
24309
24310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
24311         LDKCVec_PublicKeyZ _res_constr;
24312         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24313         if (_res_constr.datalen > 0)
24314                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
24315         else
24316                 _res_constr.data = NULL;
24317         for (size_t i = 0; i < _res_constr.datalen; i++) {
24318                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
24319                 LDKPublicKey _res_conv_8_ref;
24320                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
24321                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
24322                 _res_constr.data[i] = _res_conv_8_ref;
24323         }
24324         CVec_PublicKeyZ_free(_res_constr);
24325 }
24326
24327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24328         LDKOnionMessagePath o_conv;
24329         o_conv.inner = untag_ptr(o);
24330         o_conv.is_owned = ptr_is_owned(o);
24331         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24332         o_conv = OnionMessagePath_clone(&o_conv);
24333         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
24334         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
24335         return tag_ptr(ret_conv, true);
24336 }
24337
24338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1err(JNIEnv *env, jclass clz) {
24339         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
24340         *ret_conv = CResult_OnionMessagePathNoneZ_err();
24341         return tag_ptr(ret_conv, true);
24342 }
24343
24344 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24345         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
24346         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
24347         return ret_conv;
24348 }
24349
24350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24351         if (!ptr_is_owned(_res)) return;
24352         void* _res_ptr = untag_ptr(_res);
24353         CHECK_ACCESS(_res_ptr);
24354         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
24355         FREE(untag_ptr(_res));
24356         CResult_OnionMessagePathNoneZ_free(_res_conv);
24357 }
24358
24359 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
24360         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
24361         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
24362         return tag_ptr(ret_conv, true);
24363 }
24364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24365         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
24366         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
24367         return ret_conv;
24368 }
24369
24370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24371         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
24372         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
24373         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
24374         return tag_ptr(ret_conv, true);
24375 }
24376
24377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
24378         LDKCVec_BlindedPathZ o_constr;
24379         o_constr.datalen = (*env)->GetArrayLength(env, o);
24380         if (o_constr.datalen > 0)
24381                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
24382         else
24383                 o_constr.data = NULL;
24384         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
24385         for (size_t n = 0; n < o_constr.datalen; n++) {
24386                 int64_t o_conv_13 = o_vals[n];
24387                 LDKBlindedPath o_conv_13_conv;
24388                 o_conv_13_conv.inner = untag_ptr(o_conv_13);
24389                 o_conv_13_conv.is_owned = ptr_is_owned(o_conv_13);
24390                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_13_conv);
24391                 o_conv_13_conv = BlindedPath_clone(&o_conv_13_conv);
24392                 o_constr.data[n] = o_conv_13_conv;
24393         }
24394         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
24395         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
24396         *ret_conv = CResult_CVec_BlindedPathZNoneZ_ok(o_constr);
24397         return tag_ptr(ret_conv, true);
24398 }
24399
24400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1err(JNIEnv *env, jclass clz) {
24401         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
24402         *ret_conv = CResult_CVec_BlindedPathZNoneZ_err();
24403         return tag_ptr(ret_conv, true);
24404 }
24405
24406 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24407         LDKCResult_CVec_BlindedPathZNoneZ* o_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(o);
24408         jboolean ret_conv = CResult_CVec_BlindedPathZNoneZ_is_ok(o_conv);
24409         return ret_conv;
24410 }
24411
24412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24413         if (!ptr_is_owned(_res)) return;
24414         void* _res_ptr = untag_ptr(_res);
24415         CHECK_ACCESS(_res_ptr);
24416         LDKCResult_CVec_BlindedPathZNoneZ _res_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(_res_ptr);
24417         FREE(untag_ptr(_res));
24418         CResult_CVec_BlindedPathZNoneZ_free(_res_conv);
24419 }
24420
24421 static inline uint64_t CResult_CVec_BlindedPathZNoneZ_clone_ptr(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR arg) {
24422         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
24423         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(arg);
24424         return tag_ptr(ret_conv, true);
24425 }
24426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24427         LDKCResult_CVec_BlindedPathZNoneZ* arg_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(arg);
24428         int64_t ret_conv = CResult_CVec_BlindedPathZNoneZ_clone_ptr(arg_conv);
24429         return ret_conv;
24430 }
24431
24432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24433         LDKCResult_CVec_BlindedPathZNoneZ* orig_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(orig);
24434         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
24435         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(orig_conv);
24436         return tag_ptr(ret_conv, true);
24437 }
24438
24439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24440         LDKInFlightHtlcs o_conv;
24441         o_conv.inner = untag_ptr(o);
24442         o_conv.is_owned = ptr_is_owned(o);
24443         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24444         o_conv = InFlightHtlcs_clone(&o_conv);
24445         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
24446         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
24447         return tag_ptr(ret_conv, true);
24448 }
24449
24450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24451         void* e_ptr = untag_ptr(e);
24452         CHECK_ACCESS(e_ptr);
24453         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24454         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24455         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
24456         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
24457         return tag_ptr(ret_conv, true);
24458 }
24459
24460 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24461         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
24462         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
24463         return ret_conv;
24464 }
24465
24466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24467         if (!ptr_is_owned(_res)) return;
24468         void* _res_ptr = untag_ptr(_res);
24469         CHECK_ACCESS(_res_ptr);
24470         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
24471         FREE(untag_ptr(_res));
24472         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
24473 }
24474
24475 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
24476         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
24477         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
24478         return tag_ptr(ret_conv, true);
24479 }
24480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24481         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
24482         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
24483         return ret_conv;
24484 }
24485
24486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24487         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
24488         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
24489         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
24490         return tag_ptr(ret_conv, true);
24491 }
24492
24493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24494         LDKRouteHop o_conv;
24495         o_conv.inner = untag_ptr(o);
24496         o_conv.is_owned = ptr_is_owned(o);
24497         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24498         o_conv = RouteHop_clone(&o_conv);
24499         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
24500         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
24501         return tag_ptr(ret_conv, true);
24502 }
24503
24504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24505         void* e_ptr = untag_ptr(e);
24506         CHECK_ACCESS(e_ptr);
24507         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24508         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24509         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
24510         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
24511         return tag_ptr(ret_conv, true);
24512 }
24513
24514 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24515         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
24516         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
24517         return ret_conv;
24518 }
24519
24520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24521         if (!ptr_is_owned(_res)) return;
24522         void* _res_ptr = untag_ptr(_res);
24523         CHECK_ACCESS(_res_ptr);
24524         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
24525         FREE(untag_ptr(_res));
24526         CResult_RouteHopDecodeErrorZ_free(_res_conv);
24527 }
24528
24529 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
24530         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
24531         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
24532         return tag_ptr(ret_conv, true);
24533 }
24534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24535         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
24536         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
24537         return ret_conv;
24538 }
24539
24540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24541         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
24542         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
24543         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
24544         return tag_ptr(ret_conv, true);
24545 }
24546
24547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BlindedHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24548         LDKCVec_BlindedHopZ _res_constr;
24549         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24550         if (_res_constr.datalen > 0)
24551                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
24552         else
24553                 _res_constr.data = NULL;
24554         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24555         for (size_t m = 0; m < _res_constr.datalen; m++) {
24556                 int64_t _res_conv_12 = _res_vals[m];
24557                 LDKBlindedHop _res_conv_12_conv;
24558                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
24559                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
24560                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
24561                 _res_constr.data[m] = _res_conv_12_conv;
24562         }
24563         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24564         CVec_BlindedHopZ_free(_res_constr);
24565 }
24566
24567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24568         LDKBlindedTail o_conv;
24569         o_conv.inner = untag_ptr(o);
24570         o_conv.is_owned = ptr_is_owned(o);
24571         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24572         o_conv = BlindedTail_clone(&o_conv);
24573         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
24574         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
24575         return tag_ptr(ret_conv, true);
24576 }
24577
24578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24579         void* e_ptr = untag_ptr(e);
24580         CHECK_ACCESS(e_ptr);
24581         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24582         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24583         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
24584         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
24585         return tag_ptr(ret_conv, true);
24586 }
24587
24588 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24589         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
24590         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
24591         return ret_conv;
24592 }
24593
24594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24595         if (!ptr_is_owned(_res)) return;
24596         void* _res_ptr = untag_ptr(_res);
24597         CHECK_ACCESS(_res_ptr);
24598         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
24599         FREE(untag_ptr(_res));
24600         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
24601 }
24602
24603 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
24604         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
24605         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
24606         return tag_ptr(ret_conv, true);
24607 }
24608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24609         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
24610         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
24611         return ret_conv;
24612 }
24613
24614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24615         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
24616         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
24617         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
24618         return tag_ptr(ret_conv, true);
24619 }
24620
24621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24622         LDKCVec_RouteHopZ _res_constr;
24623         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24624         if (_res_constr.datalen > 0)
24625                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
24626         else
24627                 _res_constr.data = NULL;
24628         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24629         for (size_t k = 0; k < _res_constr.datalen; k++) {
24630                 int64_t _res_conv_10 = _res_vals[k];
24631                 LDKRouteHop _res_conv_10_conv;
24632                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
24633                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
24634                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
24635                 _res_constr.data[k] = _res_conv_10_conv;
24636         }
24637         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24638         CVec_RouteHopZ_free(_res_constr);
24639 }
24640
24641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PathZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24642         LDKCVec_PathZ _res_constr;
24643         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24644         if (_res_constr.datalen > 0)
24645                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
24646         else
24647                 _res_constr.data = NULL;
24648         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24649         for (size_t g = 0; g < _res_constr.datalen; g++) {
24650                 int64_t _res_conv_6 = _res_vals[g];
24651                 LDKPath _res_conv_6_conv;
24652                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
24653                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
24654                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
24655                 _res_constr.data[g] = _res_conv_6_conv;
24656         }
24657         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24658         CVec_PathZ_free(_res_constr);
24659 }
24660
24661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24662         LDKRoute o_conv;
24663         o_conv.inner = untag_ptr(o);
24664         o_conv.is_owned = ptr_is_owned(o);
24665         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24666         o_conv = Route_clone(&o_conv);
24667         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
24668         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
24669         return tag_ptr(ret_conv, true);
24670 }
24671
24672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24673         void* e_ptr = untag_ptr(e);
24674         CHECK_ACCESS(e_ptr);
24675         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24676         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24677         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
24678         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
24679         return tag_ptr(ret_conv, true);
24680 }
24681
24682 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24683         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
24684         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
24685         return ret_conv;
24686 }
24687
24688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24689         if (!ptr_is_owned(_res)) return;
24690         void* _res_ptr = untag_ptr(_res);
24691         CHECK_ACCESS(_res_ptr);
24692         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
24693         FREE(untag_ptr(_res));
24694         CResult_RouteDecodeErrorZ_free(_res_conv);
24695 }
24696
24697 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
24698         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
24699         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
24700         return tag_ptr(ret_conv, true);
24701 }
24702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24703         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
24704         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
24705         return ret_conv;
24706 }
24707
24708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24709         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
24710         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
24711         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
24712         return tag_ptr(ret_conv, true);
24713 }
24714
24715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24716         LDKRouteParameters o_conv;
24717         o_conv.inner = untag_ptr(o);
24718         o_conv.is_owned = ptr_is_owned(o);
24719         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24720         o_conv = RouteParameters_clone(&o_conv);
24721         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
24722         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
24723         return tag_ptr(ret_conv, true);
24724 }
24725
24726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24727         void* e_ptr = untag_ptr(e);
24728         CHECK_ACCESS(e_ptr);
24729         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24730         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24731         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
24732         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
24733         return tag_ptr(ret_conv, true);
24734 }
24735
24736 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24737         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
24738         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
24739         return ret_conv;
24740 }
24741
24742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24743         if (!ptr_is_owned(_res)) return;
24744         void* _res_ptr = untag_ptr(_res);
24745         CHECK_ACCESS(_res_ptr);
24746         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
24747         FREE(untag_ptr(_res));
24748         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
24749 }
24750
24751 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
24752         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
24753         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
24754         return tag_ptr(ret_conv, true);
24755 }
24756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24757         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
24758         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
24759         return ret_conv;
24760 }
24761
24762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24763         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
24764         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
24765         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
24766         return tag_ptr(ret_conv, true);
24767 }
24768
24769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24770         LDKCVec_u64Z _res_constr;
24771         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24772         if (_res_constr.datalen > 0)
24773                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
24774         else
24775                 _res_constr.data = NULL;
24776         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24777         for (size_t g = 0; g < _res_constr.datalen; g++) {
24778                 int64_t _res_conv_6 = _res_vals[g];
24779                 _res_constr.data[g] = _res_conv_6;
24780         }
24781         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24782         CVec_u64Z_free(_res_constr);
24783 }
24784
24785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24786         LDKPaymentParameters o_conv;
24787         o_conv.inner = untag_ptr(o);
24788         o_conv.is_owned = ptr_is_owned(o);
24789         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24790         o_conv = PaymentParameters_clone(&o_conv);
24791         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
24792         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
24793         return tag_ptr(ret_conv, true);
24794 }
24795
24796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24797         void* e_ptr = untag_ptr(e);
24798         CHECK_ACCESS(e_ptr);
24799         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24800         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24801         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
24802         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
24803         return tag_ptr(ret_conv, true);
24804 }
24805
24806 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24807         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
24808         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
24809         return ret_conv;
24810 }
24811
24812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24813         if (!ptr_is_owned(_res)) return;
24814         void* _res_ptr = untag_ptr(_res);
24815         CHECK_ACCESS(_res_ptr);
24816         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
24817         FREE(untag_ptr(_res));
24818         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
24819 }
24820
24821 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
24822         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
24823         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
24824         return tag_ptr(ret_conv, true);
24825 }
24826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24827         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
24828         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
24829         return ret_conv;
24830 }
24831
24832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24833         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
24834         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
24835         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
24836         return tag_ptr(ret_conv, true);
24837 }
24838
24839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24840         LDKCVec_RouteHintZ _res_constr;
24841         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24842         if (_res_constr.datalen > 0)
24843                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
24844         else
24845                 _res_constr.data = NULL;
24846         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24847         for (size_t l = 0; l < _res_constr.datalen; l++) {
24848                 int64_t _res_conv_11 = _res_vals[l];
24849                 LDKRouteHint _res_conv_11_conv;
24850                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
24851                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
24852                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
24853                 _res_constr.data[l] = _res_conv_11_conv;
24854         }
24855         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24856         CVec_RouteHintZ_free(_res_constr);
24857 }
24858
24859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24860         LDKCVec_RouteHintHopZ _res_constr;
24861         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24862         if (_res_constr.datalen > 0)
24863                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
24864         else
24865                 _res_constr.data = NULL;
24866         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24867         for (size_t o = 0; o < _res_constr.datalen; o++) {
24868                 int64_t _res_conv_14 = _res_vals[o];
24869                 LDKRouteHintHop _res_conv_14_conv;
24870                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
24871                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
24872                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
24873                 _res_constr.data[o] = _res_conv_14_conv;
24874         }
24875         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24876         CVec_RouteHintHopZ_free(_res_constr);
24877 }
24878
24879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24880         LDKRouteHint o_conv;
24881         o_conv.inner = untag_ptr(o);
24882         o_conv.is_owned = ptr_is_owned(o);
24883         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24884         o_conv = RouteHint_clone(&o_conv);
24885         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
24886         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
24887         return tag_ptr(ret_conv, true);
24888 }
24889
24890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24891         void* e_ptr = untag_ptr(e);
24892         CHECK_ACCESS(e_ptr);
24893         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24894         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24895         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
24896         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
24897         return tag_ptr(ret_conv, true);
24898 }
24899
24900 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24901         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
24902         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
24903         return ret_conv;
24904 }
24905
24906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24907         if (!ptr_is_owned(_res)) return;
24908         void* _res_ptr = untag_ptr(_res);
24909         CHECK_ACCESS(_res_ptr);
24910         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
24911         FREE(untag_ptr(_res));
24912         CResult_RouteHintDecodeErrorZ_free(_res_conv);
24913 }
24914
24915 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
24916         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
24917         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
24918         return tag_ptr(ret_conv, true);
24919 }
24920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24921         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
24922         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
24923         return ret_conv;
24924 }
24925
24926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24927         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
24928         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
24929         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
24930         return tag_ptr(ret_conv, true);
24931 }
24932
24933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24934         LDKRouteHintHop o_conv;
24935         o_conv.inner = untag_ptr(o);
24936         o_conv.is_owned = ptr_is_owned(o);
24937         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24938         o_conv = RouteHintHop_clone(&o_conv);
24939         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
24940         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
24941         return tag_ptr(ret_conv, true);
24942 }
24943
24944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24945         void* e_ptr = untag_ptr(e);
24946         CHECK_ACCESS(e_ptr);
24947         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24948         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24949         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
24950         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
24951         return tag_ptr(ret_conv, true);
24952 }
24953
24954 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24955         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
24956         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
24957         return ret_conv;
24958 }
24959
24960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24961         if (!ptr_is_owned(_res)) return;
24962         void* _res_ptr = untag_ptr(_res);
24963         CHECK_ACCESS(_res_ptr);
24964         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
24965         FREE(untag_ptr(_res));
24966         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
24967 }
24968
24969 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
24970         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
24971         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
24972         return tag_ptr(ret_conv, true);
24973 }
24974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24975         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
24976         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
24977         return ret_conv;
24978 }
24979
24980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24981         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
24982         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
24983         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
24984         return tag_ptr(ret_conv, true);
24985 }
24986
24987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24988         LDKFixedPenaltyScorer o_conv;
24989         o_conv.inner = untag_ptr(o);
24990         o_conv.is_owned = ptr_is_owned(o);
24991         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24992         o_conv = FixedPenaltyScorer_clone(&o_conv);
24993         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
24994         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
24995         return tag_ptr(ret_conv, true);
24996 }
24997
24998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24999         void* e_ptr = untag_ptr(e);
25000         CHECK_ACCESS(e_ptr);
25001         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25002         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25003         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
25004         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
25005         return tag_ptr(ret_conv, true);
25006 }
25007
25008 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25009         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
25010         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
25011         return ret_conv;
25012 }
25013
25014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25015         if (!ptr_is_owned(_res)) return;
25016         void* _res_ptr = untag_ptr(_res);
25017         CHECK_ACCESS(_res_ptr);
25018         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
25019         FREE(untag_ptr(_res));
25020         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
25021 }
25022
25023 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
25024         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
25025         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
25026         return tag_ptr(ret_conv, true);
25027 }
25028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25029         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
25030         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
25031         return ret_conv;
25032 }
25033
25034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25035         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
25036         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
25037         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
25038         return tag_ptr(ret_conv, true);
25039 }
25040
25041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25042         LDKCVec_NodeIdZ _res_constr;
25043         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25044         if (_res_constr.datalen > 0)
25045                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
25046         else
25047                 _res_constr.data = NULL;
25048         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25049         for (size_t i = 0; i < _res_constr.datalen; i++) {
25050                 int64_t _res_conv_8 = _res_vals[i];
25051                 LDKNodeId _res_conv_8_conv;
25052                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
25053                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
25054                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
25055                 _res_constr.data[i] = _res_conv_8_conv;
25056         }
25057         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25058         CVec_NodeIdZ_free(_res_constr);
25059 }
25060
25061 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
25062         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
25063         *ret_conv = C2Tuple_u64u64Z_clone(arg);
25064         return tag_ptr(ret_conv, true);
25065 }
25066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25067         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
25068         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
25069         return ret_conv;
25070 }
25071
25072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25073         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
25074         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
25075         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
25076         return tag_ptr(ret_conv, true);
25077 }
25078
25079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25080         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
25081         *ret_conv = C2Tuple_u64u64Z_new(a, b);
25082         return tag_ptr(ret_conv, true);
25083 }
25084
25085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
25086         if (!ptr_is_owned(_res)) return;
25087         void* _res_ptr = untag_ptr(_res);
25088         CHECK_ACCESS(_res_ptr);
25089         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
25090         FREE(untag_ptr(_res));
25091         C2Tuple_u64u64Z_free(_res_conv);
25092 }
25093
25094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
25095         void* o_ptr = untag_ptr(o);
25096         CHECK_ACCESS(o_ptr);
25097         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
25098         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
25099         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
25100         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
25101         int64_t ret_ref = tag_ptr(ret_copy, true);
25102         return ret_ref;
25103 }
25104
25105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1none(JNIEnv *env, jclass clz) {
25106         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
25107         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
25108         int64_t ret_ref = tag_ptr(ret_copy, true);
25109         return ret_ref;
25110 }
25111
25112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25113         if (!ptr_is_owned(_res)) return;
25114         void* _res_ptr = untag_ptr(_res);
25115         CHECK_ACCESS(_res_ptr);
25116         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
25117         FREE(untag_ptr(_res));
25118         COption_C2Tuple_u64u64ZZ_free(_res_conv);
25119 }
25120
25121 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
25122         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
25123         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
25124         int64_t ret_ref = tag_ptr(ret_copy, true);
25125         return ret_ref;
25126 }
25127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25128         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
25129         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
25130         return ret_conv;
25131 }
25132
25133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25134         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
25135         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
25136         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
25137         int64_t ret_ref = tag_ptr(ret_copy, true);
25138         return ret_ref;
25139 }
25140
25141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
25142         LDKThirtyTwoU16s a_ref;
25143         CHECK((*env)->GetArrayLength(env, a) == 32);
25144         (*env)->GetShortArrayRegion(env, a, 0, 32, a_ref.data);
25145         LDKThirtyTwoU16s b_ref;
25146         CHECK((*env)->GetArrayLength(env, b) == 32);
25147         (*env)->GetShortArrayRegion(env, b, 0, 32, b_ref.data);
25148         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
25149         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
25150         return tag_ptr(ret_conv, true);
25151 }
25152
25153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
25154         if (!ptr_is_owned(_res)) return;
25155         void* _res_ptr = untag_ptr(_res);
25156         CHECK_ACCESS(_res_ptr);
25157         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
25158         FREE(untag_ptr(_res));
25159         C2Tuple_Z_free(_res_conv);
25160 }
25161
25162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
25163         LDKThirtyTwoU16s a_ref;
25164         CHECK((*env)->GetArrayLength(env, a) == 32);
25165         (*env)->GetShortArrayRegion(env, a, 0, 32, a_ref.data);
25166         LDKThirtyTwoU16s b_ref;
25167         CHECK((*env)->GetArrayLength(env, b) == 32);
25168         (*env)->GetShortArrayRegion(env, b, 0, 32, b_ref.data);
25169         LDKC2Tuple__u1632_u1632Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u1632_u1632Z), "LDKC2Tuple__u1632_u1632Z");
25170         *ret_conv = C2Tuple__u1632_u1632Z_new(a_ref, b_ref);
25171         return tag_ptr(ret_conv, true);
25172 }
25173
25174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
25175         if (!ptr_is_owned(_res)) return;
25176         void* _res_ptr = untag_ptr(_res);
25177         CHECK_ACCESS(_res_ptr);
25178         LDKC2Tuple__u1632_u1632Z _res_conv = *(LDKC2Tuple__u1632_u1632Z*)(_res_ptr);
25179         FREE(untag_ptr(_res));
25180         C2Tuple__u1632_u1632Z_free(_res_conv);
25181 }
25182
25183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
25184         void* o_ptr = untag_ptr(o);
25185         CHECK_ACCESS(o_ptr);
25186         LDKC2Tuple__u1632_u1632Z o_conv = *(LDKC2Tuple__u1632_u1632Z*)(o_ptr);
25187         // WARNING: we may need a move here but no clone is available for LDKC2Tuple__u1632_u1632Z
25188         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
25189         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o_conv);
25190         int64_t ret_ref = tag_ptr(ret_copy, true);
25191         return ret_ref;
25192 }
25193
25194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1none(JNIEnv *env, jclass clz) {
25195         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
25196         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none();
25197         int64_t ret_ref = tag_ptr(ret_copy, true);
25198         return ret_ref;
25199 }
25200
25201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25202         if (!ptr_is_owned(_res)) return;
25203         void* _res_ptr = untag_ptr(_res);
25204         CHECK_ACCESS(_res_ptr);
25205         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res_conv = *(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)(_res_ptr);
25206         FREE(untag_ptr(_res));
25207         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res_conv);
25208 }
25209
25210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1some(JNIEnv *env, jclass clz, double o) {
25211         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
25212         *ret_copy = COption_f64Z_some(o);
25213         int64_t ret_ref = tag_ptr(ret_copy, true);
25214         return ret_ref;
25215 }
25216
25217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1none(JNIEnv *env, jclass clz) {
25218         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
25219         *ret_copy = COption_f64Z_none();
25220         int64_t ret_ref = tag_ptr(ret_copy, true);
25221         return ret_ref;
25222 }
25223
25224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
25225         if (!ptr_is_owned(_res)) return;
25226         void* _res_ptr = untag_ptr(_res);
25227         CHECK_ACCESS(_res_ptr);
25228         LDKCOption_f64Z _res_conv = *(LDKCOption_f64Z*)(_res_ptr);
25229         FREE(untag_ptr(_res));
25230         COption_f64Z_free(_res_conv);
25231 }
25232
25233 static inline uint64_t COption_f64Z_clone_ptr(LDKCOption_f64Z *NONNULL_PTR arg) {
25234         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
25235         *ret_copy = COption_f64Z_clone(arg);
25236         int64_t ret_ref = tag_ptr(ret_copy, true);
25237         return ret_ref;
25238 }
25239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25240         LDKCOption_f64Z* arg_conv = (LDKCOption_f64Z*)untag_ptr(arg);
25241         int64_t ret_conv = COption_f64Z_clone_ptr(arg_conv);
25242         return ret_conv;
25243 }
25244
25245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25246         LDKCOption_f64Z* orig_conv = (LDKCOption_f64Z*)untag_ptr(orig);
25247         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
25248         *ret_copy = COption_f64Z_clone(orig_conv);
25249         int64_t ret_ref = tag_ptr(ret_copy, true);
25250         return ret_ref;
25251 }
25252
25253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25254         LDKProbabilisticScorer o_conv;
25255         o_conv.inner = untag_ptr(o);
25256         o_conv.is_owned = ptr_is_owned(o);
25257         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25258         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
25259         
25260         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
25261         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
25262         return tag_ptr(ret_conv, true);
25263 }
25264
25265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25266         void* e_ptr = untag_ptr(e);
25267         CHECK_ACCESS(e_ptr);
25268         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25269         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25270         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
25271         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
25272         return tag_ptr(ret_conv, true);
25273 }
25274
25275 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25276         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
25277         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
25278         return ret_conv;
25279 }
25280
25281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25282         if (!ptr_is_owned(_res)) return;
25283         void* _res_ptr = untag_ptr(_res);
25284         CHECK_ACCESS(_res_ptr);
25285         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
25286         FREE(untag_ptr(_res));
25287         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
25288 }
25289
25290 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
25291         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
25292         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
25293         return tag_ptr(ret_conv, true);
25294 }
25295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25296         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
25297         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
25298         return ret_conv;
25299 }
25300
25301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25302         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
25303         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
25304         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
25305         return tag_ptr(ret_conv, true);
25306 }
25307
25308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
25309         LDKTransaction b_ref;
25310         b_ref.datalen = (*env)->GetArrayLength(env, b);
25311         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
25312         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
25313         b_ref.data_is_owned = true;
25314         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
25315         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
25316         return tag_ptr(ret_conv, true);
25317 }
25318
25319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25320         if (!ptr_is_owned(_res)) return;
25321         void* _res_ptr = untag_ptr(_res);
25322         CHECK_ACCESS(_res_ptr);
25323         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
25324         FREE(untag_ptr(_res));
25325         C2Tuple_usizeTransactionZ_free(_res_conv);
25326 }
25327
25328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25329         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
25330         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25331         if (_res_constr.datalen > 0)
25332                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
25333         else
25334                 _res_constr.data = NULL;
25335         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25336         for (size_t c = 0; c < _res_constr.datalen; c++) {
25337                 int64_t _res_conv_28 = _res_vals[c];
25338                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
25339                 CHECK_ACCESS(_res_conv_28_ptr);
25340                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
25341                 FREE(untag_ptr(_res_conv_28));
25342                 _res_constr.data[c] = _res_conv_28_conv;
25343         }
25344         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25345         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
25346 }
25347
25348 static inline uint64_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
25349         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
25350         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(arg);
25351         return tag_ptr(ret_conv, true);
25352 }
25353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25354         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(arg);
25355         int64_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
25356         return ret_conv;
25357 }
25358
25359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25360         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(orig);
25361         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
25362         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(orig_conv);
25363         return tag_ptr(ret_conv, true);
25364 }
25365
25366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int32_t b, int64_t c) {
25367         LDKThirtyTwoBytes a_ref;
25368         CHECK((*env)->GetArrayLength(env, a) == 32);
25369         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
25370         void* c_ptr = untag_ptr(c);
25371         CHECK_ACCESS(c_ptr);
25372         LDKCOption_ThirtyTwoBytesZ c_conv = *(LDKCOption_ThirtyTwoBytesZ*)(c_ptr);
25373         c_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(c));
25374         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
25375         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(a_ref, b, c_conv);
25376         return tag_ptr(ret_conv, true);
25377 }
25378
25379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25380         if (!ptr_is_owned(_res)) return;
25381         void* _res_ptr = untag_ptr(_res);
25382         CHECK_ACCESS(_res_ptr);
25383         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_ptr);
25384         FREE(untag_ptr(_res));
25385         C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(_res_conv);
25386 }
25387
25388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25389         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ _res_constr;
25390         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25391         if (_res_constr.datalen > 0)
25392                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
25393         else
25394                 _res_constr.data = NULL;
25395         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25396         for (size_t c = 0; c < _res_constr.datalen; c++) {
25397                 int64_t _res_conv_54 = _res_vals[c];
25398                 void* _res_conv_54_ptr = untag_ptr(_res_conv_54);
25399                 CHECK_ACCESS(_res_conv_54_ptr);
25400                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_conv_54_ptr);
25401                 FREE(untag_ptr(_res_conv_54));
25402                 _res_constr.data[c] = _res_conv_54_conv;
25403         }
25404         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25405         CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(_res_constr);
25406 }
25407
25408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
25409         LDKChannelMonitorUpdateStatus o_conv = LDKChannelMonitorUpdateStatus_from_java(env, o);
25410         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
25411         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_ok(o_conv);
25412         return tag_ptr(ret_conv, true);
25413 }
25414
25415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1err(JNIEnv *env, jclass clz) {
25416         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
25417         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_err();
25418         return tag_ptr(ret_conv, true);
25419 }
25420
25421 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25422         LDKCResult_ChannelMonitorUpdateStatusNoneZ* o_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(o);
25423         jboolean ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o_conv);
25424         return ret_conv;
25425 }
25426
25427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25428         if (!ptr_is_owned(_res)) return;
25429         void* _res_ptr = untag_ptr(_res);
25430         CHECK_ACCESS(_res_ptr);
25431         LDKCResult_ChannelMonitorUpdateStatusNoneZ _res_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(_res_ptr);
25432         FREE(untag_ptr(_res));
25433         CResult_ChannelMonitorUpdateStatusNoneZ_free(_res_conv);
25434 }
25435
25436 static inline uint64_t CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR arg) {
25437         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
25438         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(arg);
25439         return tag_ptr(ret_conv, true);
25440 }
25441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25442         LDKCResult_ChannelMonitorUpdateStatusNoneZ* arg_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(arg);
25443         int64_t ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(arg_conv);
25444         return ret_conv;
25445 }
25446
25447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25448         LDKCResult_ChannelMonitorUpdateStatusNoneZ* orig_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(orig);
25449         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
25450         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig_conv);
25451         return tag_ptr(ret_conv, true);
25452 }
25453
25454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25455         LDKCVec_MonitorEventZ _res_constr;
25456         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25457         if (_res_constr.datalen > 0)
25458                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
25459         else
25460                 _res_constr.data = NULL;
25461         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25462         for (size_t o = 0; o < _res_constr.datalen; o++) {
25463                 int64_t _res_conv_14 = _res_vals[o];
25464                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
25465                 CHECK_ACCESS(_res_conv_14_ptr);
25466                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
25467                 FREE(untag_ptr(_res_conv_14));
25468                 _res_constr.data[o] = _res_conv_14_conv;
25469         }
25470         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25471         CVec_MonitorEventZ_free(_res_constr);
25472 }
25473
25474 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
25475         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
25476         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
25477         return tag_ptr(ret_conv, true);
25478 }
25479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25480         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
25481         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
25482         return ret_conv;
25483 }
25484
25485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25486         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
25487         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
25488         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
25489         return tag_ptr(ret_conv, true);
25490 }
25491
25492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b, int8_tArray c) {
25493         LDKOutPoint a_conv;
25494         a_conv.inner = untag_ptr(a);
25495         a_conv.is_owned = ptr_is_owned(a);
25496         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25497         a_conv = OutPoint_clone(&a_conv);
25498         LDKCVec_MonitorEventZ b_constr;
25499         b_constr.datalen = (*env)->GetArrayLength(env, b);
25500         if (b_constr.datalen > 0)
25501                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
25502         else
25503                 b_constr.data = NULL;
25504         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
25505         for (size_t o = 0; o < b_constr.datalen; o++) {
25506                 int64_t b_conv_14 = b_vals[o];
25507                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
25508                 CHECK_ACCESS(b_conv_14_ptr);
25509                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
25510                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
25511                 b_constr.data[o] = b_conv_14_conv;
25512         }
25513         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
25514         LDKPublicKey c_ref;
25515         CHECK((*env)->GetArrayLength(env, c) == 33);
25516         (*env)->GetByteArrayRegion(env, c, 0, 33, c_ref.compressed_form);
25517         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
25518         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
25519         return tag_ptr(ret_conv, true);
25520 }
25521
25522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25523         if (!ptr_is_owned(_res)) return;
25524         void* _res_ptr = untag_ptr(_res);
25525         CHECK_ACCESS(_res_ptr);
25526         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
25527         FREE(untag_ptr(_res));
25528         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
25529 }
25530
25531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25532         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
25533         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25534         if (_res_constr.datalen > 0)
25535                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
25536         else
25537                 _res_constr.data = NULL;
25538         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25539         for (size_t x = 0; x < _res_constr.datalen; x++) {
25540                 int64_t _res_conv_49 = _res_vals[x];
25541                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
25542                 CHECK_ACCESS(_res_conv_49_ptr);
25543                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
25544                 FREE(untag_ptr(_res_conv_49));
25545                 _res_constr.data[x] = _res_conv_49_conv;
25546         }
25547         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25548         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
25549 }
25550
25551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25552         LDKInitFeatures o_conv;
25553         o_conv.inner = untag_ptr(o);
25554         o_conv.is_owned = ptr_is_owned(o);
25555         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25556         o_conv = InitFeatures_clone(&o_conv);
25557         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
25558         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
25559         return tag_ptr(ret_conv, true);
25560 }
25561
25562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25563         void* e_ptr = untag_ptr(e);
25564         CHECK_ACCESS(e_ptr);
25565         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25566         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25567         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
25568         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
25569         return tag_ptr(ret_conv, true);
25570 }
25571
25572 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25573         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
25574         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
25575         return ret_conv;
25576 }
25577
25578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25579         if (!ptr_is_owned(_res)) return;
25580         void* _res_ptr = untag_ptr(_res);
25581         CHECK_ACCESS(_res_ptr);
25582         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
25583         FREE(untag_ptr(_res));
25584         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
25585 }
25586
25587 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
25588         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
25589         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
25590         return tag_ptr(ret_conv, true);
25591 }
25592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25593         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
25594         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
25595         return ret_conv;
25596 }
25597
25598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25599         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
25600         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
25601         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
25602         return tag_ptr(ret_conv, true);
25603 }
25604
25605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25606         LDKChannelFeatures o_conv;
25607         o_conv.inner = untag_ptr(o);
25608         o_conv.is_owned = ptr_is_owned(o);
25609         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25610         o_conv = ChannelFeatures_clone(&o_conv);
25611         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
25612         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
25613         return tag_ptr(ret_conv, true);
25614 }
25615
25616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25617         void* e_ptr = untag_ptr(e);
25618         CHECK_ACCESS(e_ptr);
25619         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25620         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25621         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
25622         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
25623         return tag_ptr(ret_conv, true);
25624 }
25625
25626 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25627         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
25628         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
25629         return ret_conv;
25630 }
25631
25632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25633         if (!ptr_is_owned(_res)) return;
25634         void* _res_ptr = untag_ptr(_res);
25635         CHECK_ACCESS(_res_ptr);
25636         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
25637         FREE(untag_ptr(_res));
25638         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
25639 }
25640
25641 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
25642         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
25643         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
25644         return tag_ptr(ret_conv, true);
25645 }
25646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25647         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
25648         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
25649         return ret_conv;
25650 }
25651
25652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25653         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
25654         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
25655         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
25656         return tag_ptr(ret_conv, true);
25657 }
25658
25659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25660         LDKNodeFeatures o_conv;
25661         o_conv.inner = untag_ptr(o);
25662         o_conv.is_owned = ptr_is_owned(o);
25663         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25664         o_conv = NodeFeatures_clone(&o_conv);
25665         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
25666         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
25667         return tag_ptr(ret_conv, true);
25668 }
25669
25670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25671         void* e_ptr = untag_ptr(e);
25672         CHECK_ACCESS(e_ptr);
25673         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25674         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25675         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
25676         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
25677         return tag_ptr(ret_conv, true);
25678 }
25679
25680 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25681         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
25682         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
25683         return ret_conv;
25684 }
25685
25686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25687         if (!ptr_is_owned(_res)) return;
25688         void* _res_ptr = untag_ptr(_res);
25689         CHECK_ACCESS(_res_ptr);
25690         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
25691         FREE(untag_ptr(_res));
25692         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
25693 }
25694
25695 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
25696         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
25697         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
25698         return tag_ptr(ret_conv, true);
25699 }
25700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25701         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
25702         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
25703         return ret_conv;
25704 }
25705
25706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25707         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
25708         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
25709         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
25710         return tag_ptr(ret_conv, true);
25711 }
25712
25713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25714         LDKBolt11InvoiceFeatures o_conv;
25715         o_conv.inner = untag_ptr(o);
25716         o_conv.is_owned = ptr_is_owned(o);
25717         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25718         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
25719         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
25720         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
25721         return tag_ptr(ret_conv, true);
25722 }
25723
25724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25725         void* e_ptr = untag_ptr(e);
25726         CHECK_ACCESS(e_ptr);
25727         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25728         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25729         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
25730         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
25731         return tag_ptr(ret_conv, true);
25732 }
25733
25734 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25735         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
25736         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
25737         return ret_conv;
25738 }
25739
25740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25741         if (!ptr_is_owned(_res)) return;
25742         void* _res_ptr = untag_ptr(_res);
25743         CHECK_ACCESS(_res_ptr);
25744         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
25745         FREE(untag_ptr(_res));
25746         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
25747 }
25748
25749 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
25750         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
25751         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
25752         return tag_ptr(ret_conv, true);
25753 }
25754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25755         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
25756         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
25757         return ret_conv;
25758 }
25759
25760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25761         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
25762         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
25763         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
25764         return tag_ptr(ret_conv, true);
25765 }
25766
25767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25768         LDKBolt12InvoiceFeatures o_conv;
25769         o_conv.inner = untag_ptr(o);
25770         o_conv.is_owned = ptr_is_owned(o);
25771         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25772         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
25773         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
25774         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
25775         return tag_ptr(ret_conv, true);
25776 }
25777
25778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25779         void* e_ptr = untag_ptr(e);
25780         CHECK_ACCESS(e_ptr);
25781         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25782         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25783         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
25784         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
25785         return tag_ptr(ret_conv, true);
25786 }
25787
25788 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25789         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
25790         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
25791         return ret_conv;
25792 }
25793
25794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25795         if (!ptr_is_owned(_res)) return;
25796         void* _res_ptr = untag_ptr(_res);
25797         CHECK_ACCESS(_res_ptr);
25798         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
25799         FREE(untag_ptr(_res));
25800         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
25801 }
25802
25803 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
25804         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
25805         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
25806         return tag_ptr(ret_conv, true);
25807 }
25808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25809         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
25810         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
25811         return ret_conv;
25812 }
25813
25814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25815         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
25816         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
25817         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
25818         return tag_ptr(ret_conv, true);
25819 }
25820
25821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25822         LDKBlindedHopFeatures o_conv;
25823         o_conv.inner = untag_ptr(o);
25824         o_conv.is_owned = ptr_is_owned(o);
25825         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25826         o_conv = BlindedHopFeatures_clone(&o_conv);
25827         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
25828         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
25829         return tag_ptr(ret_conv, true);
25830 }
25831
25832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25833         void* e_ptr = untag_ptr(e);
25834         CHECK_ACCESS(e_ptr);
25835         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25836         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25837         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
25838         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
25839         return tag_ptr(ret_conv, true);
25840 }
25841
25842 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25843         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
25844         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
25845         return ret_conv;
25846 }
25847
25848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25849         if (!ptr_is_owned(_res)) return;
25850         void* _res_ptr = untag_ptr(_res);
25851         CHECK_ACCESS(_res_ptr);
25852         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
25853         FREE(untag_ptr(_res));
25854         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
25855 }
25856
25857 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
25858         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
25859         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
25860         return tag_ptr(ret_conv, true);
25861 }
25862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25863         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
25864         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
25865         return ret_conv;
25866 }
25867
25868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25869         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
25870         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
25871         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
25872         return tag_ptr(ret_conv, true);
25873 }
25874
25875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25876         LDKChannelTypeFeatures o_conv;
25877         o_conv.inner = untag_ptr(o);
25878         o_conv.is_owned = ptr_is_owned(o);
25879         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25880         o_conv = ChannelTypeFeatures_clone(&o_conv);
25881         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
25882         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
25883         return tag_ptr(ret_conv, true);
25884 }
25885
25886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25887         void* e_ptr = untag_ptr(e);
25888         CHECK_ACCESS(e_ptr);
25889         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25890         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25891         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
25892         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
25893         return tag_ptr(ret_conv, true);
25894 }
25895
25896 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25897         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
25898         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
25899         return ret_conv;
25900 }
25901
25902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25903         if (!ptr_is_owned(_res)) return;
25904         void* _res_ptr = untag_ptr(_res);
25905         CHECK_ACCESS(_res_ptr);
25906         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
25907         FREE(untag_ptr(_res));
25908         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
25909 }
25910
25911 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
25912         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
25913         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
25914         return tag_ptr(ret_conv, true);
25915 }
25916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25917         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
25918         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
25919         return ret_conv;
25920 }
25921
25922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25923         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
25924         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
25925         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
25926         return tag_ptr(ret_conv, true);
25927 }
25928
25929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25930         LDKOffer o_conv;
25931         o_conv.inner = untag_ptr(o);
25932         o_conv.is_owned = ptr_is_owned(o);
25933         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25934         o_conv = Offer_clone(&o_conv);
25935         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
25936         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
25937         return tag_ptr(ret_conv, true);
25938 }
25939
25940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25941         LDKBolt12ParseError e_conv;
25942         e_conv.inner = untag_ptr(e);
25943         e_conv.is_owned = ptr_is_owned(e);
25944         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
25945         e_conv = Bolt12ParseError_clone(&e_conv);
25946         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
25947         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
25948         return tag_ptr(ret_conv, true);
25949 }
25950
25951 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25952         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
25953         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
25954         return ret_conv;
25955 }
25956
25957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25958         if (!ptr_is_owned(_res)) return;
25959         void* _res_ptr = untag_ptr(_res);
25960         CHECK_ACCESS(_res_ptr);
25961         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
25962         FREE(untag_ptr(_res));
25963         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
25964 }
25965
25966 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
25967         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
25968         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
25969         return tag_ptr(ret_conv, true);
25970 }
25971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25972         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
25973         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
25974         return ret_conv;
25975 }
25976
25977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25978         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
25979         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
25980         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
25981         return tag_ptr(ret_conv, true);
25982 }
25983
25984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25985         LDKPublicKey o_ref;
25986         CHECK((*env)->GetArrayLength(env, o) == 33);
25987         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
25988         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
25989         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_ok(o_ref);
25990         return tag_ptr(ret_conv, true);
25991 }
25992
25993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
25994         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
25995         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
25996         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_err(e_conv);
25997         return tag_ptr(ret_conv, true);
25998 }
25999
26000 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26001         LDKCResult_PublicKeySecp256k1ErrorZ* o_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(o);
26002         jboolean ret_conv = CResult_PublicKeySecp256k1ErrorZ_is_ok(o_conv);
26003         return ret_conv;
26004 }
26005
26006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26007         if (!ptr_is_owned(_res)) return;
26008         void* _res_ptr = untag_ptr(_res);
26009         CHECK_ACCESS(_res_ptr);
26010         LDKCResult_PublicKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(_res_ptr);
26011         FREE(untag_ptr(_res));
26012         CResult_PublicKeySecp256k1ErrorZ_free(_res_conv);
26013 }
26014
26015 static inline uint64_t CResult_PublicKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR arg) {
26016         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
26017         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(arg);
26018         return tag_ptr(ret_conv, true);
26019 }
26020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26021         LDKCResult_PublicKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(arg);
26022         int64_t ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone_ptr(arg_conv);
26023         return ret_conv;
26024 }
26025
26026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26027         LDKCResult_PublicKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(orig);
26028         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
26029         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(orig_conv);
26030         return tag_ptr(ret_conv, true);
26031 }
26032
26033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26034         LDKNodeId o_conv;
26035         o_conv.inner = untag_ptr(o);
26036         o_conv.is_owned = ptr_is_owned(o);
26037         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26038         o_conv = NodeId_clone(&o_conv);
26039         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
26040         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
26041         return tag_ptr(ret_conv, true);
26042 }
26043
26044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26045         void* e_ptr = untag_ptr(e);
26046         CHECK_ACCESS(e_ptr);
26047         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26048         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26049         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
26050         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
26051         return tag_ptr(ret_conv, true);
26052 }
26053
26054 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26055         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
26056         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
26057         return ret_conv;
26058 }
26059
26060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26061         if (!ptr_is_owned(_res)) return;
26062         void* _res_ptr = untag_ptr(_res);
26063         CHECK_ACCESS(_res_ptr);
26064         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
26065         FREE(untag_ptr(_res));
26066         CResult_NodeIdDecodeErrorZ_free(_res_conv);
26067 }
26068
26069 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
26070         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
26071         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
26072         return tag_ptr(ret_conv, true);
26073 }
26074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26075         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
26076         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
26077         return ret_conv;
26078 }
26079
26080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26081         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
26082         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
26083         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
26084         return tag_ptr(ret_conv, true);
26085 }
26086
26087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26088         void* o_ptr = untag_ptr(o);
26089         CHECK_ACCESS(o_ptr);
26090         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
26091         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
26092         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
26093         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
26094         int64_t ret_ref = tag_ptr(ret_copy, true);
26095         return ret_ref;
26096 }
26097
26098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
26099         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
26100         *ret_copy = COption_NetworkUpdateZ_none();
26101         int64_t ret_ref = tag_ptr(ret_copy, true);
26102         return ret_ref;
26103 }
26104
26105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26106         if (!ptr_is_owned(_res)) return;
26107         void* _res_ptr = untag_ptr(_res);
26108         CHECK_ACCESS(_res_ptr);
26109         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
26110         FREE(untag_ptr(_res));
26111         COption_NetworkUpdateZ_free(_res_conv);
26112 }
26113
26114 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
26115         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
26116         *ret_copy = COption_NetworkUpdateZ_clone(arg);
26117         int64_t ret_ref = tag_ptr(ret_copy, true);
26118         return ret_ref;
26119 }
26120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26121         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
26122         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
26123         return ret_conv;
26124 }
26125
26126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26127         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
26128         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
26129         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
26130         int64_t ret_ref = tag_ptr(ret_copy, true);
26131         return ret_ref;
26132 }
26133
26134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26135         void* o_ptr = untag_ptr(o);
26136         CHECK_ACCESS(o_ptr);
26137         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
26138         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
26139         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
26140         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
26141         return tag_ptr(ret_conv, true);
26142 }
26143
26144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26145         void* e_ptr = untag_ptr(e);
26146         CHECK_ACCESS(e_ptr);
26147         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26148         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26149         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
26150         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
26151         return tag_ptr(ret_conv, true);
26152 }
26153
26154 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26155         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
26156         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
26157         return ret_conv;
26158 }
26159
26160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26161         if (!ptr_is_owned(_res)) return;
26162         void* _res_ptr = untag_ptr(_res);
26163         CHECK_ACCESS(_res_ptr);
26164         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
26165         FREE(untag_ptr(_res));
26166         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
26167 }
26168
26169 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
26170         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
26171         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
26172         return tag_ptr(ret_conv, true);
26173 }
26174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26175         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
26176         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
26177         return ret_conv;
26178 }
26179
26180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26181         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
26182         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
26183         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
26184         return tag_ptr(ret_conv, true);
26185 }
26186
26187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26188         void* o_ptr = untag_ptr(o);
26189         CHECK_ACCESS(o_ptr);
26190         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
26191         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
26192                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26193                 LDKUtxoLookup_JCalls_cloned(&o_conv);
26194         }
26195         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
26196         *ret_copy = COption_UtxoLookupZ_some(o_conv);
26197         int64_t ret_ref = tag_ptr(ret_copy, true);
26198         return ret_ref;
26199 }
26200
26201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1none(JNIEnv *env, jclass clz) {
26202         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
26203         *ret_copy = COption_UtxoLookupZ_none();
26204         int64_t ret_ref = tag_ptr(ret_copy, true);
26205         return ret_ref;
26206 }
26207
26208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26209         if (!ptr_is_owned(_res)) return;
26210         void* _res_ptr = untag_ptr(_res);
26211         CHECK_ACCESS(_res_ptr);
26212         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
26213         FREE(untag_ptr(_res));
26214         COption_UtxoLookupZ_free(_res_conv);
26215 }
26216
26217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
26218         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
26219         *ret_conv = CResult_NoneLightningErrorZ_ok();
26220         return tag_ptr(ret_conv, true);
26221 }
26222
26223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26224         LDKLightningError e_conv;
26225         e_conv.inner = untag_ptr(e);
26226         e_conv.is_owned = ptr_is_owned(e);
26227         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26228         e_conv = LightningError_clone(&e_conv);
26229         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
26230         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
26231         return tag_ptr(ret_conv, true);
26232 }
26233
26234 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26235         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
26236         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
26237         return ret_conv;
26238 }
26239
26240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26241         if (!ptr_is_owned(_res)) return;
26242         void* _res_ptr = untag_ptr(_res);
26243         CHECK_ACCESS(_res_ptr);
26244         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
26245         FREE(untag_ptr(_res));
26246         CResult_NoneLightningErrorZ_free(_res_conv);
26247 }
26248
26249 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
26250         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
26251         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
26252         return tag_ptr(ret_conv, true);
26253 }
26254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26255         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
26256         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
26257         return ret_conv;
26258 }
26259
26260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26261         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
26262         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
26263         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
26264         return tag_ptr(ret_conv, true);
26265 }
26266
26267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
26268         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
26269         *ret_conv = CResult_boolLightningErrorZ_ok(o);
26270         return tag_ptr(ret_conv, true);
26271 }
26272
26273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26274         LDKLightningError e_conv;
26275         e_conv.inner = untag_ptr(e);
26276         e_conv.is_owned = ptr_is_owned(e);
26277         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26278         e_conv = LightningError_clone(&e_conv);
26279         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
26280         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
26281         return tag_ptr(ret_conv, true);
26282 }
26283
26284 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26285         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
26286         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
26287         return ret_conv;
26288 }
26289
26290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26291         if (!ptr_is_owned(_res)) return;
26292         void* _res_ptr = untag_ptr(_res);
26293         CHECK_ACCESS(_res_ptr);
26294         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
26295         FREE(untag_ptr(_res));
26296         CResult_boolLightningErrorZ_free(_res_conv);
26297 }
26298
26299 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
26300         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
26301         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
26302         return tag_ptr(ret_conv, true);
26303 }
26304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26305         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
26306         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
26307         return ret_conv;
26308 }
26309
26310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26311         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
26312         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
26313         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
26314         return tag_ptr(ret_conv, true);
26315 }
26316
26317 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
26318         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
26319         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
26320         return tag_ptr(ret_conv, true);
26321 }
26322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26323         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
26324         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
26325         return ret_conv;
26326 }
26327
26328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26329         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
26330         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
26331         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
26332         return tag_ptr(ret_conv, true);
26333 }
26334
26335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_t c) {
26336         LDKChannelAnnouncement a_conv;
26337         a_conv.inner = untag_ptr(a);
26338         a_conv.is_owned = ptr_is_owned(a);
26339         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26340         a_conv = ChannelAnnouncement_clone(&a_conv);
26341         LDKChannelUpdate b_conv;
26342         b_conv.inner = untag_ptr(b);
26343         b_conv.is_owned = ptr_is_owned(b);
26344         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26345         b_conv = ChannelUpdate_clone(&b_conv);
26346         LDKChannelUpdate c_conv;
26347         c_conv.inner = untag_ptr(c);
26348         c_conv.is_owned = ptr_is_owned(c);
26349         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
26350         c_conv = ChannelUpdate_clone(&c_conv);
26351         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
26352         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
26353         return tag_ptr(ret_conv, true);
26354 }
26355
26356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26357         if (!ptr_is_owned(_res)) return;
26358         void* _res_ptr = untag_ptr(_res);
26359         CHECK_ACCESS(_res_ptr);
26360         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
26361         FREE(untag_ptr(_res));
26362         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
26363 }
26364
26365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26366         void* o_ptr = untag_ptr(o);
26367         CHECK_ACCESS(o_ptr);
26368         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
26369         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
26370         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
26371         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
26372         int64_t ret_ref = tag_ptr(ret_copy, true);
26373         return ret_ref;
26374 }
26375
26376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1none(JNIEnv *env, jclass clz) {
26377         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
26378         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
26379         int64_t ret_ref = tag_ptr(ret_copy, true);
26380         return ret_ref;
26381 }
26382
26383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26384         if (!ptr_is_owned(_res)) return;
26385         void* _res_ptr = untag_ptr(_res);
26386         CHECK_ACCESS(_res_ptr);
26387         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
26388         FREE(untag_ptr(_res));
26389         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
26390 }
26391
26392 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
26393         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
26394         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
26395         int64_t ret_ref = tag_ptr(ret_copy, true);
26396         return ret_ref;
26397 }
26398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26399         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
26400         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
26401         return ret_conv;
26402 }
26403
26404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26405         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
26406         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
26407         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
26408         int64_t ret_ref = tag_ptr(ret_copy, true);
26409         return ret_ref;
26410 }
26411
26412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26413         LDKCVec_MessageSendEventZ _res_constr;
26414         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26415         if (_res_constr.datalen > 0)
26416                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
26417         else
26418                 _res_constr.data = NULL;
26419         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26420         for (size_t s = 0; s < _res_constr.datalen; s++) {
26421                 int64_t _res_conv_18 = _res_vals[s];
26422                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
26423                 CHECK_ACCESS(_res_conv_18_ptr);
26424                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
26425                 FREE(untag_ptr(_res_conv_18));
26426                 _res_constr.data[s] = _res_conv_18_conv;
26427         }
26428         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26429         CVec_MessageSendEventZ_free(_res_constr);
26430 }
26431
26432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26433         LDKChannelUpdateInfo o_conv;
26434         o_conv.inner = untag_ptr(o);
26435         o_conv.is_owned = ptr_is_owned(o);
26436         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26437         o_conv = ChannelUpdateInfo_clone(&o_conv);
26438         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
26439         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
26440         return tag_ptr(ret_conv, true);
26441 }
26442
26443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26444         void* e_ptr = untag_ptr(e);
26445         CHECK_ACCESS(e_ptr);
26446         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26447         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26448         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
26449         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
26450         return tag_ptr(ret_conv, true);
26451 }
26452
26453 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26454         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
26455         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
26456         return ret_conv;
26457 }
26458
26459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26460         if (!ptr_is_owned(_res)) return;
26461         void* _res_ptr = untag_ptr(_res);
26462         CHECK_ACCESS(_res_ptr);
26463         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
26464         FREE(untag_ptr(_res));
26465         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
26466 }
26467
26468 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
26469         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
26470         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
26471         return tag_ptr(ret_conv, true);
26472 }
26473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26474         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
26475         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
26476         return ret_conv;
26477 }
26478
26479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26480         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
26481         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
26482         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
26483         return tag_ptr(ret_conv, true);
26484 }
26485
26486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26487         LDKChannelInfo o_conv;
26488         o_conv.inner = untag_ptr(o);
26489         o_conv.is_owned = ptr_is_owned(o);
26490         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26491         o_conv = ChannelInfo_clone(&o_conv);
26492         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
26493         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
26494         return tag_ptr(ret_conv, true);
26495 }
26496
26497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26498         void* e_ptr = untag_ptr(e);
26499         CHECK_ACCESS(e_ptr);
26500         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26501         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26502         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
26503         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
26504         return tag_ptr(ret_conv, true);
26505 }
26506
26507 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26508         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
26509         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
26510         return ret_conv;
26511 }
26512
26513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26514         if (!ptr_is_owned(_res)) return;
26515         void* _res_ptr = untag_ptr(_res);
26516         CHECK_ACCESS(_res_ptr);
26517         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
26518         FREE(untag_ptr(_res));
26519         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
26520 }
26521
26522 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
26523         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
26524         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
26525         return tag_ptr(ret_conv, true);
26526 }
26527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26528         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
26529         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
26530         return ret_conv;
26531 }
26532
26533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26534         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
26535         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
26536         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
26537         return tag_ptr(ret_conv, true);
26538 }
26539
26540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26541         LDKRoutingFees o_conv;
26542         o_conv.inner = untag_ptr(o);
26543         o_conv.is_owned = ptr_is_owned(o);
26544         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26545         o_conv = RoutingFees_clone(&o_conv);
26546         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
26547         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
26548         return tag_ptr(ret_conv, true);
26549 }
26550
26551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26552         void* e_ptr = untag_ptr(e);
26553         CHECK_ACCESS(e_ptr);
26554         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26555         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26556         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
26557         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
26558         return tag_ptr(ret_conv, true);
26559 }
26560
26561 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26562         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
26563         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
26564         return ret_conv;
26565 }
26566
26567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26568         if (!ptr_is_owned(_res)) return;
26569         void* _res_ptr = untag_ptr(_res);
26570         CHECK_ACCESS(_res_ptr);
26571         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
26572         FREE(untag_ptr(_res));
26573         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
26574 }
26575
26576 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
26577         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
26578         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
26579         return tag_ptr(ret_conv, true);
26580 }
26581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26582         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
26583         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
26584         return ret_conv;
26585 }
26586
26587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26588         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
26589         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
26590         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
26591         return tag_ptr(ret_conv, true);
26592 }
26593
26594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SocketAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26595         LDKCVec_SocketAddressZ _res_constr;
26596         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26597         if (_res_constr.datalen > 0)
26598                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
26599         else
26600                 _res_constr.data = NULL;
26601         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26602         for (size_t p = 0; p < _res_constr.datalen; p++) {
26603                 int64_t _res_conv_15 = _res_vals[p];
26604                 void* _res_conv_15_ptr = untag_ptr(_res_conv_15);
26605                 CHECK_ACCESS(_res_conv_15_ptr);
26606                 LDKSocketAddress _res_conv_15_conv = *(LDKSocketAddress*)(_res_conv_15_ptr);
26607                 FREE(untag_ptr(_res_conv_15));
26608                 _res_constr.data[p] = _res_conv_15_conv;
26609         }
26610         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26611         CVec_SocketAddressZ_free(_res_constr);
26612 }
26613
26614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26615         LDKNodeAnnouncementInfo o_conv;
26616         o_conv.inner = untag_ptr(o);
26617         o_conv.is_owned = ptr_is_owned(o);
26618         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26619         o_conv = NodeAnnouncementInfo_clone(&o_conv);
26620         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
26621         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
26622         return tag_ptr(ret_conv, true);
26623 }
26624
26625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26626         void* e_ptr = untag_ptr(e);
26627         CHECK_ACCESS(e_ptr);
26628         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26629         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26630         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
26631         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
26632         return tag_ptr(ret_conv, true);
26633 }
26634
26635 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26636         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
26637         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
26638         return ret_conv;
26639 }
26640
26641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26642         if (!ptr_is_owned(_res)) return;
26643         void* _res_ptr = untag_ptr(_res);
26644         CHECK_ACCESS(_res_ptr);
26645         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
26646         FREE(untag_ptr(_res));
26647         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
26648 }
26649
26650 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
26651         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
26652         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
26653         return tag_ptr(ret_conv, true);
26654 }
26655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26656         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
26657         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
26658         return ret_conv;
26659 }
26660
26661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26662         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
26663         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
26664         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
26665         return tag_ptr(ret_conv, true);
26666 }
26667
26668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26669         LDKNodeAlias o_conv;
26670         o_conv.inner = untag_ptr(o);
26671         o_conv.is_owned = ptr_is_owned(o);
26672         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26673         o_conv = NodeAlias_clone(&o_conv);
26674         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
26675         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
26676         return tag_ptr(ret_conv, true);
26677 }
26678
26679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26680         void* e_ptr = untag_ptr(e);
26681         CHECK_ACCESS(e_ptr);
26682         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26683         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26684         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
26685         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
26686         return tag_ptr(ret_conv, true);
26687 }
26688
26689 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26690         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
26691         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
26692         return ret_conv;
26693 }
26694
26695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26696         if (!ptr_is_owned(_res)) return;
26697         void* _res_ptr = untag_ptr(_res);
26698         CHECK_ACCESS(_res_ptr);
26699         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
26700         FREE(untag_ptr(_res));
26701         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
26702 }
26703
26704 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
26705         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
26706         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
26707         return tag_ptr(ret_conv, true);
26708 }
26709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26710         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
26711         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
26712         return ret_conv;
26713 }
26714
26715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26716         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
26717         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
26718         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
26719         return tag_ptr(ret_conv, true);
26720 }
26721
26722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26723         LDKNodeInfo o_conv;
26724         o_conv.inner = untag_ptr(o);
26725         o_conv.is_owned = ptr_is_owned(o);
26726         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26727         o_conv = NodeInfo_clone(&o_conv);
26728         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
26729         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
26730         return tag_ptr(ret_conv, true);
26731 }
26732
26733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26734         void* e_ptr = untag_ptr(e);
26735         CHECK_ACCESS(e_ptr);
26736         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26737         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26738         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
26739         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
26740         return tag_ptr(ret_conv, true);
26741 }
26742
26743 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26744         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
26745         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
26746         return ret_conv;
26747 }
26748
26749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26750         if (!ptr_is_owned(_res)) return;
26751         void* _res_ptr = untag_ptr(_res);
26752         CHECK_ACCESS(_res_ptr);
26753         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
26754         FREE(untag_ptr(_res));
26755         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
26756 }
26757
26758 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
26759         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
26760         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
26761         return tag_ptr(ret_conv, true);
26762 }
26763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26764         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
26765         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
26766         return ret_conv;
26767 }
26768
26769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26770         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
26771         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
26772         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
26773         return tag_ptr(ret_conv, true);
26774 }
26775
26776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26777         LDKNetworkGraph o_conv;
26778         o_conv.inner = untag_ptr(o);
26779         o_conv.is_owned = ptr_is_owned(o);
26780         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26781         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
26782         
26783         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
26784         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
26785         return tag_ptr(ret_conv, true);
26786 }
26787
26788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26789         void* e_ptr = untag_ptr(e);
26790         CHECK_ACCESS(e_ptr);
26791         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26792         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26793         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
26794         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
26795         return tag_ptr(ret_conv, true);
26796 }
26797
26798 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26799         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
26800         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
26801         return ret_conv;
26802 }
26803
26804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26805         if (!ptr_is_owned(_res)) return;
26806         void* _res_ptr = untag_ptr(_res);
26807         CHECK_ACCESS(_res_ptr);
26808         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
26809         FREE(untag_ptr(_res));
26810         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
26811 }
26812
26813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
26814         LDKCVec_SocketAddressZ o_constr;
26815         o_constr.datalen = (*env)->GetArrayLength(env, o);
26816         if (o_constr.datalen > 0)
26817                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
26818         else
26819                 o_constr.data = NULL;
26820         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
26821         for (size_t p = 0; p < o_constr.datalen; p++) {
26822                 int64_t o_conv_15 = o_vals[p];
26823                 void* o_conv_15_ptr = untag_ptr(o_conv_15);
26824                 CHECK_ACCESS(o_conv_15_ptr);
26825                 LDKSocketAddress o_conv_15_conv = *(LDKSocketAddress*)(o_conv_15_ptr);
26826                 o_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o_conv_15));
26827                 o_constr.data[p] = o_conv_15_conv;
26828         }
26829         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
26830         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
26831         *ret_copy = COption_CVec_SocketAddressZZ_some(o_constr);
26832         int64_t ret_ref = tag_ptr(ret_copy, true);
26833         return ret_ref;
26834 }
26835
26836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1none(JNIEnv *env, jclass clz) {
26837         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
26838         *ret_copy = COption_CVec_SocketAddressZZ_none();
26839         int64_t ret_ref = tag_ptr(ret_copy, true);
26840         return ret_ref;
26841 }
26842
26843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26844         if (!ptr_is_owned(_res)) return;
26845         void* _res_ptr = untag_ptr(_res);
26846         CHECK_ACCESS(_res_ptr);
26847         LDKCOption_CVec_SocketAddressZZ _res_conv = *(LDKCOption_CVec_SocketAddressZZ*)(_res_ptr);
26848         FREE(untag_ptr(_res));
26849         COption_CVec_SocketAddressZZ_free(_res_conv);
26850 }
26851
26852 static inline uint64_t COption_CVec_SocketAddressZZ_clone_ptr(LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR arg) {
26853         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
26854         *ret_copy = COption_CVec_SocketAddressZZ_clone(arg);
26855         int64_t ret_ref = tag_ptr(ret_copy, true);
26856         return ret_ref;
26857 }
26858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26859         LDKCOption_CVec_SocketAddressZZ* arg_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(arg);
26860         int64_t ret_conv = COption_CVec_SocketAddressZZ_clone_ptr(arg_conv);
26861         return ret_conv;
26862 }
26863
26864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26865         LDKCOption_CVec_SocketAddressZZ* orig_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(orig);
26866         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
26867         *ret_copy = COption_CVec_SocketAddressZZ_clone(orig_conv);
26868         int64_t ret_ref = tag_ptr(ret_copy, true);
26869         return ret_ref;
26870 }
26871
26872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26873         LDKPendingHTLCInfo o_conv;
26874         o_conv.inner = untag_ptr(o);
26875         o_conv.is_owned = ptr_is_owned(o);
26876         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26877         o_conv = PendingHTLCInfo_clone(&o_conv);
26878         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
26879         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o_conv);
26880         return tag_ptr(ret_conv, true);
26881 }
26882
26883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26884         LDKInboundHTLCErr e_conv;
26885         e_conv.inner = untag_ptr(e);
26886         e_conv.is_owned = ptr_is_owned(e);
26887         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26888         // WARNING: we need a move here but no clone is available for LDKInboundHTLCErr
26889         
26890         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
26891         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_err(e_conv);
26892         return tag_ptr(ret_conv, true);
26893 }
26894
26895 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26896         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* o_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(o);
26897         jboolean ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(o_conv);
26898         return ret_conv;
26899 }
26900
26901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26902         if (!ptr_is_owned(_res)) return;
26903         void* _res_ptr = untag_ptr(_res);
26904         CHECK_ACCESS(_res_ptr);
26905         LDKCResult_PendingHTLCInfoInboundHTLCErrZ _res_conv = *(LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)(_res_ptr);
26906         FREE(untag_ptr(_res));
26907         CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res_conv);
26908 }
26909
26910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26911         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
26912         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26913         if (_res_constr.datalen > 0)
26914                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
26915         else
26916                 _res_constr.data = NULL;
26917         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26918         for (size_t y = 0; y < _res_constr.datalen; y++) {
26919                 int64_t _res_conv_24 = _res_vals[y];
26920                 LDKHTLCOutputInCommitment _res_conv_24_conv;
26921                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
26922                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
26923                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
26924                 _res_constr.data[y] = _res_conv_24_conv;
26925         }
26926         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26927         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
26928 }
26929
26930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26931         LDKCVec_HTLCDescriptorZ _res_constr;
26932         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26933         if (_res_constr.datalen > 0)
26934                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
26935         else
26936                 _res_constr.data = NULL;
26937         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26938         for (size_t q = 0; q < _res_constr.datalen; q++) {
26939                 int64_t _res_conv_16 = _res_vals[q];
26940                 LDKHTLCDescriptor _res_conv_16_conv;
26941                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
26942                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
26943                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
26944                 _res_constr.data[q] = _res_conv_16_conv;
26945         }
26946         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26947         CVec_HTLCDescriptorZ_free(_res_constr);
26948 }
26949
26950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UtxoZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26951         LDKCVec_UtxoZ _res_constr;
26952         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26953         if (_res_constr.datalen > 0)
26954                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
26955         else
26956                 _res_constr.data = NULL;
26957         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26958         for (size_t g = 0; g < _res_constr.datalen; g++) {
26959                 int64_t _res_conv_6 = _res_vals[g];
26960                 LDKUtxo _res_conv_6_conv;
26961                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
26962                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
26963                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
26964                 _res_constr.data[g] = _res_conv_6_conv;
26965         }
26966         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26967         CVec_UtxoZ_free(_res_constr);
26968 }
26969
26970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26971         void* o_ptr = untag_ptr(o);
26972         CHECK_ACCESS(o_ptr);
26973         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
26974         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
26975         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
26976         *ret_copy = COption_TxOutZ_some(o_conv);
26977         int64_t ret_ref = tag_ptr(ret_copy, true);
26978         return ret_ref;
26979 }
26980
26981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1none(JNIEnv *env, jclass clz) {
26982         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
26983         *ret_copy = COption_TxOutZ_none();
26984         int64_t ret_ref = tag_ptr(ret_copy, true);
26985         return ret_ref;
26986 }
26987
26988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26989         if (!ptr_is_owned(_res)) return;
26990         void* _res_ptr = untag_ptr(_res);
26991         CHECK_ACCESS(_res_ptr);
26992         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
26993         FREE(untag_ptr(_res));
26994         COption_TxOutZ_free(_res_conv);
26995 }
26996
26997 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
26998         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
26999         *ret_copy = COption_TxOutZ_clone(arg);
27000         int64_t ret_ref = tag_ptr(ret_copy, true);
27001         return ret_ref;
27002 }
27003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27004         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
27005         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
27006         return ret_conv;
27007 }
27008
27009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27010         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
27011         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
27012         *ret_copy = COption_TxOutZ_clone(orig_conv);
27013         int64_t ret_ref = tag_ptr(ret_copy, true);
27014         return ret_ref;
27015 }
27016
27017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1InputZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27018         LDKCVec_InputZ _res_constr;
27019         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27020         if (_res_constr.datalen > 0)
27021                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
27022         else
27023                 _res_constr.data = NULL;
27024         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27025         for (size_t h = 0; h < _res_constr.datalen; h++) {
27026                 int64_t _res_conv_7 = _res_vals[h];
27027                 LDKInput _res_conv_7_conv;
27028                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
27029                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
27030                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
27031                 _res_constr.data[h] = _res_conv_7_conv;
27032         }
27033         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27034         CVec_InputZ_free(_res_constr);
27035 }
27036
27037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27038         LDKCoinSelection o_conv;
27039         o_conv.inner = untag_ptr(o);
27040         o_conv.is_owned = ptr_is_owned(o);
27041         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27042         o_conv = CoinSelection_clone(&o_conv);
27043         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
27044         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
27045         return tag_ptr(ret_conv, true);
27046 }
27047
27048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1err(JNIEnv *env, jclass clz) {
27049         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
27050         *ret_conv = CResult_CoinSelectionNoneZ_err();
27051         return tag_ptr(ret_conv, true);
27052 }
27053
27054 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27055         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
27056         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
27057         return ret_conv;
27058 }
27059
27060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27061         if (!ptr_is_owned(_res)) return;
27062         void* _res_ptr = untag_ptr(_res);
27063         CHECK_ACCESS(_res_ptr);
27064         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
27065         FREE(untag_ptr(_res));
27066         CResult_CoinSelectionNoneZ_free(_res_conv);
27067 }
27068
27069 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
27070         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
27071         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
27072         return tag_ptr(ret_conv, true);
27073 }
27074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27075         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
27076         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
27077         return ret_conv;
27078 }
27079
27080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27081         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
27082         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
27083         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
27084         return tag_ptr(ret_conv, true);
27085 }
27086
27087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
27088         LDKCVec_UtxoZ o_constr;
27089         o_constr.datalen = (*env)->GetArrayLength(env, o);
27090         if (o_constr.datalen > 0)
27091                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
27092         else
27093                 o_constr.data = NULL;
27094         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
27095         for (size_t g = 0; g < o_constr.datalen; g++) {
27096                 int64_t o_conv_6 = o_vals[g];
27097                 LDKUtxo o_conv_6_conv;
27098                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
27099                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
27100                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
27101                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
27102                 o_constr.data[g] = o_conv_6_conv;
27103         }
27104         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
27105         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
27106         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
27107         return tag_ptr(ret_conv, true);
27108 }
27109
27110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1err(JNIEnv *env, jclass clz) {
27111         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
27112         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
27113         return tag_ptr(ret_conv, true);
27114 }
27115
27116 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27117         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
27118         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
27119         return ret_conv;
27120 }
27121
27122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27123         if (!ptr_is_owned(_res)) return;
27124         void* _res_ptr = untag_ptr(_res);
27125         CHECK_ACCESS(_res_ptr);
27126         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
27127         FREE(untag_ptr(_res));
27128         CResult_CVec_UtxoZNoneZ_free(_res_conv);
27129 }
27130
27131 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
27132         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
27133         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
27134         return tag_ptr(ret_conv, true);
27135 }
27136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27137         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
27138         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
27139         return ret_conv;
27140 }
27141
27142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27143         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
27144         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
27145         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
27146         return tag_ptr(ret_conv, true);
27147 }
27148
27149 static inline uint64_t C2Tuple_u64u16Z_clone_ptr(LDKC2Tuple_u64u16Z *NONNULL_PTR arg) {
27150         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
27151         *ret_conv = C2Tuple_u64u16Z_clone(arg);
27152         return tag_ptr(ret_conv, true);
27153 }
27154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27155         LDKC2Tuple_u64u16Z* arg_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(arg);
27156         int64_t ret_conv = C2Tuple_u64u16Z_clone_ptr(arg_conv);
27157         return ret_conv;
27158 }
27159
27160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27161         LDKC2Tuple_u64u16Z* orig_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(orig);
27162         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
27163         *ret_conv = C2Tuple_u64u16Z_clone(orig_conv);
27164         return tag_ptr(ret_conv, true);
27165 }
27166
27167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1new(JNIEnv *env, jclass clz, int64_t a, int16_t b) {
27168         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
27169         *ret_conv = C2Tuple_u64u16Z_new(a, b);
27170         return tag_ptr(ret_conv, true);
27171 }
27172
27173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
27174         if (!ptr_is_owned(_res)) return;
27175         void* _res_ptr = untag_ptr(_res);
27176         CHECK_ACCESS(_res_ptr);
27177         LDKC2Tuple_u64u16Z _res_conv = *(LDKC2Tuple_u64u16Z*)(_res_ptr);
27178         FREE(untag_ptr(_res));
27179         C2Tuple_u64u16Z_free(_res_conv);
27180 }
27181
27182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27183         void* o_ptr = untag_ptr(o);
27184         CHECK_ACCESS(o_ptr);
27185         LDKC2Tuple_u64u16Z o_conv = *(LDKC2Tuple_u64u16Z*)(o_ptr);
27186         o_conv = C2Tuple_u64u16Z_clone((LDKC2Tuple_u64u16Z*)untag_ptr(o));
27187         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
27188         *ret_copy = COption_C2Tuple_u64u16ZZ_some(o_conv);
27189         int64_t ret_ref = tag_ptr(ret_copy, true);
27190         return ret_ref;
27191 }
27192
27193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1none(JNIEnv *env, jclass clz) {
27194         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
27195         *ret_copy = COption_C2Tuple_u64u16ZZ_none();
27196         int64_t ret_ref = tag_ptr(ret_copy, true);
27197         return ret_ref;
27198 }
27199
27200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27201         if (!ptr_is_owned(_res)) return;
27202         void* _res_ptr = untag_ptr(_res);
27203         CHECK_ACCESS(_res_ptr);
27204         LDKCOption_C2Tuple_u64u16ZZ _res_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(_res_ptr);
27205         FREE(untag_ptr(_res));
27206         COption_C2Tuple_u64u16ZZ_free(_res_conv);
27207 }
27208
27209 static inline uint64_t COption_C2Tuple_u64u16ZZ_clone_ptr(LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR arg) {
27210         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
27211         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(arg);
27212         int64_t ret_ref = tag_ptr(ret_copy, true);
27213         return ret_ref;
27214 }
27215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27216         LDKCOption_C2Tuple_u64u16ZZ* arg_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(arg);
27217         int64_t ret_conv = COption_C2Tuple_u64u16ZZ_clone_ptr(arg_conv);
27218         return ret_conv;
27219 }
27220
27221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27222         LDKCOption_C2Tuple_u64u16ZZ* orig_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(orig);
27223         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
27224         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(orig_conv);
27225         int64_t ret_ref = tag_ptr(ret_copy, true);
27226         return ret_ref;
27227 }
27228
27229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1some(JNIEnv *env, jclass clz, jclass o) {
27230         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_java(env, o);
27231         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
27232         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
27233         int64_t ret_ref = tag_ptr(ret_copy, true);
27234         return ret_ref;
27235 }
27236
27237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1none(JNIEnv *env, jclass clz) {
27238         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
27239         *ret_copy = COption_ChannelShutdownStateZ_none();
27240         int64_t ret_ref = tag_ptr(ret_copy, true);
27241         return ret_ref;
27242 }
27243
27244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27245         if (!ptr_is_owned(_res)) return;
27246         void* _res_ptr = untag_ptr(_res);
27247         CHECK_ACCESS(_res_ptr);
27248         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
27249         FREE(untag_ptr(_res));
27250         COption_ChannelShutdownStateZ_free(_res_conv);
27251 }
27252
27253 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
27254         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
27255         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
27256         int64_t ret_ref = tag_ptr(ret_copy, true);
27257         return ret_ref;
27258 }
27259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27260         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
27261         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
27262         return ret_conv;
27263 }
27264
27265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27266         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
27267         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
27268         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
27269         int64_t ret_ref = tag_ptr(ret_copy, true);
27270         return ret_ref;
27271 }
27272
27273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
27274         LDKThirtyTwoBytes o_ref;
27275         CHECK((*env)->GetArrayLength(env, o) == 32);
27276         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
27277         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
27278         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_ok(o_ref);
27279         return tag_ptr(ret_conv, true);
27280 }
27281
27282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27283         void* e_ptr = untag_ptr(e);
27284         CHECK_ACCESS(e_ptr);
27285         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
27286         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
27287         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
27288         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_err(e_conv);
27289         return tag_ptr(ret_conv, true);
27290 }
27291
27292 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27293         LDKCResult_ThirtyTwoBytesAPIErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(o);
27294         jboolean ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o_conv);
27295         return ret_conv;
27296 }
27297
27298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27299         if (!ptr_is_owned(_res)) return;
27300         void* _res_ptr = untag_ptr(_res);
27301         CHECK_ACCESS(_res_ptr);
27302         LDKCResult_ThirtyTwoBytesAPIErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesAPIErrorZ*)(_res_ptr);
27303         FREE(untag_ptr(_res));
27304         CResult_ThirtyTwoBytesAPIErrorZ_free(_res_conv);
27305 }
27306
27307 static inline uint64_t CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR arg) {
27308         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
27309         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(arg);
27310         return tag_ptr(ret_conv, true);
27311 }
27312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27313         LDKCResult_ThirtyTwoBytesAPIErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(arg);
27314         int64_t ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(arg_conv);
27315         return ret_conv;
27316 }
27317
27318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27319         LDKCResult_ThirtyTwoBytesAPIErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(orig);
27320         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
27321         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(orig_conv);
27322         return tag_ptr(ret_conv, true);
27323 }
27324
27325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RecentPaymentDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27326         LDKCVec_RecentPaymentDetailsZ _res_constr;
27327         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27328         if (_res_constr.datalen > 0)
27329                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
27330         else
27331                 _res_constr.data = NULL;
27332         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27333         for (size_t w = 0; w < _res_constr.datalen; w++) {
27334                 int64_t _res_conv_22 = _res_vals[w];
27335                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
27336                 CHECK_ACCESS(_res_conv_22_ptr);
27337                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
27338                 FREE(untag_ptr(_res_conv_22));
27339                 _res_constr.data[w] = _res_conv_22_conv;
27340         }
27341         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27342         CVec_RecentPaymentDetailsZ_free(_res_constr);
27343 }
27344
27345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
27346         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
27347         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
27348         return tag_ptr(ret_conv, true);
27349 }
27350
27351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27352         void* e_ptr = untag_ptr(e);
27353         CHECK_ACCESS(e_ptr);
27354         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
27355         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
27356         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
27357         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
27358         return tag_ptr(ret_conv, true);
27359 }
27360
27361 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27362         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
27363         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
27364         return ret_conv;
27365 }
27366
27367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27368         if (!ptr_is_owned(_res)) return;
27369         void* _res_ptr = untag_ptr(_res);
27370         CHECK_ACCESS(_res_ptr);
27371         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
27372         FREE(untag_ptr(_res));
27373         CResult_NonePaymentSendFailureZ_free(_res_conv);
27374 }
27375
27376 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
27377         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
27378         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
27379         return tag_ptr(ret_conv, true);
27380 }
27381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27382         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
27383         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
27384         return ret_conv;
27385 }
27386
27387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27388         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
27389         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
27390         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
27391         return tag_ptr(ret_conv, true);
27392 }
27393
27394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz) {
27395         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
27396         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
27397         return tag_ptr(ret_conv, true);
27398 }
27399
27400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
27401         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
27402         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
27403         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
27404         return tag_ptr(ret_conv, true);
27405 }
27406
27407 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27408         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
27409         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
27410         return ret_conv;
27411 }
27412
27413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27414         if (!ptr_is_owned(_res)) return;
27415         void* _res_ptr = untag_ptr(_res);
27416         CHECK_ACCESS(_res_ptr);
27417         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
27418         FREE(untag_ptr(_res));
27419         CResult_NoneRetryableSendFailureZ_free(_res_conv);
27420 }
27421
27422 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
27423         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
27424         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
27425         return tag_ptr(ret_conv, true);
27426 }
27427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27428         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
27429         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
27430         return ret_conv;
27431 }
27432
27433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27434         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
27435         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
27436         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
27437         return tag_ptr(ret_conv, true);
27438 }
27439
27440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
27441         LDKThirtyTwoBytes o_ref;
27442         CHECK((*env)->GetArrayLength(env, o) == 32);
27443         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
27444         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
27445         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o_ref);
27446         return tag_ptr(ret_conv, true);
27447 }
27448
27449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27450         void* e_ptr = untag_ptr(e);
27451         CHECK_ACCESS(e_ptr);
27452         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
27453         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
27454         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
27455         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e_conv);
27456         return tag_ptr(ret_conv, true);
27457 }
27458
27459 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27460         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(o);
27461         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o_conv);
27462         return ret_conv;
27463 }
27464
27465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27466         if (!ptr_is_owned(_res)) return;
27467         void* _res_ptr = untag_ptr(_res);
27468         CHECK_ACCESS(_res_ptr);
27469         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)(_res_ptr);
27470         FREE(untag_ptr(_res));
27471         CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res_conv);
27472 }
27473
27474 static inline uint64_t CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR arg) {
27475         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
27476         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(arg);
27477         return tag_ptr(ret_conv, true);
27478 }
27479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27480         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(arg);
27481         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(arg_conv);
27482         return ret_conv;
27483 }
27484
27485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27486         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(orig);
27487         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
27488         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig_conv);
27489         return tag_ptr(ret_conv, true);
27490 }
27491
27492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
27493         LDKThirtyTwoBytes o_ref;
27494         CHECK((*env)->GetArrayLength(env, o) == 32);
27495         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
27496         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
27497         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o_ref);
27498         return tag_ptr(ret_conv, true);
27499 }
27500
27501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
27502         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
27503         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
27504         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e_conv);
27505         return tag_ptr(ret_conv, true);
27506 }
27507
27508 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27509         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(o);
27510         jboolean ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o_conv);
27511         return ret_conv;
27512 }
27513
27514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27515         if (!ptr_is_owned(_res)) return;
27516         void* _res_ptr = untag_ptr(_res);
27517         CHECK_ACCESS(_res_ptr);
27518         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)(_res_ptr);
27519         FREE(untag_ptr(_res));
27520         CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res_conv);
27521 }
27522
27523 static inline uint64_t CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR arg) {
27524         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
27525         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(arg);
27526         return tag_ptr(ret_conv, true);
27527 }
27528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27529         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(arg);
27530         int64_t ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(arg_conv);
27531         return ret_conv;
27532 }
27533
27534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27535         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(orig);
27536         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
27537         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig_conv);
27538         return tag_ptr(ret_conv, true);
27539 }
27540
27541 static inline uint64_t C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR arg) {
27542         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
27543         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(arg);
27544         return tag_ptr(ret_conv, true);
27545 }
27546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27547         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(arg);
27548         int64_t ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(arg_conv);
27549         return ret_conv;
27550 }
27551
27552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27553         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(orig);
27554         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
27555         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig_conv);
27556         return tag_ptr(ret_conv, true);
27557 }
27558
27559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
27560         LDKThirtyTwoBytes a_ref;
27561         CHECK((*env)->GetArrayLength(env, a) == 32);
27562         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
27563         LDKThirtyTwoBytes b_ref;
27564         CHECK((*env)->GetArrayLength(env, b) == 32);
27565         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
27566         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
27567         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a_ref, b_ref);
27568         return tag_ptr(ret_conv, true);
27569 }
27570
27571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27572         if (!ptr_is_owned(_res)) return;
27573         void* _res_ptr = untag_ptr(_res);
27574         CHECK_ACCESS(_res_ptr);
27575         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_ptr);
27576         FREE(untag_ptr(_res));
27577         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res_conv);
27578 }
27579
27580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27581         void* o_ptr = untag_ptr(o);
27582         CHECK_ACCESS(o_ptr);
27583         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
27584         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
27585         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
27586         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o_conv);
27587         return tag_ptr(ret_conv, true);
27588 }
27589
27590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27591         void* e_ptr = untag_ptr(e);
27592         CHECK_ACCESS(e_ptr);
27593         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
27594         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
27595         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
27596         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e_conv);
27597         return tag_ptr(ret_conv, true);
27598 }
27599
27600 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27601         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(o);
27602         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o_conv);
27603         return ret_conv;
27604 }
27605
27606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27607         if (!ptr_is_owned(_res)) return;
27608         void* _res_ptr = untag_ptr(_res);
27609         CHECK_ACCESS(_res_ptr);
27610         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)(_res_ptr);
27611         FREE(untag_ptr(_res));
27612         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res_conv);
27613 }
27614
27615 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR arg) {
27616         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
27617         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(arg);
27618         return tag_ptr(ret_conv, true);
27619 }
27620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27621         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(arg);
27622         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(arg_conv);
27623         return ret_conv;
27624 }
27625
27626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27627         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(orig);
27628         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
27629         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig_conv);
27630         return tag_ptr(ret_conv, true);
27631 }
27632
27633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27634         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res_constr;
27635         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27636         if (_res_constr.datalen > 0)
27637                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
27638         else
27639                 _res_constr.data = NULL;
27640         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27641         for (size_t o = 0; o < _res_constr.datalen; o++) {
27642                 int64_t _res_conv_40 = _res_vals[o];
27643                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
27644                 CHECK_ACCESS(_res_conv_40_ptr);
27645                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_conv_40_ptr);
27646                 FREE(untag_ptr(_res_conv_40));
27647                 _res_constr.data[o] = _res_conv_40_conv;
27648         }
27649         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27650         CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res_constr);
27651 }
27652
27653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
27654         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
27655         o_constr.datalen = (*env)->GetArrayLength(env, o);
27656         if (o_constr.datalen > 0)
27657                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
27658         else
27659                 o_constr.data = NULL;
27660         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
27661         for (size_t o = 0; o < o_constr.datalen; o++) {
27662                 int64_t o_conv_40 = o_vals[o];
27663                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
27664                 CHECK_ACCESS(o_conv_40_ptr);
27665                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
27666                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
27667                 o_constr.data[o] = o_conv_40_conv;
27668         }
27669         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
27670         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
27671         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o_constr);
27672         return tag_ptr(ret_conv, true);
27673 }
27674
27675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27676         void* e_ptr = untag_ptr(e);
27677         CHECK_ACCESS(e_ptr);
27678         LDKProbeSendFailure e_conv = *(LDKProbeSendFailure*)(e_ptr);
27679         e_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(e));
27680         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
27681         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e_conv);
27682         return tag_ptr(ret_conv, true);
27683 }
27684
27685 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27686         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(o);
27687         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o_conv);
27688         return ret_conv;
27689 }
27690
27691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27692         if (!ptr_is_owned(_res)) return;
27693         void* _res_ptr = untag_ptr(_res);
27694         CHECK_ACCESS(_res_ptr);
27695         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)(_res_ptr);
27696         FREE(untag_ptr(_res));
27697         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res_conv);
27698 }
27699
27700 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR arg) {
27701         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
27702         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(arg);
27703         return tag_ptr(ret_conv, true);
27704 }
27705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27706         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(arg);
27707         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(arg_conv);
27708         return ret_conv;
27709 }
27710
27711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27712         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(orig);
27713         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
27714         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig_conv);
27715         return tag_ptr(ret_conv, true);
27716 }
27717
27718 static inline uint64_t C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR arg) {
27719         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
27720         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(arg);
27721         return tag_ptr(ret_conv, true);
27722 }
27723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27724         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(arg);
27725         int64_t ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone_ptr(arg_conv);
27726         return ret_conv;
27727 }
27728
27729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27730         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(orig);
27731         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
27732         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(orig_conv);
27733         return tag_ptr(ret_conv, true);
27734 }
27735
27736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
27737         LDKThirtyTwoBytes a_ref;
27738         CHECK((*env)->GetArrayLength(env, a) == 32);
27739         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
27740         LDKPublicKey b_ref;
27741         CHECK((*env)->GetArrayLength(env, b) == 33);
27742         (*env)->GetByteArrayRegion(env, b, 0, 33, b_ref.compressed_form);
27743         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKC2Tuple_ThirtyTwoBytesPublicKeyZ");
27744         *ret_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_new(a_ref, b_ref);
27745         return tag_ptr(ret_conv, true);
27746 }
27747
27748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27749         if (!ptr_is_owned(_res)) return;
27750         void* _res_ptr = untag_ptr(_res);
27751         CHECK_ACCESS(_res_ptr);
27752         LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_ptr);
27753         FREE(untag_ptr(_res));
27754         C2Tuple_ThirtyTwoBytesPublicKeyZ_free(_res_conv);
27755 }
27756
27757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27758         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ _res_constr;
27759         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27760         if (_res_constr.datalen > 0)
27761                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
27762         else
27763                 _res_constr.data = NULL;
27764         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27765         for (size_t j = 0; j < _res_constr.datalen; j++) {
27766                 int64_t _res_conv_35 = _res_vals[j];
27767                 void* _res_conv_35_ptr = untag_ptr(_res_conv_35);
27768                 CHECK_ACCESS(_res_conv_35_ptr);
27769                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(_res_conv_35_ptr);
27770                 FREE(untag_ptr(_res_conv_35));
27771                 _res_constr.data[j] = _res_conv_35_conv;
27772         }
27773         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27774         CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(_res_constr);
27775 }
27776
27777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1some(JNIEnv *env, jclass clz, jstring o) {
27778         LDKStr o_conv = java_to_owned_str(env, o);
27779         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
27780         *ret_copy = COption_StrZ_some(o_conv);
27781         int64_t ret_ref = tag_ptr(ret_copy, true);
27782         return ret_ref;
27783 }
27784
27785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1none(JNIEnv *env, jclass clz) {
27786         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
27787         *ret_copy = COption_StrZ_none();
27788         int64_t ret_ref = tag_ptr(ret_copy, true);
27789         return ret_ref;
27790 }
27791
27792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27793         if (!ptr_is_owned(_res)) return;
27794         void* _res_ptr = untag_ptr(_res);
27795         CHECK_ACCESS(_res_ptr);
27796         LDKCOption_StrZ _res_conv = *(LDKCOption_StrZ*)(_res_ptr);
27797         FREE(untag_ptr(_res));
27798         COption_StrZ_free(_res_conv);
27799 }
27800
27801 static inline uint64_t COption_StrZ_clone_ptr(LDKCOption_StrZ *NONNULL_PTR arg) {
27802         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
27803         *ret_copy = COption_StrZ_clone(arg);
27804         int64_t ret_ref = tag_ptr(ret_copy, true);
27805         return ret_ref;
27806 }
27807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27808         LDKCOption_StrZ* arg_conv = (LDKCOption_StrZ*)untag_ptr(arg);
27809         int64_t ret_conv = COption_StrZ_clone_ptr(arg_conv);
27810         return ret_conv;
27811 }
27812
27813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27814         LDKCOption_StrZ* orig_conv = (LDKCOption_StrZ*)untag_ptr(orig);
27815         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
27816         *ret_copy = COption_StrZ_clone(orig_conv);
27817         int64_t ret_ref = tag_ptr(ret_copy, true);
27818         return ret_ref;
27819 }
27820
27821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
27822         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
27823         *ret_conv = CResult_NoneBolt12SemanticErrorZ_ok();
27824         return tag_ptr(ret_conv, true);
27825 }
27826
27827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
27828         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
27829         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
27830         *ret_conv = CResult_NoneBolt12SemanticErrorZ_err(e_conv);
27831         return tag_ptr(ret_conv, true);
27832 }
27833
27834 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27835         LDKCResult_NoneBolt12SemanticErrorZ* o_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(o);
27836         jboolean ret_conv = CResult_NoneBolt12SemanticErrorZ_is_ok(o_conv);
27837         return ret_conv;
27838 }
27839
27840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27841         if (!ptr_is_owned(_res)) return;
27842         void* _res_ptr = untag_ptr(_res);
27843         CHECK_ACCESS(_res_ptr);
27844         LDKCResult_NoneBolt12SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt12SemanticErrorZ*)(_res_ptr);
27845         FREE(untag_ptr(_res));
27846         CResult_NoneBolt12SemanticErrorZ_free(_res_conv);
27847 }
27848
27849 static inline uint64_t CResult_NoneBolt12SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR arg) {
27850         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
27851         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(arg);
27852         return tag_ptr(ret_conv, true);
27853 }
27854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27855         LDKCResult_NoneBolt12SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(arg);
27856         int64_t ret_conv = CResult_NoneBolt12SemanticErrorZ_clone_ptr(arg_conv);
27857         return ret_conv;
27858 }
27859
27860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27861         LDKCResult_NoneBolt12SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(orig);
27862         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
27863         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(orig_conv);
27864         return tag_ptr(ret_conv, true);
27865 }
27866
27867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27868         void* o_ptr = untag_ptr(o);
27869         CHECK_ACCESS(o_ptr);
27870         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
27871         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
27872         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
27873         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o_conv);
27874         return tag_ptr(ret_conv, true);
27875 }
27876
27877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1err(JNIEnv *env, jclass clz) {
27878         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
27879         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err();
27880         return tag_ptr(ret_conv, true);
27881 }
27882
27883 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27884         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(o);
27885         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o_conv);
27886         return ret_conv;
27887 }
27888
27889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27890         if (!ptr_is_owned(_res)) return;
27891         void* _res_ptr = untag_ptr(_res);
27892         CHECK_ACCESS(_res_ptr);
27893         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)(_res_ptr);
27894         FREE(untag_ptr(_res));
27895         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res_conv);
27896 }
27897
27898 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR arg) {
27899         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
27900         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(arg);
27901         return tag_ptr(ret_conv, true);
27902 }
27903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27904         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(arg);
27905         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(arg_conv);
27906         return ret_conv;
27907 }
27908
27909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27910         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(orig);
27911         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
27912         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig_conv);
27913         return tag_ptr(ret_conv, true);
27914 }
27915
27916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27917         void* o_ptr = untag_ptr(o);
27918         CHECK_ACCESS(o_ptr);
27919         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
27920         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
27921         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
27922         *ret_copy = COption_OffersMessageZ_some(o_conv);
27923         int64_t ret_ref = tag_ptr(ret_copy, true);
27924         return ret_ref;
27925 }
27926
27927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1none(JNIEnv *env, jclass clz) {
27928         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
27929         *ret_copy = COption_OffersMessageZ_none();
27930         int64_t ret_ref = tag_ptr(ret_copy, true);
27931         return ret_ref;
27932 }
27933
27934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27935         if (!ptr_is_owned(_res)) return;
27936         void* _res_ptr = untag_ptr(_res);
27937         CHECK_ACCESS(_res_ptr);
27938         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
27939         FREE(untag_ptr(_res));
27940         COption_OffersMessageZ_free(_res_conv);
27941 }
27942
27943 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
27944         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
27945         *ret_copy = COption_OffersMessageZ_clone(arg);
27946         int64_t ret_ref = tag_ptr(ret_copy, true);
27947         return ret_ref;
27948 }
27949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27950         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
27951         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
27952         return ret_conv;
27953 }
27954
27955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27956         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
27957         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
27958         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
27959         int64_t ret_ref = tag_ptr(ret_copy, true);
27960         return ret_ref;
27961 }
27962
27963 static inline uint64_t C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR arg) {
27964         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
27965         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(arg);
27966         return tag_ptr(ret_conv, true);
27967 }
27968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27969         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(arg);
27970         int64_t ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(arg_conv);
27971         return ret_conv;
27972 }
27973
27974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27975         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(orig);
27976         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
27977         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig_conv);
27978         return tag_ptr(ret_conv, true);
27979 }
27980
27981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_t c) {
27982         void* a_ptr = untag_ptr(a);
27983         CHECK_ACCESS(a_ptr);
27984         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
27985         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
27986         void* b_ptr = untag_ptr(b);
27987         CHECK_ACCESS(b_ptr);
27988         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
27989         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
27990         LDKBlindedPath c_conv;
27991         c_conv.inner = untag_ptr(c);
27992         c_conv.is_owned = ptr_is_owned(c);
27993         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
27994         c_conv = BlindedPath_clone(&c_conv);
27995         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
27996         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
27997         return tag_ptr(ret_conv, true);
27998 }
27999
28000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28001         if (!ptr_is_owned(_res)) return;
28002         void* _res_ptr = untag_ptr(_res);
28003         CHECK_ACCESS(_res_ptr);
28004         LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_ptr);
28005         FREE(untag_ptr(_res));
28006         C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res_conv);
28007 }
28008
28009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OffersMessageDestinationBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28010         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res_constr;
28011         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28012         if (_res_constr.datalen > 0)
28013                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
28014         else
28015                 _res_constr.data = NULL;
28016         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28017         for (size_t x = 0; x < _res_constr.datalen; x++) {
28018                 int64_t _res_conv_49 = _res_vals[x];
28019                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
28020                 CHECK_ACCESS(_res_conv_49_ptr);
28021                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_conv_49_ptr);
28022                 FREE(untag_ptr(_res_conv_49));
28023                 _res_constr.data[x] = _res_conv_49_conv;
28024         }
28025         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28026         CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res_constr);
28027 }
28028
28029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28030         LDKCounterpartyForwardingInfo o_conv;
28031         o_conv.inner = untag_ptr(o);
28032         o_conv.is_owned = ptr_is_owned(o);
28033         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28034         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
28035         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
28036         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
28037         return tag_ptr(ret_conv, true);
28038 }
28039
28040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28041         void* e_ptr = untag_ptr(e);
28042         CHECK_ACCESS(e_ptr);
28043         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28044         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28045         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
28046         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
28047         return tag_ptr(ret_conv, true);
28048 }
28049
28050 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28051         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
28052         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
28053         return ret_conv;
28054 }
28055
28056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28057         if (!ptr_is_owned(_res)) return;
28058         void* _res_ptr = untag_ptr(_res);
28059         CHECK_ACCESS(_res_ptr);
28060         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
28061         FREE(untag_ptr(_res));
28062         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
28063 }
28064
28065 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
28066         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
28067         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
28068         return tag_ptr(ret_conv, true);
28069 }
28070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28071         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
28072         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
28073         return ret_conv;
28074 }
28075
28076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28077         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
28078         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
28079         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
28080         return tag_ptr(ret_conv, true);
28081 }
28082
28083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28084         LDKChannelCounterparty o_conv;
28085         o_conv.inner = untag_ptr(o);
28086         o_conv.is_owned = ptr_is_owned(o);
28087         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28088         o_conv = ChannelCounterparty_clone(&o_conv);
28089         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
28090         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
28091         return tag_ptr(ret_conv, true);
28092 }
28093
28094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28095         void* e_ptr = untag_ptr(e);
28096         CHECK_ACCESS(e_ptr);
28097         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28098         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28099         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
28100         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
28101         return tag_ptr(ret_conv, true);
28102 }
28103
28104 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28105         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
28106         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
28107         return ret_conv;
28108 }
28109
28110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28111         if (!ptr_is_owned(_res)) return;
28112         void* _res_ptr = untag_ptr(_res);
28113         CHECK_ACCESS(_res_ptr);
28114         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
28115         FREE(untag_ptr(_res));
28116         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
28117 }
28118
28119 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
28120         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
28121         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
28122         return tag_ptr(ret_conv, true);
28123 }
28124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28125         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
28126         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
28127         return ret_conv;
28128 }
28129
28130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28131         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
28132         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
28133         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
28134         return tag_ptr(ret_conv, true);
28135 }
28136
28137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28138         LDKChannelDetails o_conv;
28139         o_conv.inner = untag_ptr(o);
28140         o_conv.is_owned = ptr_is_owned(o);
28141         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28142         o_conv = ChannelDetails_clone(&o_conv);
28143         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
28144         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
28145         return tag_ptr(ret_conv, true);
28146 }
28147
28148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28149         void* e_ptr = untag_ptr(e);
28150         CHECK_ACCESS(e_ptr);
28151         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28152         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28153         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
28154         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
28155         return tag_ptr(ret_conv, true);
28156 }
28157
28158 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28159         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
28160         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
28161         return ret_conv;
28162 }
28163
28164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28165         if (!ptr_is_owned(_res)) return;
28166         void* _res_ptr = untag_ptr(_res);
28167         CHECK_ACCESS(_res_ptr);
28168         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
28169         FREE(untag_ptr(_res));
28170         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
28171 }
28172
28173 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
28174         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
28175         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
28176         return tag_ptr(ret_conv, true);
28177 }
28178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28179         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
28180         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
28181         return ret_conv;
28182 }
28183
28184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28185         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
28186         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
28187         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
28188         return tag_ptr(ret_conv, true);
28189 }
28190
28191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28192         LDKPhantomRouteHints o_conv;
28193         o_conv.inner = untag_ptr(o);
28194         o_conv.is_owned = ptr_is_owned(o);
28195         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28196         o_conv = PhantomRouteHints_clone(&o_conv);
28197         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
28198         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
28199         return tag_ptr(ret_conv, true);
28200 }
28201
28202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28203         void* e_ptr = untag_ptr(e);
28204         CHECK_ACCESS(e_ptr);
28205         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28206         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28207         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
28208         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
28209         return tag_ptr(ret_conv, true);
28210 }
28211
28212 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28213         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
28214         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
28215         return ret_conv;
28216 }
28217
28218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28219         if (!ptr_is_owned(_res)) return;
28220         void* _res_ptr = untag_ptr(_res);
28221         CHECK_ACCESS(_res_ptr);
28222         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
28223         FREE(untag_ptr(_res));
28224         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
28225 }
28226
28227 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
28228         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
28229         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
28230         return tag_ptr(ret_conv, true);
28231 }
28232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28233         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
28234         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
28235         return ret_conv;
28236 }
28237
28238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28239         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
28240         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
28241         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
28242         return tag_ptr(ret_conv, true);
28243 }
28244
28245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28246         LDKBlindedForward o_conv;
28247         o_conv.inner = untag_ptr(o);
28248         o_conv.is_owned = ptr_is_owned(o);
28249         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28250         o_conv = BlindedForward_clone(&o_conv);
28251         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
28252         *ret_conv = CResult_BlindedForwardDecodeErrorZ_ok(o_conv);
28253         return tag_ptr(ret_conv, true);
28254 }
28255
28256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28257         void* e_ptr = untag_ptr(e);
28258         CHECK_ACCESS(e_ptr);
28259         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28260         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28261         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
28262         *ret_conv = CResult_BlindedForwardDecodeErrorZ_err(e_conv);
28263         return tag_ptr(ret_conv, true);
28264 }
28265
28266 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28267         LDKCResult_BlindedForwardDecodeErrorZ* o_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(o);
28268         jboolean ret_conv = CResult_BlindedForwardDecodeErrorZ_is_ok(o_conv);
28269         return ret_conv;
28270 }
28271
28272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28273         if (!ptr_is_owned(_res)) return;
28274         void* _res_ptr = untag_ptr(_res);
28275         CHECK_ACCESS(_res_ptr);
28276         LDKCResult_BlindedForwardDecodeErrorZ _res_conv = *(LDKCResult_BlindedForwardDecodeErrorZ*)(_res_ptr);
28277         FREE(untag_ptr(_res));
28278         CResult_BlindedForwardDecodeErrorZ_free(_res_conv);
28279 }
28280
28281 static inline uint64_t CResult_BlindedForwardDecodeErrorZ_clone_ptr(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR arg) {
28282         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
28283         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(arg);
28284         return tag_ptr(ret_conv, true);
28285 }
28286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28287         LDKCResult_BlindedForwardDecodeErrorZ* arg_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(arg);
28288         int64_t ret_conv = CResult_BlindedForwardDecodeErrorZ_clone_ptr(arg_conv);
28289         return ret_conv;
28290 }
28291
28292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28293         LDKCResult_BlindedForwardDecodeErrorZ* orig_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(orig);
28294         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
28295         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(orig_conv);
28296         return tag_ptr(ret_conv, true);
28297 }
28298
28299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28300         void* o_ptr = untag_ptr(o);
28301         CHECK_ACCESS(o_ptr);
28302         LDKPendingHTLCRouting o_conv = *(LDKPendingHTLCRouting*)(o_ptr);
28303         o_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(o));
28304         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
28305         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_ok(o_conv);
28306         return tag_ptr(ret_conv, true);
28307 }
28308
28309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28310         void* e_ptr = untag_ptr(e);
28311         CHECK_ACCESS(e_ptr);
28312         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28313         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28314         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
28315         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_err(e_conv);
28316         return tag_ptr(ret_conv, true);
28317 }
28318
28319 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28320         LDKCResult_PendingHTLCRoutingDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(o);
28321         jboolean ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o_conv);
28322         return ret_conv;
28323 }
28324
28325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28326         if (!ptr_is_owned(_res)) return;
28327         void* _res_ptr = untag_ptr(_res);
28328         CHECK_ACCESS(_res_ptr);
28329         LDKCResult_PendingHTLCRoutingDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCRoutingDecodeErrorZ*)(_res_ptr);
28330         FREE(untag_ptr(_res));
28331         CResult_PendingHTLCRoutingDecodeErrorZ_free(_res_conv);
28332 }
28333
28334 static inline uint64_t CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR arg) {
28335         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
28336         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(arg);
28337         return tag_ptr(ret_conv, true);
28338 }
28339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28340         LDKCResult_PendingHTLCRoutingDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(arg);
28341         int64_t ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(arg_conv);
28342         return ret_conv;
28343 }
28344
28345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28346         LDKCResult_PendingHTLCRoutingDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(orig);
28347         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
28348         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig_conv);
28349         return tag_ptr(ret_conv, true);
28350 }
28351
28352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28353         LDKPendingHTLCInfo o_conv;
28354         o_conv.inner = untag_ptr(o);
28355         o_conv.is_owned = ptr_is_owned(o);
28356         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28357         o_conv = PendingHTLCInfo_clone(&o_conv);
28358         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
28359         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_ok(o_conv);
28360         return tag_ptr(ret_conv, true);
28361 }
28362
28363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28364         void* e_ptr = untag_ptr(e);
28365         CHECK_ACCESS(e_ptr);
28366         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28367         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28368         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
28369         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_err(e_conv);
28370         return tag_ptr(ret_conv, true);
28371 }
28372
28373 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28374         LDKCResult_PendingHTLCInfoDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(o);
28375         jboolean ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o_conv);
28376         return ret_conv;
28377 }
28378
28379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28380         if (!ptr_is_owned(_res)) return;
28381         void* _res_ptr = untag_ptr(_res);
28382         CHECK_ACCESS(_res_ptr);
28383         LDKCResult_PendingHTLCInfoDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCInfoDecodeErrorZ*)(_res_ptr);
28384         FREE(untag_ptr(_res));
28385         CResult_PendingHTLCInfoDecodeErrorZ_free(_res_conv);
28386 }
28387
28388 static inline uint64_t CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR arg) {
28389         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
28390         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(arg);
28391         return tag_ptr(ret_conv, true);
28392 }
28393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28394         LDKCResult_PendingHTLCInfoDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(arg);
28395         int64_t ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(arg_conv);
28396         return ret_conv;
28397 }
28398
28399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28400         LDKCResult_PendingHTLCInfoDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(orig);
28401         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
28402         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(orig_conv);
28403         return tag_ptr(ret_conv, true);
28404 }
28405
28406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
28407         LDKBlindedFailure o_conv = LDKBlindedFailure_from_java(env, o);
28408         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
28409         *ret_conv = CResult_BlindedFailureDecodeErrorZ_ok(o_conv);
28410         return tag_ptr(ret_conv, true);
28411 }
28412
28413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28414         void* e_ptr = untag_ptr(e);
28415         CHECK_ACCESS(e_ptr);
28416         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28417         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28418         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
28419         *ret_conv = CResult_BlindedFailureDecodeErrorZ_err(e_conv);
28420         return tag_ptr(ret_conv, true);
28421 }
28422
28423 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28424         LDKCResult_BlindedFailureDecodeErrorZ* o_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(o);
28425         jboolean ret_conv = CResult_BlindedFailureDecodeErrorZ_is_ok(o_conv);
28426         return ret_conv;
28427 }
28428
28429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28430         if (!ptr_is_owned(_res)) return;
28431         void* _res_ptr = untag_ptr(_res);
28432         CHECK_ACCESS(_res_ptr);
28433         LDKCResult_BlindedFailureDecodeErrorZ _res_conv = *(LDKCResult_BlindedFailureDecodeErrorZ*)(_res_ptr);
28434         FREE(untag_ptr(_res));
28435         CResult_BlindedFailureDecodeErrorZ_free(_res_conv);
28436 }
28437
28438 static inline uint64_t CResult_BlindedFailureDecodeErrorZ_clone_ptr(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR arg) {
28439         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
28440         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(arg);
28441         return tag_ptr(ret_conv, true);
28442 }
28443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28444         LDKCResult_BlindedFailureDecodeErrorZ* arg_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(arg);
28445         int64_t ret_conv = CResult_BlindedFailureDecodeErrorZ_clone_ptr(arg_conv);
28446         return ret_conv;
28447 }
28448
28449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28450         LDKCResult_BlindedFailureDecodeErrorZ* orig_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(orig);
28451         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
28452         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(orig_conv);
28453         return tag_ptr(ret_conv, true);
28454 }
28455
28456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
28457         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_java(env, o);
28458         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
28459         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
28460         return tag_ptr(ret_conv, true);
28461 }
28462
28463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28464         void* e_ptr = untag_ptr(e);
28465         CHECK_ACCESS(e_ptr);
28466         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28467         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28468         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
28469         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
28470         return tag_ptr(ret_conv, true);
28471 }
28472
28473 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28474         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
28475         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
28476         return ret_conv;
28477 }
28478
28479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28480         if (!ptr_is_owned(_res)) return;
28481         void* _res_ptr = untag_ptr(_res);
28482         CHECK_ACCESS(_res_ptr);
28483         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
28484         FREE(untag_ptr(_res));
28485         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
28486 }
28487
28488 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
28489         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
28490         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
28491         return tag_ptr(ret_conv, true);
28492 }
28493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28494         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
28495         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
28496         return ret_conv;
28497 }
28498
28499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28500         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
28501         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
28502         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
28503         return tag_ptr(ret_conv, true);
28504 }
28505
28506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28507         LDKCVec_ChannelMonitorZ _res_constr;
28508         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28509         if (_res_constr.datalen > 0)
28510                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
28511         else
28512                 _res_constr.data = NULL;
28513         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28514         for (size_t q = 0; q < _res_constr.datalen; q++) {
28515                 int64_t _res_conv_16 = _res_vals[q];
28516                 LDKChannelMonitor _res_conv_16_conv;
28517                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
28518                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
28519                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
28520                 _res_constr.data[q] = _res_conv_16_conv;
28521         }
28522         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28523         CVec_ChannelMonitorZ_free(_res_constr);
28524 }
28525
28526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
28527         LDKThirtyTwoBytes a_ref;
28528         CHECK((*env)->GetArrayLength(env, a) == 32);
28529         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
28530         LDKChannelManager b_conv;
28531         b_conv.inner = untag_ptr(b);
28532         b_conv.is_owned = ptr_is_owned(b);
28533         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
28534         // WARNING: we need a move here but no clone is available for LDKChannelManager
28535         
28536         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ), "LDKC2Tuple_ThirtyTwoBytesChannelManagerZ");
28537         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a_ref, b_conv);
28538         return tag_ptr(ret_conv, true);
28539 }
28540
28541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28542         if (!ptr_is_owned(_res)) return;
28543         void* _res_ptr = untag_ptr(_res);
28544         CHECK_ACCESS(_res_ptr);
28545         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(_res_ptr);
28546         FREE(untag_ptr(_res));
28547         C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res_conv);
28548 }
28549
28550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28551         void* o_ptr = untag_ptr(o);
28552         CHECK_ACCESS(o_ptr);
28553         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(o_ptr);
28554         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_ThirtyTwoBytesChannelManagerZ
28555         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
28556         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o_conv);
28557         return tag_ptr(ret_conv, true);
28558 }
28559
28560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28561         void* e_ptr = untag_ptr(e);
28562         CHECK_ACCESS(e_ptr);
28563         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28564         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28565         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
28566         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e_conv);
28567         return tag_ptr(ret_conv, true);
28568 }
28569
28570 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28571         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(o);
28572         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o_conv);
28573         return ret_conv;
28574 }
28575
28576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28577         if (!ptr_is_owned(_res)) return;
28578         void* _res_ptr = untag_ptr(_res);
28579         CHECK_ACCESS(_res_ptr);
28580         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)(_res_ptr);
28581         FREE(untag_ptr(_res));
28582         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res_conv);
28583 }
28584
28585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28586         void* o_ptr = untag_ptr(o);
28587         CHECK_ACCESS(o_ptr);
28588         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
28589         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
28590         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
28591         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
28592         return tag_ptr(ret_conv, true);
28593 }
28594
28595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28596         void* e_ptr = untag_ptr(e);
28597         CHECK_ACCESS(e_ptr);
28598         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28599         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28600         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
28601         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
28602         return tag_ptr(ret_conv, true);
28603 }
28604
28605 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28606         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
28607         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
28608         return ret_conv;
28609 }
28610
28611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28612         if (!ptr_is_owned(_res)) return;
28613         void* _res_ptr = untag_ptr(_res);
28614         CHECK_ACCESS(_res_ptr);
28615         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
28616         FREE(untag_ptr(_res));
28617         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
28618 }
28619
28620 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
28621         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
28622         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
28623         return tag_ptr(ret_conv, true);
28624 }
28625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28626         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
28627         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
28628         return ret_conv;
28629 }
28630
28631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28632         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
28633         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
28634         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
28635         return tag_ptr(ret_conv, true);
28636 }
28637
28638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28639         LDKChannelConfig o_conv;
28640         o_conv.inner = untag_ptr(o);
28641         o_conv.is_owned = ptr_is_owned(o);
28642         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28643         o_conv = ChannelConfig_clone(&o_conv);
28644         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
28645         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
28646         return tag_ptr(ret_conv, true);
28647 }
28648
28649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28650         void* e_ptr = untag_ptr(e);
28651         CHECK_ACCESS(e_ptr);
28652         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28653         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28654         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
28655         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
28656         return tag_ptr(ret_conv, true);
28657 }
28658
28659 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28660         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
28661         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
28662         return ret_conv;
28663 }
28664
28665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28666         if (!ptr_is_owned(_res)) return;
28667         void* _res_ptr = untag_ptr(_res);
28668         CHECK_ACCESS(_res_ptr);
28669         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
28670         FREE(untag_ptr(_res));
28671         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
28672 }
28673
28674 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
28675         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
28676         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
28677         return tag_ptr(ret_conv, true);
28678 }
28679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28680         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
28681         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
28682         return ret_conv;
28683 }
28684
28685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28686         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
28687         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
28688         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
28689         return tag_ptr(ret_conv, true);
28690 }
28691
28692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1some(JNIEnv *env, jclass clz, int64_t o) {
28693         void* o_ptr = untag_ptr(o);
28694         CHECK_ACCESS(o_ptr);
28695         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
28696         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
28697         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
28698         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
28699         int64_t ret_ref = tag_ptr(ret_copy, true);
28700         return ret_ref;
28701 }
28702
28703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1none(JNIEnv *env, jclass clz) {
28704         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
28705         *ret_copy = COption_MaxDustHTLCExposureZ_none();
28706         int64_t ret_ref = tag_ptr(ret_copy, true);
28707         return ret_ref;
28708 }
28709
28710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28711         if (!ptr_is_owned(_res)) return;
28712         void* _res_ptr = untag_ptr(_res);
28713         CHECK_ACCESS(_res_ptr);
28714         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
28715         FREE(untag_ptr(_res));
28716         COption_MaxDustHTLCExposureZ_free(_res_conv);
28717 }
28718
28719 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
28720         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
28721         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
28722         int64_t ret_ref = tag_ptr(ret_copy, true);
28723         return ret_ref;
28724 }
28725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28726         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
28727         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
28728         return ret_conv;
28729 }
28730
28731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28732         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
28733         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
28734         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
28735         int64_t ret_ref = tag_ptr(ret_copy, true);
28736         return ret_ref;
28737 }
28738
28739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1some(JNIEnv *env, jclass clz, int64_t o) {
28740         void* o_ptr = untag_ptr(o);
28741         CHECK_ACCESS(o_ptr);
28742         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
28743         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
28744         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
28745         *ret_copy = COption_APIErrorZ_some(o_conv);
28746         int64_t ret_ref = tag_ptr(ret_copy, true);
28747         return ret_ref;
28748 }
28749
28750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1none(JNIEnv *env, jclass clz) {
28751         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
28752         *ret_copy = COption_APIErrorZ_none();
28753         int64_t ret_ref = tag_ptr(ret_copy, true);
28754         return ret_ref;
28755 }
28756
28757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28758         if (!ptr_is_owned(_res)) return;
28759         void* _res_ptr = untag_ptr(_res);
28760         CHECK_ACCESS(_res_ptr);
28761         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
28762         FREE(untag_ptr(_res));
28763         COption_APIErrorZ_free(_res_conv);
28764 }
28765
28766 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
28767         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
28768         *ret_copy = COption_APIErrorZ_clone(arg);
28769         int64_t ret_ref = tag_ptr(ret_copy, true);
28770         return ret_ref;
28771 }
28772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28773         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
28774         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
28775         return ret_conv;
28776 }
28777
28778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28779         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
28780         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
28781         *ret_copy = COption_APIErrorZ_clone(orig_conv);
28782         int64_t ret_ref = tag_ptr(ret_copy, true);
28783         return ret_ref;
28784 }
28785
28786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28787         void* o_ptr = untag_ptr(o);
28788         CHECK_ACCESS(o_ptr);
28789         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
28790         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
28791         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
28792         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
28793         return tag_ptr(ret_conv, true);
28794 }
28795
28796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28797         void* e_ptr = untag_ptr(e);
28798         CHECK_ACCESS(e_ptr);
28799         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28800         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28801         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
28802         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
28803         return tag_ptr(ret_conv, true);
28804 }
28805
28806 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28807         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
28808         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
28809         return ret_conv;
28810 }
28811
28812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28813         if (!ptr_is_owned(_res)) return;
28814         void* _res_ptr = untag_ptr(_res);
28815         CHECK_ACCESS(_res_ptr);
28816         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
28817         FREE(untag_ptr(_res));
28818         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
28819 }
28820
28821 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
28822         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
28823         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
28824         return tag_ptr(ret_conv, true);
28825 }
28826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28827         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
28828         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
28829         return ret_conv;
28830 }
28831
28832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28833         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
28834         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
28835         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
28836         return tag_ptr(ret_conv, true);
28837 }
28838
28839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28840         LDKChannelMonitorUpdate o_conv;
28841         o_conv.inner = untag_ptr(o);
28842         o_conv.is_owned = ptr_is_owned(o);
28843         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28844         o_conv = ChannelMonitorUpdate_clone(&o_conv);
28845         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
28846         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
28847         return tag_ptr(ret_conv, true);
28848 }
28849
28850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28851         void* e_ptr = untag_ptr(e);
28852         CHECK_ACCESS(e_ptr);
28853         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28854         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28855         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
28856         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
28857         return tag_ptr(ret_conv, true);
28858 }
28859
28860 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28861         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
28862         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
28863         return ret_conv;
28864 }
28865
28866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28867         if (!ptr_is_owned(_res)) return;
28868         void* _res_ptr = untag_ptr(_res);
28869         CHECK_ACCESS(_res_ptr);
28870         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
28871         FREE(untag_ptr(_res));
28872         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
28873 }
28874
28875 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
28876         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
28877         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
28878         return tag_ptr(ret_conv, true);
28879 }
28880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28881         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
28882         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
28883         return ret_conv;
28884 }
28885
28886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28887         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
28888         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
28889         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
28890         return tag_ptr(ret_conv, true);
28891 }
28892
28893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
28894         void* o_ptr = untag_ptr(o);
28895         CHECK_ACCESS(o_ptr);
28896         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
28897         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
28898         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
28899         *ret_copy = COption_MonitorEventZ_some(o_conv);
28900         int64_t ret_ref = tag_ptr(ret_copy, true);
28901         return ret_ref;
28902 }
28903
28904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
28905         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
28906         *ret_copy = COption_MonitorEventZ_none();
28907         int64_t ret_ref = tag_ptr(ret_copy, true);
28908         return ret_ref;
28909 }
28910
28911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28912         if (!ptr_is_owned(_res)) return;
28913         void* _res_ptr = untag_ptr(_res);
28914         CHECK_ACCESS(_res_ptr);
28915         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
28916         FREE(untag_ptr(_res));
28917         COption_MonitorEventZ_free(_res_conv);
28918 }
28919
28920 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
28921         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
28922         *ret_copy = COption_MonitorEventZ_clone(arg);
28923         int64_t ret_ref = tag_ptr(ret_copy, true);
28924         return ret_ref;
28925 }
28926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28927         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
28928         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
28929         return ret_conv;
28930 }
28931
28932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28933         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
28934         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
28935         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
28936         int64_t ret_ref = tag_ptr(ret_copy, true);
28937         return ret_ref;
28938 }
28939
28940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28941         void* o_ptr = untag_ptr(o);
28942         CHECK_ACCESS(o_ptr);
28943         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
28944         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
28945         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
28946         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
28947         return tag_ptr(ret_conv, true);
28948 }
28949
28950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28951         void* e_ptr = untag_ptr(e);
28952         CHECK_ACCESS(e_ptr);
28953         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28954         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28955         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
28956         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
28957         return tag_ptr(ret_conv, true);
28958 }
28959
28960 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28961         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
28962         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
28963         return ret_conv;
28964 }
28965
28966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28967         if (!ptr_is_owned(_res)) return;
28968         void* _res_ptr = untag_ptr(_res);
28969         CHECK_ACCESS(_res_ptr);
28970         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
28971         FREE(untag_ptr(_res));
28972         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
28973 }
28974
28975 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
28976         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
28977         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
28978         return tag_ptr(ret_conv, true);
28979 }
28980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28981         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
28982         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
28983         return ret_conv;
28984 }
28985
28986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28987         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
28988         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
28989         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
28990         return tag_ptr(ret_conv, true);
28991 }
28992
28993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28994         LDKHTLCUpdate o_conv;
28995         o_conv.inner = untag_ptr(o);
28996         o_conv.is_owned = ptr_is_owned(o);
28997         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28998         o_conv = HTLCUpdate_clone(&o_conv);
28999         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
29000         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
29001         return tag_ptr(ret_conv, true);
29002 }
29003
29004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29005         void* e_ptr = untag_ptr(e);
29006         CHECK_ACCESS(e_ptr);
29007         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29008         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29009         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
29010         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
29011         return tag_ptr(ret_conv, true);
29012 }
29013
29014 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29015         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
29016         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
29017         return ret_conv;
29018 }
29019
29020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29021         if (!ptr_is_owned(_res)) return;
29022         void* _res_ptr = untag_ptr(_res);
29023         CHECK_ACCESS(_res_ptr);
29024         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
29025         FREE(untag_ptr(_res));
29026         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
29027 }
29028
29029 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
29030         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
29031         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
29032         return tag_ptr(ret_conv, true);
29033 }
29034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29035         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
29036         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
29037         return ret_conv;
29038 }
29039
29040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29041         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
29042         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
29043         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
29044         return tag_ptr(ret_conv, true);
29045 }
29046
29047 static inline uint64_t C2Tuple_OutPointCVec_u8ZZ_clone_ptr(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR arg) {
29048         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
29049         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(arg);
29050         return tag_ptr(ret_conv, true);
29051 }
29052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29053         LDKC2Tuple_OutPointCVec_u8ZZ* arg_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(arg);
29054         int64_t ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone_ptr(arg_conv);
29055         return ret_conv;
29056 }
29057
29058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29059         LDKC2Tuple_OutPointCVec_u8ZZ* orig_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(orig);
29060         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
29061         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(orig_conv);
29062         return tag_ptr(ret_conv, true);
29063 }
29064
29065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
29066         LDKOutPoint a_conv;
29067         a_conv.inner = untag_ptr(a);
29068         a_conv.is_owned = ptr_is_owned(a);
29069         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29070         a_conv = OutPoint_clone(&a_conv);
29071         LDKCVec_u8Z b_ref;
29072         b_ref.datalen = (*env)->GetArrayLength(env, b);
29073         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
29074         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
29075         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
29076         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_new(a_conv, b_ref);
29077         return tag_ptr(ret_conv, true);
29078 }
29079
29080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29081         if (!ptr_is_owned(_res)) return;
29082         void* _res_ptr = untag_ptr(_res);
29083         CHECK_ACCESS(_res_ptr);
29084         LDKC2Tuple_OutPointCVec_u8ZZ _res_conv = *(LDKC2Tuple_OutPointCVec_u8ZZ*)(_res_ptr);
29085         FREE(untag_ptr(_res));
29086         C2Tuple_OutPointCVec_u8ZZ_free(_res_conv);
29087 }
29088
29089 static inline uint64_t C2Tuple_u32CVec_u8ZZ_clone_ptr(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR arg) {
29090         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
29091         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(arg);
29092         return tag_ptr(ret_conv, true);
29093 }
29094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29095         LDKC2Tuple_u32CVec_u8ZZ* arg_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(arg);
29096         int64_t ret_conv = C2Tuple_u32CVec_u8ZZ_clone_ptr(arg_conv);
29097         return ret_conv;
29098 }
29099
29100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29101         LDKC2Tuple_u32CVec_u8ZZ* orig_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(orig);
29102         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
29103         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(orig_conv);
29104         return tag_ptr(ret_conv, true);
29105 }
29106
29107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
29108         LDKCVec_u8Z b_ref;
29109         b_ref.datalen = (*env)->GetArrayLength(env, b);
29110         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
29111         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
29112         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
29113         *ret_conv = C2Tuple_u32CVec_u8ZZ_new(a, b_ref);
29114         return tag_ptr(ret_conv, true);
29115 }
29116
29117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29118         if (!ptr_is_owned(_res)) return;
29119         void* _res_ptr = untag_ptr(_res);
29120         CHECK_ACCESS(_res_ptr);
29121         LDKC2Tuple_u32CVec_u8ZZ _res_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_ptr);
29122         FREE(untag_ptr(_res));
29123         C2Tuple_u32CVec_u8ZZ_free(_res_conv);
29124 }
29125
29126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32CVec_1u8ZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29127         LDKCVec_C2Tuple_u32CVec_u8ZZZ _res_constr;
29128         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29129         if (_res_constr.datalen > 0)
29130                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
29131         else
29132                 _res_constr.data = NULL;
29133         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29134         for (size_t x = 0; x < _res_constr.datalen; x++) {
29135                 int64_t _res_conv_23 = _res_vals[x];
29136                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
29137                 CHECK_ACCESS(_res_conv_23_ptr);
29138                 LDKC2Tuple_u32CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_conv_23_ptr);
29139                 FREE(untag_ptr(_res_conv_23));
29140                 _res_constr.data[x] = _res_conv_23_conv;
29141         }
29142         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29143         CVec_C2Tuple_u32CVec_u8ZZZ_free(_res_constr);
29144 }
29145
29146 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR arg) {
29147         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
29148         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(arg);
29149         return tag_ptr(ret_conv, true);
29150 }
29151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29152         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(arg);
29153         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(arg_conv);
29154         return ret_conv;
29155 }
29156
29157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29158         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(orig);
29159         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
29160         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig_conv);
29161         return tag_ptr(ret_conv, true);
29162 }
29163
29164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
29165         LDKThirtyTwoBytes a_ref;
29166         CHECK((*env)->GetArrayLength(env, a) == 32);
29167         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
29168         LDKCVec_C2Tuple_u32CVec_u8ZZZ b_constr;
29169         b_constr.datalen = (*env)->GetArrayLength(env, b);
29170         if (b_constr.datalen > 0)
29171                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
29172         else
29173                 b_constr.data = NULL;
29174         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
29175         for (size_t x = 0; x < b_constr.datalen; x++) {
29176                 int64_t b_conv_23 = b_vals[x];
29177                 void* b_conv_23_ptr = untag_ptr(b_conv_23);
29178                 CHECK_ACCESS(b_conv_23_ptr);
29179                 LDKC2Tuple_u32CVec_u8ZZ b_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(b_conv_23_ptr);
29180                 b_conv_23_conv = C2Tuple_u32CVec_u8ZZ_clone((LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(b_conv_23));
29181                 b_constr.data[x] = b_conv_23_conv;
29182         }
29183         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
29184         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
29185         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a_ref, b_constr);
29186         return tag_ptr(ret_conv, true);
29187 }
29188
29189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29190         if (!ptr_is_owned(_res)) return;
29191         void* _res_ptr = untag_ptr(_res);
29192         CHECK_ACCESS(_res_ptr);
29193         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_ptr);
29194         FREE(untag_ptr(_res));
29195         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res_conv);
29196 }
29197
29198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29199         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res_constr;
29200         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29201         if (_res_constr.datalen > 0)
29202                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ Elements");
29203         else
29204                 _res_constr.data = NULL;
29205         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29206         for (size_t a = 0; a < _res_constr.datalen; a++) {
29207                 int64_t _res_conv_52 = _res_vals[a];
29208                 void* _res_conv_52_ptr = untag_ptr(_res_conv_52);
29209                 CHECK_ACCESS(_res_conv_52_ptr);
29210                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv_52_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_conv_52_ptr);
29211                 FREE(untag_ptr(_res_conv_52));
29212                 _res_constr.data[a] = _res_conv_52_conv;
29213         }
29214         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29215         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res_constr);
29216 }
29217
29218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CommitmentTransactionZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29219         LDKCVec_CommitmentTransactionZ _res_constr;
29220         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29221         if (_res_constr.datalen > 0)
29222                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCommitmentTransaction), "LDKCVec_CommitmentTransactionZ Elements");
29223         else
29224                 _res_constr.data = NULL;
29225         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29226         for (size_t x = 0; x < _res_constr.datalen; x++) {
29227                 int64_t _res_conv_23 = _res_vals[x];
29228                 LDKCommitmentTransaction _res_conv_23_conv;
29229                 _res_conv_23_conv.inner = untag_ptr(_res_conv_23);
29230                 _res_conv_23_conv.is_owned = ptr_is_owned(_res_conv_23);
29231                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_23_conv);
29232                 _res_constr.data[x] = _res_conv_23_conv;
29233         }
29234         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29235         CVec_CommitmentTransactionZ_free(_res_constr);
29236 }
29237
29238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
29239         LDKCVec_TransactionZ _res_constr;
29240         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29241         if (_res_constr.datalen > 0)
29242                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
29243         else
29244                 _res_constr.data = NULL;
29245         for (size_t i = 0; i < _res_constr.datalen; i++) {
29246                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
29247                 LDKTransaction _res_conv_8_ref;
29248                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
29249                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
29250                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
29251                 _res_conv_8_ref.data_is_owned = true;
29252                 _res_constr.data[i] = _res_conv_8_ref;
29253         }
29254         CVec_TransactionZ_free(_res_constr);
29255 }
29256
29257 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
29258         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
29259         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
29260         return tag_ptr(ret_conv, true);
29261 }
29262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29263         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
29264         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
29265         return ret_conv;
29266 }
29267
29268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29269         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
29270         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
29271         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
29272         return tag_ptr(ret_conv, true);
29273 }
29274
29275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
29276         void* b_ptr = untag_ptr(b);
29277         CHECK_ACCESS(b_ptr);
29278         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
29279         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
29280         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
29281         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
29282         return tag_ptr(ret_conv, true);
29283 }
29284
29285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29286         if (!ptr_is_owned(_res)) return;
29287         void* _res_ptr = untag_ptr(_res);
29288         CHECK_ACCESS(_res_ptr);
29289         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
29290         FREE(untag_ptr(_res));
29291         C2Tuple_u32TxOutZ_free(_res_conv);
29292 }
29293
29294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29295         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
29296         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29297         if (_res_constr.datalen > 0)
29298                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
29299         else
29300                 _res_constr.data = NULL;
29301         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29302         for (size_t u = 0; u < _res_constr.datalen; u++) {
29303                 int64_t _res_conv_20 = _res_vals[u];
29304                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
29305                 CHECK_ACCESS(_res_conv_20_ptr);
29306                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
29307                 FREE(untag_ptr(_res_conv_20));
29308                 _res_constr.data[u] = _res_conv_20_conv;
29309         }
29310         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29311         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
29312 }
29313
29314 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
29315         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
29316         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(arg);
29317         return tag_ptr(ret_conv, true);
29318 }
29319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29320         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
29321         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
29322         return ret_conv;
29323 }
29324
29325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29326         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
29327         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
29328         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
29329         return tag_ptr(ret_conv, true);
29330 }
29331
29332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
29333         LDKThirtyTwoBytes a_ref;
29334         CHECK((*env)->GetArrayLength(env, a) == 32);
29335         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
29336         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
29337         b_constr.datalen = (*env)->GetArrayLength(env, b);
29338         if (b_constr.datalen > 0)
29339                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
29340         else
29341                 b_constr.data = NULL;
29342         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
29343         for (size_t u = 0; u < b_constr.datalen; u++) {
29344                 int64_t b_conv_20 = b_vals[u];
29345                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
29346                 CHECK_ACCESS(b_conv_20_ptr);
29347                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
29348                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
29349                 b_constr.data[u] = b_conv_20_conv;
29350         }
29351         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
29352         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
29353         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
29354         return tag_ptr(ret_conv, true);
29355 }
29356
29357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29358         if (!ptr_is_owned(_res)) return;
29359         void* _res_ptr = untag_ptr(_res);
29360         CHECK_ACCESS(_res_ptr);
29361         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
29362         FREE(untag_ptr(_res));
29363         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
29364 }
29365
29366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29367         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ _res_constr;
29368         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29369         if (_res_constr.datalen > 0)
29370                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ Elements");
29371         else
29372                 _res_constr.data = NULL;
29373         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29374         for (size_t x = 0; x < _res_constr.datalen; x++) {
29375                 int64_t _res_conv_49 = _res_vals[x];
29376                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
29377                 CHECK_ACCESS(_res_conv_49_ptr);
29378                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_49_ptr);
29379                 FREE(untag_ptr(_res_conv_49));
29380                 _res_constr.data[x] = _res_conv_49_conv;
29381         }
29382         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29383         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
29384 }
29385
29386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29387         LDKCVec_BalanceZ _res_constr;
29388         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29389         if (_res_constr.datalen > 0)
29390                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
29391         else
29392                 _res_constr.data = NULL;
29393         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29394         for (size_t j = 0; j < _res_constr.datalen; j++) {
29395                 int64_t _res_conv_9 = _res_vals[j];
29396                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
29397                 CHECK_ACCESS(_res_conv_9_ptr);
29398                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
29399                 FREE(untag_ptr(_res_conv_9));
29400                 _res_constr.data[j] = _res_conv_9_conv;
29401         }
29402         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29403         CVec_BalanceZ_free(_res_constr);
29404 }
29405
29406 static inline uint64_t C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR arg) {
29407         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
29408         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(arg);
29409         return tag_ptr(ret_conv, true);
29410 }
29411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29412         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(arg);
29413         int64_t ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(arg_conv);
29414         return ret_conv;
29415 }
29416
29417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29418         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(orig);
29419         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
29420         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig_conv);
29421         return tag_ptr(ret_conv, true);
29422 }
29423
29424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
29425         LDKThirtyTwoBytes a_ref;
29426         CHECK((*env)->GetArrayLength(env, a) == 32);
29427         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
29428         LDKChannelMonitor b_conv;
29429         b_conv.inner = untag_ptr(b);
29430         b_conv.is_owned = ptr_is_owned(b);
29431         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29432         b_conv = ChannelMonitor_clone(&b_conv);
29433         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
29434         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a_ref, b_conv);
29435         return tag_ptr(ret_conv, true);
29436 }
29437
29438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29439         if (!ptr_is_owned(_res)) return;
29440         void* _res_ptr = untag_ptr(_res);
29441         CHECK_ACCESS(_res_ptr);
29442         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_ptr);
29443         FREE(untag_ptr(_res));
29444         C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res_conv);
29445 }
29446
29447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29448         void* o_ptr = untag_ptr(o);
29449         CHECK_ACCESS(o_ptr);
29450         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
29451         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
29452         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
29453         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o_conv);
29454         return tag_ptr(ret_conv, true);
29455 }
29456
29457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29458         void* e_ptr = untag_ptr(e);
29459         CHECK_ACCESS(e_ptr);
29460         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29461         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29462         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
29463         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e_conv);
29464         return tag_ptr(ret_conv, true);
29465 }
29466
29467 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29468         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(o);
29469         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o_conv);
29470         return ret_conv;
29471 }
29472
29473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29474         if (!ptr_is_owned(_res)) return;
29475         void* _res_ptr = untag_ptr(_res);
29476         CHECK_ACCESS(_res_ptr);
29477         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)(_res_ptr);
29478         FREE(untag_ptr(_res));
29479         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res_conv);
29480 }
29481
29482 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
29483         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
29484         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(arg);
29485         return tag_ptr(ret_conv, true);
29486 }
29487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29488         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
29489         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
29490         return ret_conv;
29491 }
29492
29493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29494         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
29495         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
29496         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig_conv);
29497         return tag_ptr(ret_conv, true);
29498 }
29499
29500 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
29501         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
29502         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
29503         return tag_ptr(ret_conv, true);
29504 }
29505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29506         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
29507         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
29508         return ret_conv;
29509 }
29510
29511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29512         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
29513         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
29514         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
29515         return tag_ptr(ret_conv, true);
29516 }
29517
29518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
29519         LDKPublicKey a_ref;
29520         CHECK((*env)->GetArrayLength(env, a) == 33);
29521         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
29522         void* b_ptr = untag_ptr(b);
29523         CHECK_ACCESS(b_ptr);
29524         LDKType b_conv = *(LDKType*)(b_ptr);
29525         if (b_conv.free == LDKType_JCalls_free) {
29526                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29527                 LDKType_JCalls_cloned(&b_conv);
29528         }
29529         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
29530         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
29531         return tag_ptr(ret_conv, true);
29532 }
29533
29534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29535         if (!ptr_is_owned(_res)) return;
29536         void* _res_ptr = untag_ptr(_res);
29537         CHECK_ACCESS(_res_ptr);
29538         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
29539         FREE(untag_ptr(_res));
29540         C2Tuple_PublicKeyTypeZ_free(_res_conv);
29541 }
29542
29543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29544         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
29545         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29546         if (_res_constr.datalen > 0)
29547                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
29548         else
29549                 _res_constr.data = NULL;
29550         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29551         for (size_t z = 0; z < _res_constr.datalen; z++) {
29552                 int64_t _res_conv_25 = _res_vals[z];
29553                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
29554                 CHECK_ACCESS(_res_conv_25_ptr);
29555                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
29556                 FREE(untag_ptr(_res_conv_25));
29557                 _res_constr.data[z] = _res_conv_25_conv;
29558         }
29559         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29560         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
29561 }
29562
29563 static inline uint64_t C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR arg) {
29564         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
29565         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(arg);
29566         return tag_ptr(ret_conv, true);
29567 }
29568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29569         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(arg);
29570         int64_t ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(arg_conv);
29571         return ret_conv;
29572 }
29573
29574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29575         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(orig);
29576         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
29577         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig_conv);
29578         return tag_ptr(ret_conv, true);
29579 }
29580
29581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
29582         LDKPublicKey a_ref;
29583         CHECK((*env)->GetArrayLength(env, a) == 33);
29584         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
29585         LDKCVec_SocketAddressZ b_constr;
29586         b_constr.datalen = (*env)->GetArrayLength(env, b);
29587         if (b_constr.datalen > 0)
29588                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
29589         else
29590                 b_constr.data = NULL;
29591         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
29592         for (size_t p = 0; p < b_constr.datalen; p++) {
29593                 int64_t b_conv_15 = b_vals[p];
29594                 void* b_conv_15_ptr = untag_ptr(b_conv_15);
29595                 CHECK_ACCESS(b_conv_15_ptr);
29596                 LDKSocketAddress b_conv_15_conv = *(LDKSocketAddress*)(b_conv_15_ptr);
29597                 b_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(b_conv_15));
29598                 b_constr.data[p] = b_conv_15_conv;
29599         }
29600         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
29601         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
29602         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a_ref, b_constr);
29603         return tag_ptr(ret_conv, true);
29604 }
29605
29606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29607         if (!ptr_is_owned(_res)) return;
29608         void* _res_ptr = untag_ptr(_res);
29609         CHECK_ACCESS(_res_ptr);
29610         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_ptr);
29611         FREE(untag_ptr(_res));
29612         C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res_conv);
29613 }
29614
29615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyCVec_1SocketAddressZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29616         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ _res_constr;
29617         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29618         if (_res_constr.datalen > 0)
29619                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
29620         else
29621                 _res_constr.data = NULL;
29622         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29623         for (size_t o = 0; o < _res_constr.datalen; o++) {
29624                 int64_t _res_conv_40 = _res_vals[o];
29625                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
29626                 CHECK_ACCESS(_res_conv_40_ptr);
29627                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_conv_40_ptr);
29628                 FREE(untag_ptr(_res_conv_40));
29629                 _res_constr.data[o] = _res_conv_40_conv;
29630         }
29631         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29632         CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(_res_constr);
29633 }
29634
29635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1some(JNIEnv *env, jclass clz, int64_t o) {
29636         void* o_ptr = untag_ptr(o);
29637         CHECK_ACCESS(o_ptr);
29638         LDKOnionMessageContents o_conv = *(LDKOnionMessageContents*)(o_ptr);
29639         if (o_conv.free == LDKOnionMessageContents_JCalls_free) {
29640                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29641                 LDKOnionMessageContents_JCalls_cloned(&o_conv);
29642         }
29643         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
29644         *ret_copy = COption_OnionMessageContentsZ_some(o_conv);
29645         int64_t ret_ref = tag_ptr(ret_copy, true);
29646         return ret_ref;
29647 }
29648
29649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1none(JNIEnv *env, jclass clz) {
29650         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
29651         *ret_copy = COption_OnionMessageContentsZ_none();
29652         int64_t ret_ref = tag_ptr(ret_copy, true);
29653         return ret_ref;
29654 }
29655
29656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29657         if (!ptr_is_owned(_res)) return;
29658         void* _res_ptr = untag_ptr(_res);
29659         CHECK_ACCESS(_res_ptr);
29660         LDKCOption_OnionMessageContentsZ _res_conv = *(LDKCOption_OnionMessageContentsZ*)(_res_ptr);
29661         FREE(untag_ptr(_res));
29662         COption_OnionMessageContentsZ_free(_res_conv);
29663 }
29664
29665 static inline uint64_t COption_OnionMessageContentsZ_clone_ptr(LDKCOption_OnionMessageContentsZ *NONNULL_PTR arg) {
29666         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
29667         *ret_copy = COption_OnionMessageContentsZ_clone(arg);
29668         int64_t ret_ref = tag_ptr(ret_copy, true);
29669         return ret_ref;
29670 }
29671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29672         LDKCOption_OnionMessageContentsZ* arg_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(arg);
29673         int64_t ret_conv = COption_OnionMessageContentsZ_clone_ptr(arg_conv);
29674         return ret_conv;
29675 }
29676
29677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29678         LDKCOption_OnionMessageContentsZ* orig_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(orig);
29679         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
29680         *ret_copy = COption_OnionMessageContentsZ_clone(orig_conv);
29681         int64_t ret_ref = tag_ptr(ret_copy, true);
29682         return ret_ref;
29683 }
29684
29685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29686         void* o_ptr = untag_ptr(o);
29687         CHECK_ACCESS(o_ptr);
29688         LDKCOption_OnionMessageContentsZ o_conv = *(LDKCOption_OnionMessageContentsZ*)(o_ptr);
29689         o_conv = COption_OnionMessageContentsZ_clone((LDKCOption_OnionMessageContentsZ*)untag_ptr(o));
29690         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
29691         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o_conv);
29692         return tag_ptr(ret_conv, true);
29693 }
29694
29695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29696         void* e_ptr = untag_ptr(e);
29697         CHECK_ACCESS(e_ptr);
29698         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29699         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29700         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
29701         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e_conv);
29702         return tag_ptr(ret_conv, true);
29703 }
29704
29705 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29706         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
29707         jboolean ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
29708         return ret_conv;
29709 }
29710
29711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29712         if (!ptr_is_owned(_res)) return;
29713         void* _res_ptr = untag_ptr(_res);
29714         CHECK_ACCESS(_res_ptr);
29715         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(_res_ptr);
29716         FREE(untag_ptr(_res));
29717         CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res_conv);
29718 }
29719
29720 static inline uint64_t CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
29721         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
29722         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(arg);
29723         return tag_ptr(ret_conv, true);
29724 }
29725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29726         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
29727         int64_t ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
29728         return ret_conv;
29729 }
29730
29731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29732         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
29733         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
29734         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig_conv);
29735         return tag_ptr(ret_conv, true);
29736 }
29737
29738 static inline uint64_t C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR arg) {
29739         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
29740         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(arg);
29741         return tag_ptr(ret_conv, true);
29742 }
29743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29744         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(arg);
29745         int64_t ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(arg_conv);
29746         return ret_conv;
29747 }
29748
29749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29750         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(orig);
29751         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
29752         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig_conv);
29753         return tag_ptr(ret_conv, true);
29754 }
29755
29756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_t c) {
29757         void* a_ptr = untag_ptr(a);
29758         CHECK_ACCESS(a_ptr);
29759         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
29760         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
29761                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29762                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
29763         }
29764         void* b_ptr = untag_ptr(b);
29765         CHECK_ACCESS(b_ptr);
29766         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
29767         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
29768         LDKBlindedPath c_conv;
29769         c_conv.inner = untag_ptr(c);
29770         c_conv.is_owned = ptr_is_owned(c);
29771         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
29772         c_conv = BlindedPath_clone(&c_conv);
29773         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
29774         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
29775         return tag_ptr(ret_conv, true);
29776 }
29777
29778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29779         if (!ptr_is_owned(_res)) return;
29780         void* _res_ptr = untag_ptr(_res);
29781         CHECK_ACCESS(_res_ptr);
29782         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_ptr);
29783         FREE(untag_ptr(_res));
29784         C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res_conv);
29785 }
29786
29787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OnionMessageContentsDestinationBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29788         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res_constr;
29789         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29790         if (_res_constr.datalen > 0)
29791                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
29792         else
29793                 _res_constr.data = NULL;
29794         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29795         for (size_t e = 0; e < _res_constr.datalen; e++) {
29796                 int64_t _res_conv_56 = _res_vals[e];
29797                 void* _res_conv_56_ptr = untag_ptr(_res_conv_56);
29798                 CHECK_ACCESS(_res_conv_56_ptr);
29799                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_conv_56_ptr);
29800                 FREE(untag_ptr(_res_conv_56));
29801                 _res_constr.data[e] = _res_conv_56_conv;
29802         }
29803         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29804         CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res_constr);
29805 }
29806
29807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
29808         void* o_ptr = untag_ptr(o);
29809         CHECK_ACCESS(o_ptr);
29810         LDKType o_conv = *(LDKType*)(o_ptr);
29811         if (o_conv.free == LDKType_JCalls_free) {
29812                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29813                 LDKType_JCalls_cloned(&o_conv);
29814         }
29815         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
29816         *ret_copy = COption_TypeZ_some(o_conv);
29817         int64_t ret_ref = tag_ptr(ret_copy, true);
29818         return ret_ref;
29819 }
29820
29821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
29822         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
29823         *ret_copy = COption_TypeZ_none();
29824         int64_t ret_ref = tag_ptr(ret_copy, true);
29825         return ret_ref;
29826 }
29827
29828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29829         if (!ptr_is_owned(_res)) return;
29830         void* _res_ptr = untag_ptr(_res);
29831         CHECK_ACCESS(_res_ptr);
29832         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
29833         FREE(untag_ptr(_res));
29834         COption_TypeZ_free(_res_conv);
29835 }
29836
29837 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
29838         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
29839         *ret_copy = COption_TypeZ_clone(arg);
29840         int64_t ret_ref = tag_ptr(ret_copy, true);
29841         return ret_ref;
29842 }
29843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29844         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
29845         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
29846         return ret_conv;
29847 }
29848
29849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29850         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
29851         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
29852         *ret_copy = COption_TypeZ_clone(orig_conv);
29853         int64_t ret_ref = tag_ptr(ret_copy, true);
29854         return ret_ref;
29855 }
29856
29857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29858         void* o_ptr = untag_ptr(o);
29859         CHECK_ACCESS(o_ptr);
29860         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
29861         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
29862         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
29863         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
29864         return tag_ptr(ret_conv, true);
29865 }
29866
29867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29868         void* e_ptr = untag_ptr(e);
29869         CHECK_ACCESS(e_ptr);
29870         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29871         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29872         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
29873         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
29874         return tag_ptr(ret_conv, true);
29875 }
29876
29877 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29878         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
29879         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
29880         return ret_conv;
29881 }
29882
29883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29884         if (!ptr_is_owned(_res)) return;
29885         void* _res_ptr = untag_ptr(_res);
29886         CHECK_ACCESS(_res_ptr);
29887         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
29888         FREE(untag_ptr(_res));
29889         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
29890 }
29891
29892 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
29893         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
29894         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
29895         return tag_ptr(ret_conv, true);
29896 }
29897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29898         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
29899         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
29900         return ret_conv;
29901 }
29902
29903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29904         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
29905         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
29906         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
29907         return tag_ptr(ret_conv, true);
29908 }
29909
29910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) {
29911         void* o_ptr = untag_ptr(o);
29912         CHECK_ACCESS(o_ptr);
29913         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
29914         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
29915         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
29916         *ret_copy = COption_SocketAddressZ_some(o_conv);
29917         int64_t ret_ref = tag_ptr(ret_copy, true);
29918         return ret_ref;
29919 }
29920
29921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1none(JNIEnv *env, jclass clz) {
29922         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
29923         *ret_copy = COption_SocketAddressZ_none();
29924         int64_t ret_ref = tag_ptr(ret_copy, true);
29925         return ret_ref;
29926 }
29927
29928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29929         if (!ptr_is_owned(_res)) return;
29930         void* _res_ptr = untag_ptr(_res);
29931         CHECK_ACCESS(_res_ptr);
29932         LDKCOption_SocketAddressZ _res_conv = *(LDKCOption_SocketAddressZ*)(_res_ptr);
29933         FREE(untag_ptr(_res));
29934         COption_SocketAddressZ_free(_res_conv);
29935 }
29936
29937 static inline uint64_t COption_SocketAddressZ_clone_ptr(LDKCOption_SocketAddressZ *NONNULL_PTR arg) {
29938         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
29939         *ret_copy = COption_SocketAddressZ_clone(arg);
29940         int64_t ret_ref = tag_ptr(ret_copy, true);
29941         return ret_ref;
29942 }
29943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29944         LDKCOption_SocketAddressZ* arg_conv = (LDKCOption_SocketAddressZ*)untag_ptr(arg);
29945         int64_t ret_conv = COption_SocketAddressZ_clone_ptr(arg_conv);
29946         return ret_conv;
29947 }
29948
29949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29950         LDKCOption_SocketAddressZ* orig_conv = (LDKCOption_SocketAddressZ*)untag_ptr(orig);
29951         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
29952         *ret_copy = COption_SocketAddressZ_clone(orig_conv);
29953         int64_t ret_ref = tag_ptr(ret_copy, true);
29954         return ret_ref;
29955 }
29956
29957 static inline uint64_t C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR arg) {
29958         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
29959         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(arg);
29960         return tag_ptr(ret_conv, true);
29961 }
29962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29963         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(arg);
29964         int64_t ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone_ptr(arg_conv);
29965         return ret_conv;
29966 }
29967
29968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29969         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)untag_ptr(orig);
29970         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
29971         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(orig_conv);
29972         return tag_ptr(ret_conv, true);
29973 }
29974
29975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
29976         LDKPublicKey a_ref;
29977         CHECK((*env)->GetArrayLength(env, a) == 33);
29978         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
29979         void* b_ptr = untag_ptr(b);
29980         CHECK_ACCESS(b_ptr);
29981         LDKCOption_SocketAddressZ b_conv = *(LDKCOption_SocketAddressZ*)(b_ptr);
29982         b_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(b));
29983         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
29984         *ret_conv = C2Tuple_PublicKeyCOption_SocketAddressZZ_new(a_ref, b_conv);
29985         return tag_ptr(ret_conv, true);
29986 }
29987
29988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1SocketAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29989         if (!ptr_is_owned(_res)) return;
29990         void* _res_ptr = untag_ptr(_res);
29991         CHECK_ACCESS(_res_ptr);
29992         LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_ptr);
29993         FREE(untag_ptr(_res));
29994         C2Tuple_PublicKeyCOption_SocketAddressZZ_free(_res_conv);
29995 }
29996
29997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyCOption_1SocketAddressZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29998         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ _res_constr;
29999         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30000         if (_res_constr.datalen > 0)
30001                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ Elements");
30002         else
30003                 _res_constr.data = NULL;
30004         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30005         for (size_t r = 0; r < _res_constr.datalen; r++) {
30006                 int64_t _res_conv_43 = _res_vals[r];
30007                 void* _res_conv_43_ptr = untag_ptr(_res_conv_43);
30008                 CHECK_ACCESS(_res_conv_43_ptr);
30009                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res_conv_43_conv = *(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ*)(_res_conv_43_ptr);
30010                 FREE(untag_ptr(_res_conv_43));
30011                 _res_constr.data[r] = _res_conv_43_conv;
30012         }
30013         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30014         CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(_res_constr);
30015 }
30016
30017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
30018         LDKCVec_u8Z o_ref;
30019         o_ref.datalen = (*env)->GetArrayLength(env, o);
30020         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
30021         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
30022         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
30023         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
30024         return tag_ptr(ret_conv, true);
30025 }
30026
30027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30028         LDKPeerHandleError e_conv;
30029         e_conv.inner = untag_ptr(e);
30030         e_conv.is_owned = ptr_is_owned(e);
30031         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
30032         e_conv = PeerHandleError_clone(&e_conv);
30033         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
30034         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
30035         return tag_ptr(ret_conv, true);
30036 }
30037
30038 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30039         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
30040         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
30041         return ret_conv;
30042 }
30043
30044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30045         if (!ptr_is_owned(_res)) return;
30046         void* _res_ptr = untag_ptr(_res);
30047         CHECK_ACCESS(_res_ptr);
30048         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
30049         FREE(untag_ptr(_res));
30050         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
30051 }
30052
30053 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
30054         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
30055         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
30056         return tag_ptr(ret_conv, true);
30057 }
30058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30059         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
30060         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
30061         return ret_conv;
30062 }
30063
30064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30065         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
30066         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
30067         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
30068         return tag_ptr(ret_conv, true);
30069 }
30070
30071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
30072         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
30073         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
30074         return tag_ptr(ret_conv, true);
30075 }
30076
30077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30078         LDKPeerHandleError e_conv;
30079         e_conv.inner = untag_ptr(e);
30080         e_conv.is_owned = ptr_is_owned(e);
30081         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
30082         e_conv = PeerHandleError_clone(&e_conv);
30083         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
30084         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
30085         return tag_ptr(ret_conv, true);
30086 }
30087
30088 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30089         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
30090         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
30091         return ret_conv;
30092 }
30093
30094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30095         if (!ptr_is_owned(_res)) return;
30096         void* _res_ptr = untag_ptr(_res);
30097         CHECK_ACCESS(_res_ptr);
30098         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
30099         FREE(untag_ptr(_res));
30100         CResult_NonePeerHandleErrorZ_free(_res_conv);
30101 }
30102
30103 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
30104         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
30105         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
30106         return tag_ptr(ret_conv, true);
30107 }
30108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30109         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
30110         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
30111         return ret_conv;
30112 }
30113
30114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30115         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
30116         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
30117         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
30118         return tag_ptr(ret_conv, true);
30119 }
30120
30121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
30122         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
30123         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
30124         return tag_ptr(ret_conv, true);
30125 }
30126
30127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30128         LDKPeerHandleError e_conv;
30129         e_conv.inner = untag_ptr(e);
30130         e_conv.is_owned = ptr_is_owned(e);
30131         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
30132         e_conv = PeerHandleError_clone(&e_conv);
30133         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
30134         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
30135         return tag_ptr(ret_conv, true);
30136 }
30137
30138 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30139         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
30140         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
30141         return ret_conv;
30142 }
30143
30144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30145         if (!ptr_is_owned(_res)) return;
30146         void* _res_ptr = untag_ptr(_res);
30147         CHECK_ACCESS(_res_ptr);
30148         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
30149         FREE(untag_ptr(_res));
30150         CResult_boolPeerHandleErrorZ_free(_res_conv);
30151 }
30152
30153 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
30154         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
30155         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
30156         return tag_ptr(ret_conv, true);
30157 }
30158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30159         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
30160         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
30161         return ret_conv;
30162 }
30163
30164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30165         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
30166         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
30167         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
30168         return tag_ptr(ret_conv, true);
30169 }
30170
30171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1ok(JNIEnv *env, jclass clz, int32_t o) {
30172         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
30173         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
30174         return tag_ptr(ret_conv, true);
30175 }
30176
30177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30178         void* e_ptr = untag_ptr(e);
30179         CHECK_ACCESS(e_ptr);
30180         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
30181         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
30182         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
30183         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
30184         return tag_ptr(ret_conv, true);
30185 }
30186
30187 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30188         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
30189         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
30190         return ret_conv;
30191 }
30192
30193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30194         if (!ptr_is_owned(_res)) return;
30195         void* _res_ptr = untag_ptr(_res);
30196         CHECK_ACCESS(_res_ptr);
30197         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
30198         FREE(untag_ptr(_res));
30199         CResult_u32GraphSyncErrorZ_free(_res_conv);
30200 }
30201
30202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
30203         LDKCVec_u8Z o_ref;
30204         o_ref.datalen = (*env)->GetArrayLength(env, o);
30205         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
30206         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
30207         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
30208         *ret_conv = CResult_CVec_u8ZIOErrorZ_ok(o_ref);
30209         return tag_ptr(ret_conv, true);
30210 }
30211
30212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
30213         LDKIOError e_conv = LDKIOError_from_java(env, e);
30214         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
30215         *ret_conv = CResult_CVec_u8ZIOErrorZ_err(e_conv);
30216         return tag_ptr(ret_conv, true);
30217 }
30218
30219 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30220         LDKCResult_CVec_u8ZIOErrorZ* o_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(o);
30221         jboolean ret_conv = CResult_CVec_u8ZIOErrorZ_is_ok(o_conv);
30222         return ret_conv;
30223 }
30224
30225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30226         if (!ptr_is_owned(_res)) return;
30227         void* _res_ptr = untag_ptr(_res);
30228         CHECK_ACCESS(_res_ptr);
30229         LDKCResult_CVec_u8ZIOErrorZ _res_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(_res_ptr);
30230         FREE(untag_ptr(_res));
30231         CResult_CVec_u8ZIOErrorZ_free(_res_conv);
30232 }
30233
30234 static inline uint64_t CResult_CVec_u8ZIOErrorZ_clone_ptr(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR arg) {
30235         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
30236         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(arg);
30237         return tag_ptr(ret_conv, true);
30238 }
30239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30240         LDKCResult_CVec_u8ZIOErrorZ* arg_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(arg);
30241         int64_t ret_conv = CResult_CVec_u8ZIOErrorZ_clone_ptr(arg_conv);
30242         return ret_conv;
30243 }
30244
30245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30246         LDKCResult_CVec_u8ZIOErrorZ* orig_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(orig);
30247         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
30248         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(orig_conv);
30249         return tag_ptr(ret_conv, true);
30250 }
30251
30252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1StrZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
30253         LDKCVec_StrZ _res_constr;
30254         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30255         if (_res_constr.datalen > 0)
30256                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
30257         else
30258                 _res_constr.data = NULL;
30259         for (size_t i = 0; i < _res_constr.datalen; i++) {
30260                 jstring _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
30261                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
30262                 _res_constr.data[i] = dummy;
30263         }
30264         CVec_StrZ_free(_res_constr);
30265 }
30266
30267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
30268         LDKCVec_StrZ o_constr;
30269         o_constr.datalen = (*env)->GetArrayLength(env, o);
30270         if (o_constr.datalen > 0)
30271                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
30272         else
30273                 o_constr.data = NULL;
30274         for (size_t i = 0; i < o_constr.datalen; i++) {
30275                 jstring o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
30276                 LDKStr o_conv_8_conv = java_to_owned_str(env, o_conv_8);
30277                 o_constr.data[i] = o_conv_8_conv;
30278         }
30279         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
30280         *ret_conv = CResult_CVec_StrZIOErrorZ_ok(o_constr);
30281         return tag_ptr(ret_conv, true);
30282 }
30283
30284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
30285         LDKIOError e_conv = LDKIOError_from_java(env, e);
30286         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
30287         *ret_conv = CResult_CVec_StrZIOErrorZ_err(e_conv);
30288         return tag_ptr(ret_conv, true);
30289 }
30290
30291 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30292         LDKCResult_CVec_StrZIOErrorZ* o_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(o);
30293         jboolean ret_conv = CResult_CVec_StrZIOErrorZ_is_ok(o_conv);
30294         return ret_conv;
30295 }
30296
30297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30298         if (!ptr_is_owned(_res)) return;
30299         void* _res_ptr = untag_ptr(_res);
30300         CHECK_ACCESS(_res_ptr);
30301         LDKCResult_CVec_StrZIOErrorZ _res_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(_res_ptr);
30302         FREE(untag_ptr(_res));
30303         CResult_CVec_StrZIOErrorZ_free(_res_conv);
30304 }
30305
30306 static inline uint64_t CResult_CVec_StrZIOErrorZ_clone_ptr(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR arg) {
30307         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
30308         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(arg);
30309         return tag_ptr(ret_conv, true);
30310 }
30311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30312         LDKCResult_CVec_StrZIOErrorZ* arg_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(arg);
30313         int64_t ret_conv = CResult_CVec_StrZIOErrorZ_clone_ptr(arg_conv);
30314         return ret_conv;
30315 }
30316
30317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30318         LDKCResult_CVec_StrZIOErrorZ* orig_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(orig);
30319         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
30320         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(orig_conv);
30321         return tag_ptr(ret_conv, true);
30322 }
30323
30324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30325         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res_constr;
30326         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30327         if (_res_constr.datalen > 0)
30328                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
30329         else
30330                 _res_constr.data = NULL;
30331         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30332         for (size_t o = 0; o < _res_constr.datalen; o++) {
30333                 int64_t _res_conv_40 = _res_vals[o];
30334                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
30335                 CHECK_ACCESS(_res_conv_40_ptr);
30336                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_conv_40_ptr);
30337                 FREE(untag_ptr(_res_conv_40));
30338                 _res_constr.data[o] = _res_conv_40_conv;
30339         }
30340         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30341         CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res_constr);
30342 }
30343
30344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
30345         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o_constr;
30346         o_constr.datalen = (*env)->GetArrayLength(env, o);
30347         if (o_constr.datalen > 0)
30348                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
30349         else
30350                 o_constr.data = NULL;
30351         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
30352         for (size_t o = 0; o < o_constr.datalen; o++) {
30353                 int64_t o_conv_40 = o_vals[o];
30354                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
30355                 CHECK_ACCESS(o_conv_40_ptr);
30356                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_conv_40_ptr);
30357                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o_conv_40));
30358                 o_constr.data[o] = o_conv_40_conv;
30359         }
30360         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
30361         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
30362         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o_constr);
30363         return tag_ptr(ret_conv, true);
30364 }
30365
30366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
30367         LDKIOError e_conv = LDKIOError_from_java(env, e);
30368         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
30369         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e_conv);
30370         return tag_ptr(ret_conv, true);
30371 }
30372
30373 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30374         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(o);
30375         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o_conv);
30376         return ret_conv;
30377 }
30378
30379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30380         if (!ptr_is_owned(_res)) return;
30381         void* _res_ptr = untag_ptr(_res);
30382         CHECK_ACCESS(_res_ptr);
30383         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)(_res_ptr);
30384         FREE(untag_ptr(_res));
30385         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res_conv);
30386 }
30387
30388 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR arg) {
30389         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
30390         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(arg);
30391         return tag_ptr(ret_conv, true);
30392 }
30393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30394         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(arg);
30395         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(arg_conv);
30396         return ret_conv;
30397 }
30398
30399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30400         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(orig);
30401         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
30402         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig_conv);
30403         return tag_ptr(ret_conv, true);
30404 }
30405
30406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30407         void* o_ptr = untag_ptr(o);
30408         CHECK_ACCESS(o_ptr);
30409         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
30410         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
30411         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
30412         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o_conv);
30413         return tag_ptr(ret_conv, true);
30414 }
30415
30416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
30417         LDKIOError e_conv = LDKIOError_from_java(env, e);
30418         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
30419         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e_conv);
30420         return tag_ptr(ret_conv, true);
30421 }
30422
30423 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30424         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(o);
30425         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o_conv);
30426         return ret_conv;
30427 }
30428
30429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30430         if (!ptr_is_owned(_res)) return;
30431         void* _res_ptr = untag_ptr(_res);
30432         CHECK_ACCESS(_res_ptr);
30433         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)(_res_ptr);
30434         FREE(untag_ptr(_res));
30435         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res_conv);
30436 }
30437
30438 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR arg) {
30439         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
30440         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(arg);
30441         return tag_ptr(ret_conv, true);
30442 }
30443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30444         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(arg);
30445         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(arg_conv);
30446         return ret_conv;
30447 }
30448
30449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30450         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(orig);
30451         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
30452         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig_conv);
30453         return tag_ptr(ret_conv, true);
30454 }
30455
30456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
30457         LDKSecretKey o_ref;
30458         CHECK((*env)->GetArrayLength(env, o) == 32);
30459         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
30460         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
30461         *ret_copy = COption_SecretKeyZ_some(o_ref);
30462         int64_t ret_ref = tag_ptr(ret_copy, true);
30463         return ret_ref;
30464 }
30465
30466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1none(JNIEnv *env, jclass clz) {
30467         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
30468         *ret_copy = COption_SecretKeyZ_none();
30469         int64_t ret_ref = tag_ptr(ret_copy, true);
30470         return ret_ref;
30471 }
30472
30473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30474         if (!ptr_is_owned(_res)) return;
30475         void* _res_ptr = untag_ptr(_res);
30476         CHECK_ACCESS(_res_ptr);
30477         LDKCOption_SecretKeyZ _res_conv = *(LDKCOption_SecretKeyZ*)(_res_ptr);
30478         FREE(untag_ptr(_res));
30479         COption_SecretKeyZ_free(_res_conv);
30480 }
30481
30482 static inline uint64_t COption_SecretKeyZ_clone_ptr(LDKCOption_SecretKeyZ *NONNULL_PTR arg) {
30483         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
30484         *ret_copy = COption_SecretKeyZ_clone(arg);
30485         int64_t ret_ref = tag_ptr(ret_copy, true);
30486         return ret_ref;
30487 }
30488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30489         LDKCOption_SecretKeyZ* arg_conv = (LDKCOption_SecretKeyZ*)untag_ptr(arg);
30490         int64_t ret_conv = COption_SecretKeyZ_clone_ptr(arg_conv);
30491         return ret_conv;
30492 }
30493
30494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30495         LDKCOption_SecretKeyZ* orig_conv = (LDKCOption_SecretKeyZ*)untag_ptr(orig);
30496         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
30497         *ret_copy = COption_SecretKeyZ_clone(orig_conv);
30498         int64_t ret_ref = tag_ptr(ret_copy, true);
30499         return ret_ref;
30500 }
30501
30502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30503         LDKVerifiedInvoiceRequest o_conv;
30504         o_conv.inner = untag_ptr(o);
30505         o_conv.is_owned = ptr_is_owned(o);
30506         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30507         o_conv = VerifiedInvoiceRequest_clone(&o_conv);
30508         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
30509         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_ok(o_conv);
30510         return tag_ptr(ret_conv, true);
30511 }
30512
30513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1err(JNIEnv *env, jclass clz) {
30514         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
30515         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_err();
30516         return tag_ptr(ret_conv, true);
30517 }
30518
30519 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30520         LDKCResult_VerifiedInvoiceRequestNoneZ* o_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(o);
30521         jboolean ret_conv = CResult_VerifiedInvoiceRequestNoneZ_is_ok(o_conv);
30522         return ret_conv;
30523 }
30524
30525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30526         if (!ptr_is_owned(_res)) return;
30527         void* _res_ptr = untag_ptr(_res);
30528         CHECK_ACCESS(_res_ptr);
30529         LDKCResult_VerifiedInvoiceRequestNoneZ _res_conv = *(LDKCResult_VerifiedInvoiceRequestNoneZ*)(_res_ptr);
30530         FREE(untag_ptr(_res));
30531         CResult_VerifiedInvoiceRequestNoneZ_free(_res_conv);
30532 }
30533
30534 static inline uint64_t CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR arg) {
30535         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
30536         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(arg);
30537         return tag_ptr(ret_conv, true);
30538 }
30539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30540         LDKCResult_VerifiedInvoiceRequestNoneZ* arg_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(arg);
30541         int64_t ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(arg_conv);
30542         return ret_conv;
30543 }
30544
30545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30546         LDKCResult_VerifiedInvoiceRequestNoneZ* orig_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(orig);
30547         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
30548         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(orig_conv);
30549         return tag_ptr(ret_conv, true);
30550 }
30551
30552 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
30553         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
30554         return ret_conv;
30555 }
30556
30557 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
30558         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
30559         return ret_conv;
30560 }
30561
30562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
30563         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
30564         COption_NoneZ_free(_res_conv);
30565 }
30566
30567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1WitnessZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
30568         LDKCVec_WitnessZ _res_constr;
30569         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30570         if (_res_constr.datalen > 0)
30571                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
30572         else
30573                 _res_constr.data = NULL;
30574         for (size_t i = 0; i < _res_constr.datalen; i++) {
30575                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
30576                 LDKWitness _res_conv_8_ref;
30577                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
30578                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKWitness Bytes");
30579                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
30580                 _res_conv_8_ref.data_is_owned = true;
30581                 _res_constr.data[i] = _res_conv_8_ref;
30582         }
30583         CVec_WitnessZ_free(_res_constr);
30584 }
30585
30586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
30587         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
30588         *ret_copy = COption_i64Z_some(o);
30589         int64_t ret_ref = tag_ptr(ret_copy, true);
30590         return ret_ref;
30591 }
30592
30593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1none(JNIEnv *env, jclass clz) {
30594         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
30595         *ret_copy = COption_i64Z_none();
30596         int64_t ret_ref = tag_ptr(ret_copy, true);
30597         return ret_ref;
30598 }
30599
30600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
30601         if (!ptr_is_owned(_res)) return;
30602         void* _res_ptr = untag_ptr(_res);
30603         CHECK_ACCESS(_res_ptr);
30604         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
30605         FREE(untag_ptr(_res));
30606         COption_i64Z_free(_res_conv);
30607 }
30608
30609 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
30610         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
30611         *ret_copy = COption_i64Z_clone(arg);
30612         int64_t ret_ref = tag_ptr(ret_copy, true);
30613         return ret_ref;
30614 }
30615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30616         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
30617         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
30618         return ret_conv;
30619 }
30620
30621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30622         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
30623         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
30624         *ret_copy = COption_i64Z_clone(orig_conv);
30625         int64_t ret_ref = tag_ptr(ret_copy, true);
30626         return ret_ref;
30627 }
30628
30629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30630         void* o_ptr = untag_ptr(o);
30631         CHECK_ACCESS(o_ptr);
30632         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
30633         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
30634         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
30635         *ret_conv = CResult_SocketAddressDecodeErrorZ_ok(o_conv);
30636         return tag_ptr(ret_conv, true);
30637 }
30638
30639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30640         void* e_ptr = untag_ptr(e);
30641         CHECK_ACCESS(e_ptr);
30642         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30643         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30644         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
30645         *ret_conv = CResult_SocketAddressDecodeErrorZ_err(e_conv);
30646         return tag_ptr(ret_conv, true);
30647 }
30648
30649 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30650         LDKCResult_SocketAddressDecodeErrorZ* o_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(o);
30651         jboolean ret_conv = CResult_SocketAddressDecodeErrorZ_is_ok(o_conv);
30652         return ret_conv;
30653 }
30654
30655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30656         if (!ptr_is_owned(_res)) return;
30657         void* _res_ptr = untag_ptr(_res);
30658         CHECK_ACCESS(_res_ptr);
30659         LDKCResult_SocketAddressDecodeErrorZ _res_conv = *(LDKCResult_SocketAddressDecodeErrorZ*)(_res_ptr);
30660         FREE(untag_ptr(_res));
30661         CResult_SocketAddressDecodeErrorZ_free(_res_conv);
30662 }
30663
30664 static inline uint64_t CResult_SocketAddressDecodeErrorZ_clone_ptr(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR arg) {
30665         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
30666         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(arg);
30667         return tag_ptr(ret_conv, true);
30668 }
30669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30670         LDKCResult_SocketAddressDecodeErrorZ* arg_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(arg);
30671         int64_t ret_conv = CResult_SocketAddressDecodeErrorZ_clone_ptr(arg_conv);
30672         return ret_conv;
30673 }
30674
30675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30676         LDKCResult_SocketAddressDecodeErrorZ* orig_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(orig);
30677         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
30678         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(orig_conv);
30679         return tag_ptr(ret_conv, true);
30680 }
30681
30682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30683         void* o_ptr = untag_ptr(o);
30684         CHECK_ACCESS(o_ptr);
30685         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
30686         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
30687         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
30688         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_ok(o_conv);
30689         return tag_ptr(ret_conv, true);
30690 }
30691
30692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
30693         LDKSocketAddressParseError e_conv = LDKSocketAddressParseError_from_java(env, e);
30694         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
30695         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_err(e_conv);
30696         return tag_ptr(ret_conv, true);
30697 }
30698
30699 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30700         LDKCResult_SocketAddressSocketAddressParseErrorZ* o_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(o);
30701         jboolean ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o_conv);
30702         return ret_conv;
30703 }
30704
30705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30706         if (!ptr_is_owned(_res)) return;
30707         void* _res_ptr = untag_ptr(_res);
30708         CHECK_ACCESS(_res_ptr);
30709         LDKCResult_SocketAddressSocketAddressParseErrorZ _res_conv = *(LDKCResult_SocketAddressSocketAddressParseErrorZ*)(_res_ptr);
30710         FREE(untag_ptr(_res));
30711         CResult_SocketAddressSocketAddressParseErrorZ_free(_res_conv);
30712 }
30713
30714 static inline uint64_t CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR arg) {
30715         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
30716         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(arg);
30717         return tag_ptr(ret_conv, true);
30718 }
30719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30720         LDKCResult_SocketAddressSocketAddressParseErrorZ* arg_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(arg);
30721         int64_t ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(arg_conv);
30722         return ret_conv;
30723 }
30724
30725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30726         LDKCResult_SocketAddressSocketAddressParseErrorZ* orig_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(orig);
30727         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
30728         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(orig_conv);
30729         return tag_ptr(ret_conv, true);
30730 }
30731
30732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30733         LDKCVec_UpdateAddHTLCZ _res_constr;
30734         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30735         if (_res_constr.datalen > 0)
30736                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
30737         else
30738                 _res_constr.data = NULL;
30739         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30740         for (size_t p = 0; p < _res_constr.datalen; p++) {
30741                 int64_t _res_conv_15 = _res_vals[p];
30742                 LDKUpdateAddHTLC _res_conv_15_conv;
30743                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
30744                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
30745                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
30746                 _res_constr.data[p] = _res_conv_15_conv;
30747         }
30748         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30749         CVec_UpdateAddHTLCZ_free(_res_constr);
30750 }
30751
30752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30753         LDKCVec_UpdateFulfillHTLCZ _res_constr;
30754         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30755         if (_res_constr.datalen > 0)
30756                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
30757         else
30758                 _res_constr.data = NULL;
30759         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30760         for (size_t t = 0; t < _res_constr.datalen; t++) {
30761                 int64_t _res_conv_19 = _res_vals[t];
30762                 LDKUpdateFulfillHTLC _res_conv_19_conv;
30763                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
30764                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
30765                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
30766                 _res_constr.data[t] = _res_conv_19_conv;
30767         }
30768         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30769         CVec_UpdateFulfillHTLCZ_free(_res_constr);
30770 }
30771
30772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30773         LDKCVec_UpdateFailHTLCZ _res_constr;
30774         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30775         if (_res_constr.datalen > 0)
30776                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
30777         else
30778                 _res_constr.data = NULL;
30779         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30780         for (size_t q = 0; q < _res_constr.datalen; q++) {
30781                 int64_t _res_conv_16 = _res_vals[q];
30782                 LDKUpdateFailHTLC _res_conv_16_conv;
30783                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
30784                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
30785                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
30786                 _res_constr.data[q] = _res_conv_16_conv;
30787         }
30788         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30789         CVec_UpdateFailHTLCZ_free(_res_constr);
30790 }
30791
30792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30793         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
30794         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30795         if (_res_constr.datalen > 0)
30796                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
30797         else
30798                 _res_constr.data = NULL;
30799         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30800         for (size_t z = 0; z < _res_constr.datalen; z++) {
30801                 int64_t _res_conv_25 = _res_vals[z];
30802                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
30803                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
30804                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
30805                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
30806                 _res_constr.data[z] = _res_conv_25_conv;
30807         }
30808         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30809         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
30810 }
30811
30812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30813         LDKAcceptChannel o_conv;
30814         o_conv.inner = untag_ptr(o);
30815         o_conv.is_owned = ptr_is_owned(o);
30816         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30817         o_conv = AcceptChannel_clone(&o_conv);
30818         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
30819         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
30820         return tag_ptr(ret_conv, true);
30821 }
30822
30823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30824         void* e_ptr = untag_ptr(e);
30825         CHECK_ACCESS(e_ptr);
30826         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30827         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30828         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
30829         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
30830         return tag_ptr(ret_conv, true);
30831 }
30832
30833 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30834         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
30835         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
30836         return ret_conv;
30837 }
30838
30839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30840         if (!ptr_is_owned(_res)) return;
30841         void* _res_ptr = untag_ptr(_res);
30842         CHECK_ACCESS(_res_ptr);
30843         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
30844         FREE(untag_ptr(_res));
30845         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
30846 }
30847
30848 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
30849         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
30850         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
30851         return tag_ptr(ret_conv, true);
30852 }
30853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30854         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
30855         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
30856         return ret_conv;
30857 }
30858
30859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30860         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
30861         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
30862         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
30863         return tag_ptr(ret_conv, true);
30864 }
30865
30866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30867         LDKAcceptChannelV2 o_conv;
30868         o_conv.inner = untag_ptr(o);
30869         o_conv.is_owned = ptr_is_owned(o);
30870         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30871         o_conv = AcceptChannelV2_clone(&o_conv);
30872         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
30873         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
30874         return tag_ptr(ret_conv, true);
30875 }
30876
30877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30878         void* e_ptr = untag_ptr(e);
30879         CHECK_ACCESS(e_ptr);
30880         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30881         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30882         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
30883         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
30884         return tag_ptr(ret_conv, true);
30885 }
30886
30887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30888         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
30889         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
30890         return ret_conv;
30891 }
30892
30893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30894         if (!ptr_is_owned(_res)) return;
30895         void* _res_ptr = untag_ptr(_res);
30896         CHECK_ACCESS(_res_ptr);
30897         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
30898         FREE(untag_ptr(_res));
30899         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
30900 }
30901
30902 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
30903         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
30904         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
30905         return tag_ptr(ret_conv, true);
30906 }
30907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30908         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
30909         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
30910         return ret_conv;
30911 }
30912
30913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30914         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
30915         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
30916         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
30917         return tag_ptr(ret_conv, true);
30918 }
30919
30920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30921         LDKStfu o_conv;
30922         o_conv.inner = untag_ptr(o);
30923         o_conv.is_owned = ptr_is_owned(o);
30924         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30925         o_conv = Stfu_clone(&o_conv);
30926         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
30927         *ret_conv = CResult_StfuDecodeErrorZ_ok(o_conv);
30928         return tag_ptr(ret_conv, true);
30929 }
30930
30931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30932         void* e_ptr = untag_ptr(e);
30933         CHECK_ACCESS(e_ptr);
30934         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30935         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30936         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
30937         *ret_conv = CResult_StfuDecodeErrorZ_err(e_conv);
30938         return tag_ptr(ret_conv, true);
30939 }
30940
30941 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30942         LDKCResult_StfuDecodeErrorZ* o_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(o);
30943         jboolean ret_conv = CResult_StfuDecodeErrorZ_is_ok(o_conv);
30944         return ret_conv;
30945 }
30946
30947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30948         if (!ptr_is_owned(_res)) return;
30949         void* _res_ptr = untag_ptr(_res);
30950         CHECK_ACCESS(_res_ptr);
30951         LDKCResult_StfuDecodeErrorZ _res_conv = *(LDKCResult_StfuDecodeErrorZ*)(_res_ptr);
30952         FREE(untag_ptr(_res));
30953         CResult_StfuDecodeErrorZ_free(_res_conv);
30954 }
30955
30956 static inline uint64_t CResult_StfuDecodeErrorZ_clone_ptr(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR arg) {
30957         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
30958         *ret_conv = CResult_StfuDecodeErrorZ_clone(arg);
30959         return tag_ptr(ret_conv, true);
30960 }
30961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30962         LDKCResult_StfuDecodeErrorZ* arg_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(arg);
30963         int64_t ret_conv = CResult_StfuDecodeErrorZ_clone_ptr(arg_conv);
30964         return ret_conv;
30965 }
30966
30967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30968         LDKCResult_StfuDecodeErrorZ* orig_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(orig);
30969         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
30970         *ret_conv = CResult_StfuDecodeErrorZ_clone(orig_conv);
30971         return tag_ptr(ret_conv, true);
30972 }
30973
30974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30975         LDKSplice o_conv;
30976         o_conv.inner = untag_ptr(o);
30977         o_conv.is_owned = ptr_is_owned(o);
30978         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30979         o_conv = Splice_clone(&o_conv);
30980         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
30981         *ret_conv = CResult_SpliceDecodeErrorZ_ok(o_conv);
30982         return tag_ptr(ret_conv, true);
30983 }
30984
30985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30986         void* e_ptr = untag_ptr(e);
30987         CHECK_ACCESS(e_ptr);
30988         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30989         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30990         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
30991         *ret_conv = CResult_SpliceDecodeErrorZ_err(e_conv);
30992         return tag_ptr(ret_conv, true);
30993 }
30994
30995 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30996         LDKCResult_SpliceDecodeErrorZ* o_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(o);
30997         jboolean ret_conv = CResult_SpliceDecodeErrorZ_is_ok(o_conv);
30998         return ret_conv;
30999 }
31000
31001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31002         if (!ptr_is_owned(_res)) return;
31003         void* _res_ptr = untag_ptr(_res);
31004         CHECK_ACCESS(_res_ptr);
31005         LDKCResult_SpliceDecodeErrorZ _res_conv = *(LDKCResult_SpliceDecodeErrorZ*)(_res_ptr);
31006         FREE(untag_ptr(_res));
31007         CResult_SpliceDecodeErrorZ_free(_res_conv);
31008 }
31009
31010 static inline uint64_t CResult_SpliceDecodeErrorZ_clone_ptr(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR arg) {
31011         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
31012         *ret_conv = CResult_SpliceDecodeErrorZ_clone(arg);
31013         return tag_ptr(ret_conv, true);
31014 }
31015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31016         LDKCResult_SpliceDecodeErrorZ* arg_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(arg);
31017         int64_t ret_conv = CResult_SpliceDecodeErrorZ_clone_ptr(arg_conv);
31018         return ret_conv;
31019 }
31020
31021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31022         LDKCResult_SpliceDecodeErrorZ* orig_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(orig);
31023         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
31024         *ret_conv = CResult_SpliceDecodeErrorZ_clone(orig_conv);
31025         return tag_ptr(ret_conv, true);
31026 }
31027
31028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31029         LDKSpliceAck o_conv;
31030         o_conv.inner = untag_ptr(o);
31031         o_conv.is_owned = ptr_is_owned(o);
31032         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31033         o_conv = SpliceAck_clone(&o_conv);
31034         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
31035         *ret_conv = CResult_SpliceAckDecodeErrorZ_ok(o_conv);
31036         return tag_ptr(ret_conv, true);
31037 }
31038
31039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31040         void* e_ptr = untag_ptr(e);
31041         CHECK_ACCESS(e_ptr);
31042         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31043         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31044         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
31045         *ret_conv = CResult_SpliceAckDecodeErrorZ_err(e_conv);
31046         return tag_ptr(ret_conv, true);
31047 }
31048
31049 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31050         LDKCResult_SpliceAckDecodeErrorZ* o_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(o);
31051         jboolean ret_conv = CResult_SpliceAckDecodeErrorZ_is_ok(o_conv);
31052         return ret_conv;
31053 }
31054
31055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31056         if (!ptr_is_owned(_res)) return;
31057         void* _res_ptr = untag_ptr(_res);
31058         CHECK_ACCESS(_res_ptr);
31059         LDKCResult_SpliceAckDecodeErrorZ _res_conv = *(LDKCResult_SpliceAckDecodeErrorZ*)(_res_ptr);
31060         FREE(untag_ptr(_res));
31061         CResult_SpliceAckDecodeErrorZ_free(_res_conv);
31062 }
31063
31064 static inline uint64_t CResult_SpliceAckDecodeErrorZ_clone_ptr(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR arg) {
31065         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
31066         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(arg);
31067         return tag_ptr(ret_conv, true);
31068 }
31069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31070         LDKCResult_SpliceAckDecodeErrorZ* arg_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(arg);
31071         int64_t ret_conv = CResult_SpliceAckDecodeErrorZ_clone_ptr(arg_conv);
31072         return ret_conv;
31073 }
31074
31075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31076         LDKCResult_SpliceAckDecodeErrorZ* orig_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(orig);
31077         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
31078         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(orig_conv);
31079         return tag_ptr(ret_conv, true);
31080 }
31081
31082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31083         LDKSpliceLocked o_conv;
31084         o_conv.inner = untag_ptr(o);
31085         o_conv.is_owned = ptr_is_owned(o);
31086         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31087         o_conv = SpliceLocked_clone(&o_conv);
31088         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
31089         *ret_conv = CResult_SpliceLockedDecodeErrorZ_ok(o_conv);
31090         return tag_ptr(ret_conv, true);
31091 }
31092
31093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31094         void* e_ptr = untag_ptr(e);
31095         CHECK_ACCESS(e_ptr);
31096         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31097         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31098         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
31099         *ret_conv = CResult_SpliceLockedDecodeErrorZ_err(e_conv);
31100         return tag_ptr(ret_conv, true);
31101 }
31102
31103 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31104         LDKCResult_SpliceLockedDecodeErrorZ* o_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(o);
31105         jboolean ret_conv = CResult_SpliceLockedDecodeErrorZ_is_ok(o_conv);
31106         return ret_conv;
31107 }
31108
31109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31110         if (!ptr_is_owned(_res)) return;
31111         void* _res_ptr = untag_ptr(_res);
31112         CHECK_ACCESS(_res_ptr);
31113         LDKCResult_SpliceLockedDecodeErrorZ _res_conv = *(LDKCResult_SpliceLockedDecodeErrorZ*)(_res_ptr);
31114         FREE(untag_ptr(_res));
31115         CResult_SpliceLockedDecodeErrorZ_free(_res_conv);
31116 }
31117
31118 static inline uint64_t CResult_SpliceLockedDecodeErrorZ_clone_ptr(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR arg) {
31119         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
31120         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(arg);
31121         return tag_ptr(ret_conv, true);
31122 }
31123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31124         LDKCResult_SpliceLockedDecodeErrorZ* arg_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(arg);
31125         int64_t ret_conv = CResult_SpliceLockedDecodeErrorZ_clone_ptr(arg_conv);
31126         return ret_conv;
31127 }
31128
31129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31130         LDKCResult_SpliceLockedDecodeErrorZ* orig_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(orig);
31131         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
31132         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(orig_conv);
31133         return tag_ptr(ret_conv, true);
31134 }
31135
31136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31137         LDKTxAddInput o_conv;
31138         o_conv.inner = untag_ptr(o);
31139         o_conv.is_owned = ptr_is_owned(o);
31140         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31141         o_conv = TxAddInput_clone(&o_conv);
31142         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
31143         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
31144         return tag_ptr(ret_conv, true);
31145 }
31146
31147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31148         void* e_ptr = untag_ptr(e);
31149         CHECK_ACCESS(e_ptr);
31150         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31151         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31152         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
31153         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
31154         return tag_ptr(ret_conv, true);
31155 }
31156
31157 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31158         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
31159         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
31160         return ret_conv;
31161 }
31162
31163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31164         if (!ptr_is_owned(_res)) return;
31165         void* _res_ptr = untag_ptr(_res);
31166         CHECK_ACCESS(_res_ptr);
31167         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
31168         FREE(untag_ptr(_res));
31169         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
31170 }
31171
31172 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
31173         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
31174         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
31175         return tag_ptr(ret_conv, true);
31176 }
31177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31178         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
31179         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
31180         return ret_conv;
31181 }
31182
31183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31184         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
31185         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
31186         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
31187         return tag_ptr(ret_conv, true);
31188 }
31189
31190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31191         LDKTxAddOutput o_conv;
31192         o_conv.inner = untag_ptr(o);
31193         o_conv.is_owned = ptr_is_owned(o);
31194         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31195         o_conv = TxAddOutput_clone(&o_conv);
31196         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
31197         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
31198         return tag_ptr(ret_conv, true);
31199 }
31200
31201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31202         void* e_ptr = untag_ptr(e);
31203         CHECK_ACCESS(e_ptr);
31204         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31205         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31206         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
31207         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
31208         return tag_ptr(ret_conv, true);
31209 }
31210
31211 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31212         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
31213         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
31214         return ret_conv;
31215 }
31216
31217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31218         if (!ptr_is_owned(_res)) return;
31219         void* _res_ptr = untag_ptr(_res);
31220         CHECK_ACCESS(_res_ptr);
31221         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
31222         FREE(untag_ptr(_res));
31223         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
31224 }
31225
31226 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
31227         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
31228         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
31229         return tag_ptr(ret_conv, true);
31230 }
31231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31232         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
31233         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
31234         return ret_conv;
31235 }
31236
31237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31238         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
31239         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
31240         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
31241         return tag_ptr(ret_conv, true);
31242 }
31243
31244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31245         LDKTxRemoveInput o_conv;
31246         o_conv.inner = untag_ptr(o);
31247         o_conv.is_owned = ptr_is_owned(o);
31248         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31249         o_conv = TxRemoveInput_clone(&o_conv);
31250         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
31251         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
31252         return tag_ptr(ret_conv, true);
31253 }
31254
31255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31256         void* e_ptr = untag_ptr(e);
31257         CHECK_ACCESS(e_ptr);
31258         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31259         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31260         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
31261         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
31262         return tag_ptr(ret_conv, true);
31263 }
31264
31265 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31266         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
31267         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
31268         return ret_conv;
31269 }
31270
31271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31272         if (!ptr_is_owned(_res)) return;
31273         void* _res_ptr = untag_ptr(_res);
31274         CHECK_ACCESS(_res_ptr);
31275         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
31276         FREE(untag_ptr(_res));
31277         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
31278 }
31279
31280 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
31281         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
31282         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
31283         return tag_ptr(ret_conv, true);
31284 }
31285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31286         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
31287         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
31288         return ret_conv;
31289 }
31290
31291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31292         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
31293         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
31294         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
31295         return tag_ptr(ret_conv, true);
31296 }
31297
31298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31299         LDKTxRemoveOutput o_conv;
31300         o_conv.inner = untag_ptr(o);
31301         o_conv.is_owned = ptr_is_owned(o);
31302         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31303         o_conv = TxRemoveOutput_clone(&o_conv);
31304         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
31305         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
31306         return tag_ptr(ret_conv, true);
31307 }
31308
31309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31310         void* e_ptr = untag_ptr(e);
31311         CHECK_ACCESS(e_ptr);
31312         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31313         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31314         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
31315         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
31316         return tag_ptr(ret_conv, true);
31317 }
31318
31319 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31320         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
31321         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
31322         return ret_conv;
31323 }
31324
31325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31326         if (!ptr_is_owned(_res)) return;
31327         void* _res_ptr = untag_ptr(_res);
31328         CHECK_ACCESS(_res_ptr);
31329         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
31330         FREE(untag_ptr(_res));
31331         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
31332 }
31333
31334 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
31335         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
31336         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
31337         return tag_ptr(ret_conv, true);
31338 }
31339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31340         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
31341         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
31342         return ret_conv;
31343 }
31344
31345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31346         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
31347         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
31348         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
31349         return tag_ptr(ret_conv, true);
31350 }
31351
31352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31353         LDKTxComplete o_conv;
31354         o_conv.inner = untag_ptr(o);
31355         o_conv.is_owned = ptr_is_owned(o);
31356         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31357         o_conv = TxComplete_clone(&o_conv);
31358         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
31359         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
31360         return tag_ptr(ret_conv, true);
31361 }
31362
31363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31364         void* e_ptr = untag_ptr(e);
31365         CHECK_ACCESS(e_ptr);
31366         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31367         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31368         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
31369         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
31370         return tag_ptr(ret_conv, true);
31371 }
31372
31373 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31374         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
31375         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
31376         return ret_conv;
31377 }
31378
31379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31380         if (!ptr_is_owned(_res)) return;
31381         void* _res_ptr = untag_ptr(_res);
31382         CHECK_ACCESS(_res_ptr);
31383         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
31384         FREE(untag_ptr(_res));
31385         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
31386 }
31387
31388 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
31389         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
31390         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
31391         return tag_ptr(ret_conv, true);
31392 }
31393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31394         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
31395         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
31396         return ret_conv;
31397 }
31398
31399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31400         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
31401         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
31402         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
31403         return tag_ptr(ret_conv, true);
31404 }
31405
31406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31407         LDKTxSignatures o_conv;
31408         o_conv.inner = untag_ptr(o);
31409         o_conv.is_owned = ptr_is_owned(o);
31410         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31411         o_conv = TxSignatures_clone(&o_conv);
31412         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
31413         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
31414         return tag_ptr(ret_conv, true);
31415 }
31416
31417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31418         void* e_ptr = untag_ptr(e);
31419         CHECK_ACCESS(e_ptr);
31420         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31421         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31422         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
31423         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
31424         return tag_ptr(ret_conv, true);
31425 }
31426
31427 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31428         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
31429         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
31430         return ret_conv;
31431 }
31432
31433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31434         if (!ptr_is_owned(_res)) return;
31435         void* _res_ptr = untag_ptr(_res);
31436         CHECK_ACCESS(_res_ptr);
31437         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
31438         FREE(untag_ptr(_res));
31439         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
31440 }
31441
31442 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
31443         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
31444         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
31445         return tag_ptr(ret_conv, true);
31446 }
31447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31448         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
31449         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
31450         return ret_conv;
31451 }
31452
31453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31454         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
31455         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
31456         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
31457         return tag_ptr(ret_conv, true);
31458 }
31459
31460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31461         LDKTxInitRbf o_conv;
31462         o_conv.inner = untag_ptr(o);
31463         o_conv.is_owned = ptr_is_owned(o);
31464         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31465         o_conv = TxInitRbf_clone(&o_conv);
31466         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
31467         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
31468         return tag_ptr(ret_conv, true);
31469 }
31470
31471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31472         void* e_ptr = untag_ptr(e);
31473         CHECK_ACCESS(e_ptr);
31474         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31475         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31476         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
31477         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
31478         return tag_ptr(ret_conv, true);
31479 }
31480
31481 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31482         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
31483         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
31484         return ret_conv;
31485 }
31486
31487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31488         if (!ptr_is_owned(_res)) return;
31489         void* _res_ptr = untag_ptr(_res);
31490         CHECK_ACCESS(_res_ptr);
31491         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
31492         FREE(untag_ptr(_res));
31493         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
31494 }
31495
31496 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
31497         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
31498         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
31499         return tag_ptr(ret_conv, true);
31500 }
31501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31502         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
31503         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
31504         return ret_conv;
31505 }
31506
31507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31508         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
31509         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
31510         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
31511         return tag_ptr(ret_conv, true);
31512 }
31513
31514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31515         LDKTxAckRbf o_conv;
31516         o_conv.inner = untag_ptr(o);
31517         o_conv.is_owned = ptr_is_owned(o);
31518         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31519         o_conv = TxAckRbf_clone(&o_conv);
31520         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
31521         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
31522         return tag_ptr(ret_conv, true);
31523 }
31524
31525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31526         void* e_ptr = untag_ptr(e);
31527         CHECK_ACCESS(e_ptr);
31528         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31529         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31530         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
31531         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
31532         return tag_ptr(ret_conv, true);
31533 }
31534
31535 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31536         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
31537         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
31538         return ret_conv;
31539 }
31540
31541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31542         if (!ptr_is_owned(_res)) return;
31543         void* _res_ptr = untag_ptr(_res);
31544         CHECK_ACCESS(_res_ptr);
31545         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
31546         FREE(untag_ptr(_res));
31547         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
31548 }
31549
31550 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
31551         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
31552         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
31553         return tag_ptr(ret_conv, true);
31554 }
31555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31556         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
31557         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
31558         return ret_conv;
31559 }
31560
31561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31562         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
31563         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
31564         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
31565         return tag_ptr(ret_conv, true);
31566 }
31567
31568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31569         LDKTxAbort o_conv;
31570         o_conv.inner = untag_ptr(o);
31571         o_conv.is_owned = ptr_is_owned(o);
31572         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31573         o_conv = TxAbort_clone(&o_conv);
31574         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
31575         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
31576         return tag_ptr(ret_conv, true);
31577 }
31578
31579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31580         void* e_ptr = untag_ptr(e);
31581         CHECK_ACCESS(e_ptr);
31582         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31583         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31584         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
31585         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
31586         return tag_ptr(ret_conv, true);
31587 }
31588
31589 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31590         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
31591         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
31592         return ret_conv;
31593 }
31594
31595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31596         if (!ptr_is_owned(_res)) return;
31597         void* _res_ptr = untag_ptr(_res);
31598         CHECK_ACCESS(_res_ptr);
31599         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
31600         FREE(untag_ptr(_res));
31601         CResult_TxAbortDecodeErrorZ_free(_res_conv);
31602 }
31603
31604 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
31605         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
31606         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
31607         return tag_ptr(ret_conv, true);
31608 }
31609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31610         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
31611         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
31612         return ret_conv;
31613 }
31614
31615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31616         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
31617         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
31618         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
31619         return tag_ptr(ret_conv, true);
31620 }
31621
31622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31623         LDKAnnouncementSignatures o_conv;
31624         o_conv.inner = untag_ptr(o);
31625         o_conv.is_owned = ptr_is_owned(o);
31626         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31627         o_conv = AnnouncementSignatures_clone(&o_conv);
31628         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
31629         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
31630         return tag_ptr(ret_conv, true);
31631 }
31632
31633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31634         void* e_ptr = untag_ptr(e);
31635         CHECK_ACCESS(e_ptr);
31636         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31637         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31638         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
31639         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
31640         return tag_ptr(ret_conv, true);
31641 }
31642
31643 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31644         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
31645         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
31646         return ret_conv;
31647 }
31648
31649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31650         if (!ptr_is_owned(_res)) return;
31651         void* _res_ptr = untag_ptr(_res);
31652         CHECK_ACCESS(_res_ptr);
31653         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
31654         FREE(untag_ptr(_res));
31655         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
31656 }
31657
31658 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
31659         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
31660         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
31661         return tag_ptr(ret_conv, true);
31662 }
31663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31664         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
31665         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
31666         return ret_conv;
31667 }
31668
31669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31670         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
31671         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
31672         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
31673         return tag_ptr(ret_conv, true);
31674 }
31675
31676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31677         LDKChannelReestablish o_conv;
31678         o_conv.inner = untag_ptr(o);
31679         o_conv.is_owned = ptr_is_owned(o);
31680         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31681         o_conv = ChannelReestablish_clone(&o_conv);
31682         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
31683         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
31684         return tag_ptr(ret_conv, true);
31685 }
31686
31687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31688         void* e_ptr = untag_ptr(e);
31689         CHECK_ACCESS(e_ptr);
31690         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31691         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31692         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
31693         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
31694         return tag_ptr(ret_conv, true);
31695 }
31696
31697 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31698         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
31699         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
31700         return ret_conv;
31701 }
31702
31703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31704         if (!ptr_is_owned(_res)) return;
31705         void* _res_ptr = untag_ptr(_res);
31706         CHECK_ACCESS(_res_ptr);
31707         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
31708         FREE(untag_ptr(_res));
31709         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
31710 }
31711
31712 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
31713         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
31714         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
31715         return tag_ptr(ret_conv, true);
31716 }
31717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31718         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
31719         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
31720         return ret_conv;
31721 }
31722
31723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31724         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
31725         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
31726         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
31727         return tag_ptr(ret_conv, true);
31728 }
31729
31730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31731         LDKClosingSigned o_conv;
31732         o_conv.inner = untag_ptr(o);
31733         o_conv.is_owned = ptr_is_owned(o);
31734         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31735         o_conv = ClosingSigned_clone(&o_conv);
31736         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
31737         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
31738         return tag_ptr(ret_conv, true);
31739 }
31740
31741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31742         void* e_ptr = untag_ptr(e);
31743         CHECK_ACCESS(e_ptr);
31744         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31745         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31746         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
31747         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
31748         return tag_ptr(ret_conv, true);
31749 }
31750
31751 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31752         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
31753         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
31754         return ret_conv;
31755 }
31756
31757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31758         if (!ptr_is_owned(_res)) return;
31759         void* _res_ptr = untag_ptr(_res);
31760         CHECK_ACCESS(_res_ptr);
31761         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
31762         FREE(untag_ptr(_res));
31763         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
31764 }
31765
31766 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
31767         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
31768         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
31769         return tag_ptr(ret_conv, true);
31770 }
31771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31772         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
31773         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
31774         return ret_conv;
31775 }
31776
31777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31778         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
31779         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
31780         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
31781         return tag_ptr(ret_conv, true);
31782 }
31783
31784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31785         LDKClosingSignedFeeRange o_conv;
31786         o_conv.inner = untag_ptr(o);
31787         o_conv.is_owned = ptr_is_owned(o);
31788         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31789         o_conv = ClosingSignedFeeRange_clone(&o_conv);
31790         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
31791         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
31792         return tag_ptr(ret_conv, true);
31793 }
31794
31795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31796         void* e_ptr = untag_ptr(e);
31797         CHECK_ACCESS(e_ptr);
31798         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31799         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31800         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
31801         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
31802         return tag_ptr(ret_conv, true);
31803 }
31804
31805 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31806         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
31807         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
31808         return ret_conv;
31809 }
31810
31811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31812         if (!ptr_is_owned(_res)) return;
31813         void* _res_ptr = untag_ptr(_res);
31814         CHECK_ACCESS(_res_ptr);
31815         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
31816         FREE(untag_ptr(_res));
31817         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
31818 }
31819
31820 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
31821         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
31822         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
31823         return tag_ptr(ret_conv, true);
31824 }
31825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31826         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
31827         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
31828         return ret_conv;
31829 }
31830
31831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31832         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
31833         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
31834         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
31835         return tag_ptr(ret_conv, true);
31836 }
31837
31838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31839         LDKCommitmentSigned o_conv;
31840         o_conv.inner = untag_ptr(o);
31841         o_conv.is_owned = ptr_is_owned(o);
31842         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31843         o_conv = CommitmentSigned_clone(&o_conv);
31844         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
31845         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
31846         return tag_ptr(ret_conv, true);
31847 }
31848
31849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31850         void* e_ptr = untag_ptr(e);
31851         CHECK_ACCESS(e_ptr);
31852         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31853         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31854         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
31855         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
31856         return tag_ptr(ret_conv, true);
31857 }
31858
31859 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31860         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
31861         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
31862         return ret_conv;
31863 }
31864
31865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31866         if (!ptr_is_owned(_res)) return;
31867         void* _res_ptr = untag_ptr(_res);
31868         CHECK_ACCESS(_res_ptr);
31869         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
31870         FREE(untag_ptr(_res));
31871         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
31872 }
31873
31874 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
31875         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
31876         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
31877         return tag_ptr(ret_conv, true);
31878 }
31879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31880         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
31881         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
31882         return ret_conv;
31883 }
31884
31885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31886         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
31887         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
31888         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
31889         return tag_ptr(ret_conv, true);
31890 }
31891
31892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31893         LDKFundingCreated o_conv;
31894         o_conv.inner = untag_ptr(o);
31895         o_conv.is_owned = ptr_is_owned(o);
31896         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31897         o_conv = FundingCreated_clone(&o_conv);
31898         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
31899         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
31900         return tag_ptr(ret_conv, true);
31901 }
31902
31903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31904         void* e_ptr = untag_ptr(e);
31905         CHECK_ACCESS(e_ptr);
31906         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31907         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31908         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
31909         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
31910         return tag_ptr(ret_conv, true);
31911 }
31912
31913 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31914         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
31915         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
31916         return ret_conv;
31917 }
31918
31919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31920         if (!ptr_is_owned(_res)) return;
31921         void* _res_ptr = untag_ptr(_res);
31922         CHECK_ACCESS(_res_ptr);
31923         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
31924         FREE(untag_ptr(_res));
31925         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
31926 }
31927
31928 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
31929         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
31930         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
31931         return tag_ptr(ret_conv, true);
31932 }
31933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31934         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
31935         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
31936         return ret_conv;
31937 }
31938
31939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31940         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
31941         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
31942         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
31943         return tag_ptr(ret_conv, true);
31944 }
31945
31946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31947         LDKFundingSigned o_conv;
31948         o_conv.inner = untag_ptr(o);
31949         o_conv.is_owned = ptr_is_owned(o);
31950         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31951         o_conv = FundingSigned_clone(&o_conv);
31952         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
31953         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
31954         return tag_ptr(ret_conv, true);
31955 }
31956
31957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31958         void* e_ptr = untag_ptr(e);
31959         CHECK_ACCESS(e_ptr);
31960         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31961         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31962         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
31963         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
31964         return tag_ptr(ret_conv, true);
31965 }
31966
31967 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31968         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
31969         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
31970         return ret_conv;
31971 }
31972
31973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31974         if (!ptr_is_owned(_res)) return;
31975         void* _res_ptr = untag_ptr(_res);
31976         CHECK_ACCESS(_res_ptr);
31977         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
31978         FREE(untag_ptr(_res));
31979         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
31980 }
31981
31982 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
31983         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
31984         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
31985         return tag_ptr(ret_conv, true);
31986 }
31987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31988         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
31989         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
31990         return ret_conv;
31991 }
31992
31993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31994         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
31995         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
31996         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
31997         return tag_ptr(ret_conv, true);
31998 }
31999
32000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32001         LDKChannelReady o_conv;
32002         o_conv.inner = untag_ptr(o);
32003         o_conv.is_owned = ptr_is_owned(o);
32004         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32005         o_conv = ChannelReady_clone(&o_conv);
32006         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
32007         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
32008         return tag_ptr(ret_conv, true);
32009 }
32010
32011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32012         void* e_ptr = untag_ptr(e);
32013         CHECK_ACCESS(e_ptr);
32014         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32015         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32016         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
32017         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
32018         return tag_ptr(ret_conv, true);
32019 }
32020
32021 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32022         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
32023         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
32024         return ret_conv;
32025 }
32026
32027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32028         if (!ptr_is_owned(_res)) return;
32029         void* _res_ptr = untag_ptr(_res);
32030         CHECK_ACCESS(_res_ptr);
32031         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
32032         FREE(untag_ptr(_res));
32033         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
32034 }
32035
32036 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
32037         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
32038         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
32039         return tag_ptr(ret_conv, true);
32040 }
32041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32042         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
32043         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
32044         return ret_conv;
32045 }
32046
32047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32048         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
32049         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
32050         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
32051         return tag_ptr(ret_conv, true);
32052 }
32053
32054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32055         LDKInit o_conv;
32056         o_conv.inner = untag_ptr(o);
32057         o_conv.is_owned = ptr_is_owned(o);
32058         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32059         o_conv = Init_clone(&o_conv);
32060         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
32061         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
32062         return tag_ptr(ret_conv, true);
32063 }
32064
32065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32066         void* e_ptr = untag_ptr(e);
32067         CHECK_ACCESS(e_ptr);
32068         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32069         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32070         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
32071         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
32072         return tag_ptr(ret_conv, true);
32073 }
32074
32075 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32076         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
32077         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
32078         return ret_conv;
32079 }
32080
32081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32082         if (!ptr_is_owned(_res)) return;
32083         void* _res_ptr = untag_ptr(_res);
32084         CHECK_ACCESS(_res_ptr);
32085         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
32086         FREE(untag_ptr(_res));
32087         CResult_InitDecodeErrorZ_free(_res_conv);
32088 }
32089
32090 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
32091         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
32092         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
32093         return tag_ptr(ret_conv, true);
32094 }
32095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32096         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
32097         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
32098         return ret_conv;
32099 }
32100
32101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32102         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
32103         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
32104         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
32105         return tag_ptr(ret_conv, true);
32106 }
32107
32108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32109         LDKOpenChannel o_conv;
32110         o_conv.inner = untag_ptr(o);
32111         o_conv.is_owned = ptr_is_owned(o);
32112         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32113         o_conv = OpenChannel_clone(&o_conv);
32114         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
32115         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
32116         return tag_ptr(ret_conv, true);
32117 }
32118
32119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32120         void* e_ptr = untag_ptr(e);
32121         CHECK_ACCESS(e_ptr);
32122         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32123         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32124         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
32125         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
32126         return tag_ptr(ret_conv, true);
32127 }
32128
32129 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32130         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
32131         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
32132         return ret_conv;
32133 }
32134
32135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32136         if (!ptr_is_owned(_res)) return;
32137         void* _res_ptr = untag_ptr(_res);
32138         CHECK_ACCESS(_res_ptr);
32139         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
32140         FREE(untag_ptr(_res));
32141         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
32142 }
32143
32144 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
32145         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
32146         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
32147         return tag_ptr(ret_conv, true);
32148 }
32149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32150         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
32151         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
32152         return ret_conv;
32153 }
32154
32155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32156         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
32157         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
32158         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
32159         return tag_ptr(ret_conv, true);
32160 }
32161
32162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32163         LDKOpenChannelV2 o_conv;
32164         o_conv.inner = untag_ptr(o);
32165         o_conv.is_owned = ptr_is_owned(o);
32166         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32167         o_conv = OpenChannelV2_clone(&o_conv);
32168         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
32169         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
32170         return tag_ptr(ret_conv, true);
32171 }
32172
32173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32174         void* e_ptr = untag_ptr(e);
32175         CHECK_ACCESS(e_ptr);
32176         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32177         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32178         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
32179         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
32180         return tag_ptr(ret_conv, true);
32181 }
32182
32183 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32184         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
32185         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
32186         return ret_conv;
32187 }
32188
32189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32190         if (!ptr_is_owned(_res)) return;
32191         void* _res_ptr = untag_ptr(_res);
32192         CHECK_ACCESS(_res_ptr);
32193         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
32194         FREE(untag_ptr(_res));
32195         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
32196 }
32197
32198 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
32199         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
32200         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
32201         return tag_ptr(ret_conv, true);
32202 }
32203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32204         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
32205         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
32206         return ret_conv;
32207 }
32208
32209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32210         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
32211         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
32212         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
32213         return tag_ptr(ret_conv, true);
32214 }
32215
32216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32217         LDKRevokeAndACK o_conv;
32218         o_conv.inner = untag_ptr(o);
32219         o_conv.is_owned = ptr_is_owned(o);
32220         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32221         o_conv = RevokeAndACK_clone(&o_conv);
32222         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
32223         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
32224         return tag_ptr(ret_conv, true);
32225 }
32226
32227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32228         void* e_ptr = untag_ptr(e);
32229         CHECK_ACCESS(e_ptr);
32230         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32231         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32232         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
32233         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
32234         return tag_ptr(ret_conv, true);
32235 }
32236
32237 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32238         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
32239         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
32240         return ret_conv;
32241 }
32242
32243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32244         if (!ptr_is_owned(_res)) return;
32245         void* _res_ptr = untag_ptr(_res);
32246         CHECK_ACCESS(_res_ptr);
32247         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
32248         FREE(untag_ptr(_res));
32249         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
32250 }
32251
32252 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
32253         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
32254         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
32255         return tag_ptr(ret_conv, true);
32256 }
32257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32258         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
32259         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
32260         return ret_conv;
32261 }
32262
32263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32264         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
32265         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
32266         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
32267         return tag_ptr(ret_conv, true);
32268 }
32269
32270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32271         LDKShutdown o_conv;
32272         o_conv.inner = untag_ptr(o);
32273         o_conv.is_owned = ptr_is_owned(o);
32274         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32275         o_conv = Shutdown_clone(&o_conv);
32276         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
32277         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
32278         return tag_ptr(ret_conv, true);
32279 }
32280
32281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32282         void* e_ptr = untag_ptr(e);
32283         CHECK_ACCESS(e_ptr);
32284         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32285         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32286         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
32287         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
32288         return tag_ptr(ret_conv, true);
32289 }
32290
32291 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32292         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
32293         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
32294         return ret_conv;
32295 }
32296
32297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32298         if (!ptr_is_owned(_res)) return;
32299         void* _res_ptr = untag_ptr(_res);
32300         CHECK_ACCESS(_res_ptr);
32301         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
32302         FREE(untag_ptr(_res));
32303         CResult_ShutdownDecodeErrorZ_free(_res_conv);
32304 }
32305
32306 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
32307         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
32308         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
32309         return tag_ptr(ret_conv, true);
32310 }
32311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32312         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
32313         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
32314         return ret_conv;
32315 }
32316
32317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32318         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
32319         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
32320         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
32321         return tag_ptr(ret_conv, true);
32322 }
32323
32324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32325         LDKUpdateFailHTLC o_conv;
32326         o_conv.inner = untag_ptr(o);
32327         o_conv.is_owned = ptr_is_owned(o);
32328         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32329         o_conv = UpdateFailHTLC_clone(&o_conv);
32330         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
32331         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
32332         return tag_ptr(ret_conv, true);
32333 }
32334
32335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32336         void* e_ptr = untag_ptr(e);
32337         CHECK_ACCESS(e_ptr);
32338         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32339         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32340         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
32341         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
32342         return tag_ptr(ret_conv, true);
32343 }
32344
32345 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32346         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
32347         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
32348         return ret_conv;
32349 }
32350
32351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32352         if (!ptr_is_owned(_res)) return;
32353         void* _res_ptr = untag_ptr(_res);
32354         CHECK_ACCESS(_res_ptr);
32355         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
32356         FREE(untag_ptr(_res));
32357         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
32358 }
32359
32360 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
32361         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
32362         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
32363         return tag_ptr(ret_conv, true);
32364 }
32365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32366         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
32367         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
32368         return ret_conv;
32369 }
32370
32371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32372         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
32373         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
32374         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
32375         return tag_ptr(ret_conv, true);
32376 }
32377
32378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32379         LDKUpdateFailMalformedHTLC o_conv;
32380         o_conv.inner = untag_ptr(o);
32381         o_conv.is_owned = ptr_is_owned(o);
32382         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32383         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
32384         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
32385         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
32386         return tag_ptr(ret_conv, true);
32387 }
32388
32389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32390         void* e_ptr = untag_ptr(e);
32391         CHECK_ACCESS(e_ptr);
32392         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32393         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32394         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
32395         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
32396         return tag_ptr(ret_conv, true);
32397 }
32398
32399 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32400         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
32401         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
32402         return ret_conv;
32403 }
32404
32405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32406         if (!ptr_is_owned(_res)) return;
32407         void* _res_ptr = untag_ptr(_res);
32408         CHECK_ACCESS(_res_ptr);
32409         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
32410         FREE(untag_ptr(_res));
32411         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
32412 }
32413
32414 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
32415         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
32416         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
32417         return tag_ptr(ret_conv, true);
32418 }
32419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32420         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
32421         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
32422         return ret_conv;
32423 }
32424
32425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32426         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
32427         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
32428         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
32429         return tag_ptr(ret_conv, true);
32430 }
32431
32432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32433         LDKUpdateFee o_conv;
32434         o_conv.inner = untag_ptr(o);
32435         o_conv.is_owned = ptr_is_owned(o);
32436         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32437         o_conv = UpdateFee_clone(&o_conv);
32438         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
32439         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
32440         return tag_ptr(ret_conv, true);
32441 }
32442
32443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32444         void* e_ptr = untag_ptr(e);
32445         CHECK_ACCESS(e_ptr);
32446         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32447         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32448         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
32449         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
32450         return tag_ptr(ret_conv, true);
32451 }
32452
32453 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32454         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
32455         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
32456         return ret_conv;
32457 }
32458
32459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32460         if (!ptr_is_owned(_res)) return;
32461         void* _res_ptr = untag_ptr(_res);
32462         CHECK_ACCESS(_res_ptr);
32463         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
32464         FREE(untag_ptr(_res));
32465         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
32466 }
32467
32468 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
32469         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
32470         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
32471         return tag_ptr(ret_conv, true);
32472 }
32473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32474         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
32475         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
32476         return ret_conv;
32477 }
32478
32479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32480         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
32481         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
32482         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
32483         return tag_ptr(ret_conv, true);
32484 }
32485
32486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32487         LDKUpdateFulfillHTLC o_conv;
32488         o_conv.inner = untag_ptr(o);
32489         o_conv.is_owned = ptr_is_owned(o);
32490         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32491         o_conv = UpdateFulfillHTLC_clone(&o_conv);
32492         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
32493         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
32494         return tag_ptr(ret_conv, true);
32495 }
32496
32497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32498         void* e_ptr = untag_ptr(e);
32499         CHECK_ACCESS(e_ptr);
32500         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32501         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32502         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
32503         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
32504         return tag_ptr(ret_conv, true);
32505 }
32506
32507 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32508         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
32509         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
32510         return ret_conv;
32511 }
32512
32513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32514         if (!ptr_is_owned(_res)) return;
32515         void* _res_ptr = untag_ptr(_res);
32516         CHECK_ACCESS(_res_ptr);
32517         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
32518         FREE(untag_ptr(_res));
32519         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
32520 }
32521
32522 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
32523         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
32524         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
32525         return tag_ptr(ret_conv, true);
32526 }
32527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32528         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
32529         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
32530         return ret_conv;
32531 }
32532
32533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32534         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
32535         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
32536         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
32537         return tag_ptr(ret_conv, true);
32538 }
32539
32540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32541         LDKOnionPacket o_conv;
32542         o_conv.inner = untag_ptr(o);
32543         o_conv.is_owned = ptr_is_owned(o);
32544         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32545         o_conv = OnionPacket_clone(&o_conv);
32546         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
32547         *ret_conv = CResult_OnionPacketDecodeErrorZ_ok(o_conv);
32548         return tag_ptr(ret_conv, true);
32549 }
32550
32551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32552         void* e_ptr = untag_ptr(e);
32553         CHECK_ACCESS(e_ptr);
32554         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32555         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32556         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
32557         *ret_conv = CResult_OnionPacketDecodeErrorZ_err(e_conv);
32558         return tag_ptr(ret_conv, true);
32559 }
32560
32561 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32562         LDKCResult_OnionPacketDecodeErrorZ* o_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(o);
32563         jboolean ret_conv = CResult_OnionPacketDecodeErrorZ_is_ok(o_conv);
32564         return ret_conv;
32565 }
32566
32567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32568         if (!ptr_is_owned(_res)) return;
32569         void* _res_ptr = untag_ptr(_res);
32570         CHECK_ACCESS(_res_ptr);
32571         LDKCResult_OnionPacketDecodeErrorZ _res_conv = *(LDKCResult_OnionPacketDecodeErrorZ*)(_res_ptr);
32572         FREE(untag_ptr(_res));
32573         CResult_OnionPacketDecodeErrorZ_free(_res_conv);
32574 }
32575
32576 static inline uint64_t CResult_OnionPacketDecodeErrorZ_clone_ptr(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR arg) {
32577         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
32578         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(arg);
32579         return tag_ptr(ret_conv, true);
32580 }
32581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32582         LDKCResult_OnionPacketDecodeErrorZ* arg_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(arg);
32583         int64_t ret_conv = CResult_OnionPacketDecodeErrorZ_clone_ptr(arg_conv);
32584         return ret_conv;
32585 }
32586
32587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32588         LDKCResult_OnionPacketDecodeErrorZ* orig_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(orig);
32589         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
32590         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(orig_conv);
32591         return tag_ptr(ret_conv, true);
32592 }
32593
32594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32595         LDKUpdateAddHTLC o_conv;
32596         o_conv.inner = untag_ptr(o);
32597         o_conv.is_owned = ptr_is_owned(o);
32598         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32599         o_conv = UpdateAddHTLC_clone(&o_conv);
32600         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
32601         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
32602         return tag_ptr(ret_conv, true);
32603 }
32604
32605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32606         void* e_ptr = untag_ptr(e);
32607         CHECK_ACCESS(e_ptr);
32608         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32609         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32610         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
32611         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
32612         return tag_ptr(ret_conv, true);
32613 }
32614
32615 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32616         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
32617         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
32618         return ret_conv;
32619 }
32620
32621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32622         if (!ptr_is_owned(_res)) return;
32623         void* _res_ptr = untag_ptr(_res);
32624         CHECK_ACCESS(_res_ptr);
32625         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
32626         FREE(untag_ptr(_res));
32627         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
32628 }
32629
32630 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
32631         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
32632         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
32633         return tag_ptr(ret_conv, true);
32634 }
32635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32636         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
32637         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
32638         return ret_conv;
32639 }
32640
32641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32642         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
32643         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
32644         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
32645         return tag_ptr(ret_conv, true);
32646 }
32647
32648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32649         LDKOnionMessage o_conv;
32650         o_conv.inner = untag_ptr(o);
32651         o_conv.is_owned = ptr_is_owned(o);
32652         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32653         o_conv = OnionMessage_clone(&o_conv);
32654         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
32655         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
32656         return tag_ptr(ret_conv, true);
32657 }
32658
32659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32660         void* e_ptr = untag_ptr(e);
32661         CHECK_ACCESS(e_ptr);
32662         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32663         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32664         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
32665         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
32666         return tag_ptr(ret_conv, true);
32667 }
32668
32669 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32670         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
32671         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
32672         return ret_conv;
32673 }
32674
32675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32676         if (!ptr_is_owned(_res)) return;
32677         void* _res_ptr = untag_ptr(_res);
32678         CHECK_ACCESS(_res_ptr);
32679         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
32680         FREE(untag_ptr(_res));
32681         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
32682 }
32683
32684 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
32685         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
32686         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
32687         return tag_ptr(ret_conv, true);
32688 }
32689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32690         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
32691         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
32692         return ret_conv;
32693 }
32694
32695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32696         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
32697         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
32698         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
32699         return tag_ptr(ret_conv, true);
32700 }
32701
32702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32703         LDKFinalOnionHopData o_conv;
32704         o_conv.inner = untag_ptr(o);
32705         o_conv.is_owned = ptr_is_owned(o);
32706         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32707         o_conv = FinalOnionHopData_clone(&o_conv);
32708         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
32709         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_ok(o_conv);
32710         return tag_ptr(ret_conv, true);
32711 }
32712
32713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32714         void* e_ptr = untag_ptr(e);
32715         CHECK_ACCESS(e_ptr);
32716         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32717         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32718         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
32719         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_err(e_conv);
32720         return tag_ptr(ret_conv, true);
32721 }
32722
32723 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32724         LDKCResult_FinalOnionHopDataDecodeErrorZ* o_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(o);
32725         jboolean ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o_conv);
32726         return ret_conv;
32727 }
32728
32729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32730         if (!ptr_is_owned(_res)) return;
32731         void* _res_ptr = untag_ptr(_res);
32732         CHECK_ACCESS(_res_ptr);
32733         LDKCResult_FinalOnionHopDataDecodeErrorZ _res_conv = *(LDKCResult_FinalOnionHopDataDecodeErrorZ*)(_res_ptr);
32734         FREE(untag_ptr(_res));
32735         CResult_FinalOnionHopDataDecodeErrorZ_free(_res_conv);
32736 }
32737
32738 static inline uint64_t CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR arg) {
32739         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
32740         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(arg);
32741         return tag_ptr(ret_conv, true);
32742 }
32743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32744         LDKCResult_FinalOnionHopDataDecodeErrorZ* arg_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(arg);
32745         int64_t ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(arg_conv);
32746         return ret_conv;
32747 }
32748
32749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32750         LDKCResult_FinalOnionHopDataDecodeErrorZ* orig_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(orig);
32751         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
32752         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(orig_conv);
32753         return tag_ptr(ret_conv, true);
32754 }
32755
32756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32757         LDKPing o_conv;
32758         o_conv.inner = untag_ptr(o);
32759         o_conv.is_owned = ptr_is_owned(o);
32760         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32761         o_conv = Ping_clone(&o_conv);
32762         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
32763         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
32764         return tag_ptr(ret_conv, true);
32765 }
32766
32767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32768         void* e_ptr = untag_ptr(e);
32769         CHECK_ACCESS(e_ptr);
32770         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32771         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32772         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
32773         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
32774         return tag_ptr(ret_conv, true);
32775 }
32776
32777 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32778         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
32779         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
32780         return ret_conv;
32781 }
32782
32783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32784         if (!ptr_is_owned(_res)) return;
32785         void* _res_ptr = untag_ptr(_res);
32786         CHECK_ACCESS(_res_ptr);
32787         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
32788         FREE(untag_ptr(_res));
32789         CResult_PingDecodeErrorZ_free(_res_conv);
32790 }
32791
32792 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
32793         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
32794         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
32795         return tag_ptr(ret_conv, true);
32796 }
32797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32798         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
32799         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
32800         return ret_conv;
32801 }
32802
32803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32804         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
32805         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
32806         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
32807         return tag_ptr(ret_conv, true);
32808 }
32809
32810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32811         LDKPong o_conv;
32812         o_conv.inner = untag_ptr(o);
32813         o_conv.is_owned = ptr_is_owned(o);
32814         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32815         o_conv = Pong_clone(&o_conv);
32816         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
32817         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
32818         return tag_ptr(ret_conv, true);
32819 }
32820
32821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32822         void* e_ptr = untag_ptr(e);
32823         CHECK_ACCESS(e_ptr);
32824         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32825         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32826         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
32827         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
32828         return tag_ptr(ret_conv, true);
32829 }
32830
32831 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32832         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
32833         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
32834         return ret_conv;
32835 }
32836
32837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32838         if (!ptr_is_owned(_res)) return;
32839         void* _res_ptr = untag_ptr(_res);
32840         CHECK_ACCESS(_res_ptr);
32841         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
32842         FREE(untag_ptr(_res));
32843         CResult_PongDecodeErrorZ_free(_res_conv);
32844 }
32845
32846 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
32847         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
32848         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
32849         return tag_ptr(ret_conv, true);
32850 }
32851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32852         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
32853         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
32854         return ret_conv;
32855 }
32856
32857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32858         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
32859         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
32860         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
32861         return tag_ptr(ret_conv, true);
32862 }
32863
32864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32865         LDKUnsignedChannelAnnouncement o_conv;
32866         o_conv.inner = untag_ptr(o);
32867         o_conv.is_owned = ptr_is_owned(o);
32868         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32869         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
32870         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
32871         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
32872         return tag_ptr(ret_conv, true);
32873 }
32874
32875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32876         void* e_ptr = untag_ptr(e);
32877         CHECK_ACCESS(e_ptr);
32878         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32879         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32880         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
32881         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
32882         return tag_ptr(ret_conv, true);
32883 }
32884
32885 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32886         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
32887         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
32888         return ret_conv;
32889 }
32890
32891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32892         if (!ptr_is_owned(_res)) return;
32893         void* _res_ptr = untag_ptr(_res);
32894         CHECK_ACCESS(_res_ptr);
32895         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
32896         FREE(untag_ptr(_res));
32897         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
32898 }
32899
32900 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
32901         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
32902         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
32903         return tag_ptr(ret_conv, true);
32904 }
32905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32906         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
32907         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
32908         return ret_conv;
32909 }
32910
32911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32912         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
32913         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
32914         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
32915         return tag_ptr(ret_conv, true);
32916 }
32917
32918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32919         LDKChannelAnnouncement o_conv;
32920         o_conv.inner = untag_ptr(o);
32921         o_conv.is_owned = ptr_is_owned(o);
32922         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32923         o_conv = ChannelAnnouncement_clone(&o_conv);
32924         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
32925         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
32926         return tag_ptr(ret_conv, true);
32927 }
32928
32929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32930         void* e_ptr = untag_ptr(e);
32931         CHECK_ACCESS(e_ptr);
32932         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32933         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32934         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
32935         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
32936         return tag_ptr(ret_conv, true);
32937 }
32938
32939 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32940         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
32941         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
32942         return ret_conv;
32943 }
32944
32945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32946         if (!ptr_is_owned(_res)) return;
32947         void* _res_ptr = untag_ptr(_res);
32948         CHECK_ACCESS(_res_ptr);
32949         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
32950         FREE(untag_ptr(_res));
32951         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
32952 }
32953
32954 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
32955         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
32956         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
32957         return tag_ptr(ret_conv, true);
32958 }
32959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32960         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
32961         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
32962         return ret_conv;
32963 }
32964
32965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32966         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
32967         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
32968         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
32969         return tag_ptr(ret_conv, true);
32970 }
32971
32972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32973         LDKUnsignedChannelUpdate o_conv;
32974         o_conv.inner = untag_ptr(o);
32975         o_conv.is_owned = ptr_is_owned(o);
32976         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32977         o_conv = UnsignedChannelUpdate_clone(&o_conv);
32978         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
32979         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
32980         return tag_ptr(ret_conv, true);
32981 }
32982
32983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32984         void* e_ptr = untag_ptr(e);
32985         CHECK_ACCESS(e_ptr);
32986         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32987         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32988         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
32989         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
32990         return tag_ptr(ret_conv, true);
32991 }
32992
32993 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32994         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
32995         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
32996         return ret_conv;
32997 }
32998
32999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33000         if (!ptr_is_owned(_res)) return;
33001         void* _res_ptr = untag_ptr(_res);
33002         CHECK_ACCESS(_res_ptr);
33003         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
33004         FREE(untag_ptr(_res));
33005         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
33006 }
33007
33008 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
33009         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
33010         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
33011         return tag_ptr(ret_conv, true);
33012 }
33013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33014         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
33015         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
33016         return ret_conv;
33017 }
33018
33019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33020         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
33021         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
33022         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
33023         return tag_ptr(ret_conv, true);
33024 }
33025
33026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33027         LDKChannelUpdate o_conv;
33028         o_conv.inner = untag_ptr(o);
33029         o_conv.is_owned = ptr_is_owned(o);
33030         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33031         o_conv = ChannelUpdate_clone(&o_conv);
33032         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
33033         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
33034         return tag_ptr(ret_conv, true);
33035 }
33036
33037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33038         void* e_ptr = untag_ptr(e);
33039         CHECK_ACCESS(e_ptr);
33040         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33041         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33042         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
33043         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
33044         return tag_ptr(ret_conv, true);
33045 }
33046
33047 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33048         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
33049         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
33050         return ret_conv;
33051 }
33052
33053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33054         if (!ptr_is_owned(_res)) return;
33055         void* _res_ptr = untag_ptr(_res);
33056         CHECK_ACCESS(_res_ptr);
33057         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
33058         FREE(untag_ptr(_res));
33059         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
33060 }
33061
33062 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
33063         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
33064         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
33065         return tag_ptr(ret_conv, true);
33066 }
33067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33068         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
33069         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
33070         return ret_conv;
33071 }
33072
33073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33074         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
33075         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
33076         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
33077         return tag_ptr(ret_conv, true);
33078 }
33079
33080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33081         LDKErrorMessage o_conv;
33082         o_conv.inner = untag_ptr(o);
33083         o_conv.is_owned = ptr_is_owned(o);
33084         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33085         o_conv = ErrorMessage_clone(&o_conv);
33086         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
33087         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
33088         return tag_ptr(ret_conv, true);
33089 }
33090
33091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33092         void* e_ptr = untag_ptr(e);
33093         CHECK_ACCESS(e_ptr);
33094         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33095         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33096         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
33097         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
33098         return tag_ptr(ret_conv, true);
33099 }
33100
33101 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33102         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
33103         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
33104         return ret_conv;
33105 }
33106
33107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33108         if (!ptr_is_owned(_res)) return;
33109         void* _res_ptr = untag_ptr(_res);
33110         CHECK_ACCESS(_res_ptr);
33111         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
33112         FREE(untag_ptr(_res));
33113         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
33114 }
33115
33116 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
33117         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
33118         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
33119         return tag_ptr(ret_conv, true);
33120 }
33121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33122         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
33123         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
33124         return ret_conv;
33125 }
33126
33127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33128         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
33129         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
33130         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
33131         return tag_ptr(ret_conv, true);
33132 }
33133
33134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33135         LDKWarningMessage o_conv;
33136         o_conv.inner = untag_ptr(o);
33137         o_conv.is_owned = ptr_is_owned(o);
33138         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33139         o_conv = WarningMessage_clone(&o_conv);
33140         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
33141         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
33142         return tag_ptr(ret_conv, true);
33143 }
33144
33145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33146         void* e_ptr = untag_ptr(e);
33147         CHECK_ACCESS(e_ptr);
33148         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33149         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33150         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
33151         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
33152         return tag_ptr(ret_conv, true);
33153 }
33154
33155 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33156         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
33157         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
33158         return ret_conv;
33159 }
33160
33161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33162         if (!ptr_is_owned(_res)) return;
33163         void* _res_ptr = untag_ptr(_res);
33164         CHECK_ACCESS(_res_ptr);
33165         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
33166         FREE(untag_ptr(_res));
33167         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
33168 }
33169
33170 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
33171         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
33172         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
33173         return tag_ptr(ret_conv, true);
33174 }
33175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33176         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
33177         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
33178         return ret_conv;
33179 }
33180
33181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33182         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
33183         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
33184         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
33185         return tag_ptr(ret_conv, true);
33186 }
33187
33188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33189         LDKUnsignedNodeAnnouncement o_conv;
33190         o_conv.inner = untag_ptr(o);
33191         o_conv.is_owned = ptr_is_owned(o);
33192         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33193         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
33194         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
33195         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
33196         return tag_ptr(ret_conv, true);
33197 }
33198
33199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33200         void* e_ptr = untag_ptr(e);
33201         CHECK_ACCESS(e_ptr);
33202         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33203         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33204         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
33205         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
33206         return tag_ptr(ret_conv, true);
33207 }
33208
33209 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33210         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
33211         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
33212         return ret_conv;
33213 }
33214
33215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33216         if (!ptr_is_owned(_res)) return;
33217         void* _res_ptr = untag_ptr(_res);
33218         CHECK_ACCESS(_res_ptr);
33219         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
33220         FREE(untag_ptr(_res));
33221         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
33222 }
33223
33224 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
33225         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
33226         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
33227         return tag_ptr(ret_conv, true);
33228 }
33229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33230         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
33231         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
33232         return ret_conv;
33233 }
33234
33235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33236         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
33237         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
33238         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
33239         return tag_ptr(ret_conv, true);
33240 }
33241
33242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33243         LDKNodeAnnouncement o_conv;
33244         o_conv.inner = untag_ptr(o);
33245         o_conv.is_owned = ptr_is_owned(o);
33246         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33247         o_conv = NodeAnnouncement_clone(&o_conv);
33248         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
33249         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
33250         return tag_ptr(ret_conv, true);
33251 }
33252
33253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33254         void* e_ptr = untag_ptr(e);
33255         CHECK_ACCESS(e_ptr);
33256         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33257         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33258         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
33259         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
33260         return tag_ptr(ret_conv, true);
33261 }
33262
33263 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33264         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
33265         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
33266         return ret_conv;
33267 }
33268
33269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33270         if (!ptr_is_owned(_res)) return;
33271         void* _res_ptr = untag_ptr(_res);
33272         CHECK_ACCESS(_res_ptr);
33273         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
33274         FREE(untag_ptr(_res));
33275         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
33276 }
33277
33278 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
33279         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
33280         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
33281         return tag_ptr(ret_conv, true);
33282 }
33283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33284         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
33285         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
33286         return ret_conv;
33287 }
33288
33289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33290         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
33291         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
33292         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
33293         return tag_ptr(ret_conv, true);
33294 }
33295
33296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33297         LDKQueryShortChannelIds o_conv;
33298         o_conv.inner = untag_ptr(o);
33299         o_conv.is_owned = ptr_is_owned(o);
33300         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33301         o_conv = QueryShortChannelIds_clone(&o_conv);
33302         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
33303         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
33304         return tag_ptr(ret_conv, true);
33305 }
33306
33307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33308         void* e_ptr = untag_ptr(e);
33309         CHECK_ACCESS(e_ptr);
33310         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33311         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33312         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
33313         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
33314         return tag_ptr(ret_conv, true);
33315 }
33316
33317 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33318         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
33319         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
33320         return ret_conv;
33321 }
33322
33323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33324         if (!ptr_is_owned(_res)) return;
33325         void* _res_ptr = untag_ptr(_res);
33326         CHECK_ACCESS(_res_ptr);
33327         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
33328         FREE(untag_ptr(_res));
33329         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
33330 }
33331
33332 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
33333         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
33334         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
33335         return tag_ptr(ret_conv, true);
33336 }
33337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33338         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
33339         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
33340         return ret_conv;
33341 }
33342
33343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33344         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
33345         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
33346         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
33347         return tag_ptr(ret_conv, true);
33348 }
33349
33350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33351         LDKReplyShortChannelIdsEnd o_conv;
33352         o_conv.inner = untag_ptr(o);
33353         o_conv.is_owned = ptr_is_owned(o);
33354         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33355         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
33356         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
33357         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
33358         return tag_ptr(ret_conv, true);
33359 }
33360
33361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33362         void* e_ptr = untag_ptr(e);
33363         CHECK_ACCESS(e_ptr);
33364         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33365         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33366         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
33367         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
33368         return tag_ptr(ret_conv, true);
33369 }
33370
33371 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33372         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
33373         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
33374         return ret_conv;
33375 }
33376
33377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33378         if (!ptr_is_owned(_res)) return;
33379         void* _res_ptr = untag_ptr(_res);
33380         CHECK_ACCESS(_res_ptr);
33381         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
33382         FREE(untag_ptr(_res));
33383         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
33384 }
33385
33386 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
33387         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
33388         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
33389         return tag_ptr(ret_conv, true);
33390 }
33391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33392         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
33393         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
33394         return ret_conv;
33395 }
33396
33397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33398         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
33399         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
33400         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
33401         return tag_ptr(ret_conv, true);
33402 }
33403
33404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33405         LDKQueryChannelRange o_conv;
33406         o_conv.inner = untag_ptr(o);
33407         o_conv.is_owned = ptr_is_owned(o);
33408         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33409         o_conv = QueryChannelRange_clone(&o_conv);
33410         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
33411         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
33412         return tag_ptr(ret_conv, true);
33413 }
33414
33415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33416         void* e_ptr = untag_ptr(e);
33417         CHECK_ACCESS(e_ptr);
33418         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33419         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33420         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
33421         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
33422         return tag_ptr(ret_conv, true);
33423 }
33424
33425 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33426         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
33427         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
33428         return ret_conv;
33429 }
33430
33431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33432         if (!ptr_is_owned(_res)) return;
33433         void* _res_ptr = untag_ptr(_res);
33434         CHECK_ACCESS(_res_ptr);
33435         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
33436         FREE(untag_ptr(_res));
33437         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
33438 }
33439
33440 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
33441         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
33442         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
33443         return tag_ptr(ret_conv, true);
33444 }
33445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33446         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
33447         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
33448         return ret_conv;
33449 }
33450
33451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33452         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
33453         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
33454         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
33455         return tag_ptr(ret_conv, true);
33456 }
33457
33458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33459         LDKReplyChannelRange o_conv;
33460         o_conv.inner = untag_ptr(o);
33461         o_conv.is_owned = ptr_is_owned(o);
33462         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33463         o_conv = ReplyChannelRange_clone(&o_conv);
33464         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
33465         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
33466         return tag_ptr(ret_conv, true);
33467 }
33468
33469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33470         void* e_ptr = untag_ptr(e);
33471         CHECK_ACCESS(e_ptr);
33472         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33473         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33474         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
33475         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
33476         return tag_ptr(ret_conv, true);
33477 }
33478
33479 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33480         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
33481         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
33482         return ret_conv;
33483 }
33484
33485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33486         if (!ptr_is_owned(_res)) return;
33487         void* _res_ptr = untag_ptr(_res);
33488         CHECK_ACCESS(_res_ptr);
33489         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
33490         FREE(untag_ptr(_res));
33491         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
33492 }
33493
33494 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
33495         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
33496         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
33497         return tag_ptr(ret_conv, true);
33498 }
33499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33500         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
33501         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
33502         return ret_conv;
33503 }
33504
33505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33506         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
33507         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
33508         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
33509         return tag_ptr(ret_conv, true);
33510 }
33511
33512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33513         LDKGossipTimestampFilter o_conv;
33514         o_conv.inner = untag_ptr(o);
33515         o_conv.is_owned = ptr_is_owned(o);
33516         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33517         o_conv = GossipTimestampFilter_clone(&o_conv);
33518         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
33519         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
33520         return tag_ptr(ret_conv, true);
33521 }
33522
33523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33524         void* e_ptr = untag_ptr(e);
33525         CHECK_ACCESS(e_ptr);
33526         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33527         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33528         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
33529         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
33530         return tag_ptr(ret_conv, true);
33531 }
33532
33533 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33534         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
33535         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
33536         return ret_conv;
33537 }
33538
33539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33540         if (!ptr_is_owned(_res)) return;
33541         void* _res_ptr = untag_ptr(_res);
33542         CHECK_ACCESS(_res_ptr);
33543         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
33544         FREE(untag_ptr(_res));
33545         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
33546 }
33547
33548 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
33549         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
33550         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
33551         return tag_ptr(ret_conv, true);
33552 }
33553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33554         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
33555         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
33556         return ret_conv;
33557 }
33558
33559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33560         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
33561         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
33562         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
33563         return tag_ptr(ret_conv, true);
33564 }
33565
33566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
33567         LDKCVec_PhantomRouteHintsZ _res_constr;
33568         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
33569         if (_res_constr.datalen > 0)
33570                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
33571         else
33572                 _res_constr.data = NULL;
33573         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
33574         for (size_t t = 0; t < _res_constr.datalen; t++) {
33575                 int64_t _res_conv_19 = _res_vals[t];
33576                 LDKPhantomRouteHints _res_conv_19_conv;
33577                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
33578                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
33579                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
33580                 _res_constr.data[t] = _res_conv_19_conv;
33581         }
33582         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
33583         CVec_PhantomRouteHintsZ_free(_res_constr);
33584 }
33585
33586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33587         LDKBolt11Invoice o_conv;
33588         o_conv.inner = untag_ptr(o);
33589         o_conv.is_owned = ptr_is_owned(o);
33590         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33591         o_conv = Bolt11Invoice_clone(&o_conv);
33592         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
33593         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
33594         return tag_ptr(ret_conv, true);
33595 }
33596
33597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33598         void* e_ptr = untag_ptr(e);
33599         CHECK_ACCESS(e_ptr);
33600         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
33601         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
33602         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
33603         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
33604         return tag_ptr(ret_conv, true);
33605 }
33606
33607 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33608         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
33609         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
33610         return ret_conv;
33611 }
33612
33613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33614         if (!ptr_is_owned(_res)) return;
33615         void* _res_ptr = untag_ptr(_res);
33616         CHECK_ACCESS(_res_ptr);
33617         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
33618         FREE(untag_ptr(_res));
33619         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
33620 }
33621
33622 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
33623         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
33624         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
33625         return tag_ptr(ret_conv, true);
33626 }
33627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33628         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
33629         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
33630         return ret_conv;
33631 }
33632
33633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33634         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
33635         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
33636         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
33637         return tag_ptr(ret_conv, true);
33638 }
33639
33640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1FutureZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
33641         LDKCVec_FutureZ _res_constr;
33642         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
33643         if (_res_constr.datalen > 0)
33644                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
33645         else
33646                 _res_constr.data = NULL;
33647         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
33648         for (size_t i = 0; i < _res_constr.datalen; i++) {
33649                 int64_t _res_conv_8 = _res_vals[i];
33650                 LDKFuture _res_conv_8_conv;
33651                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
33652                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
33653                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
33654                 _res_constr.data[i] = _res_conv_8_conv;
33655         }
33656         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
33657         CVec_FutureZ_free(_res_constr);
33658 }
33659
33660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33661         void* o_ptr = untag_ptr(o);
33662         CHECK_ACCESS(o_ptr);
33663         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
33664         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
33665         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
33666         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
33667         return tag_ptr(ret_conv, true);
33668 }
33669
33670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33671         void* e_ptr = untag_ptr(e);
33672         CHECK_ACCESS(e_ptr);
33673         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33674         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33675         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
33676         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
33677         return tag_ptr(ret_conv, true);
33678 }
33679
33680 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33681         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
33682         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
33683         return ret_conv;
33684 }
33685
33686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33687         if (!ptr_is_owned(_res)) return;
33688         void* _res_ptr = untag_ptr(_res);
33689         CHECK_ACCESS(_res_ptr);
33690         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
33691         FREE(untag_ptr(_res));
33692         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
33693 }
33694
33695 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
33696         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
33697         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
33698         return tag_ptr(ret_conv, true);
33699 }
33700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33701         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
33702         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
33703         return ret_conv;
33704 }
33705
33706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33707         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
33708         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
33709         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
33710         return tag_ptr(ret_conv, true);
33711 }
33712
33713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1some(JNIEnv *env, jclass clz, jclass o) {
33714         LDKHTLCClaim o_conv = LDKHTLCClaim_from_java(env, o);
33715         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
33716         *ret_copy = COption_HTLCClaimZ_some(o_conv);
33717         int64_t ret_ref = tag_ptr(ret_copy, true);
33718         return ret_ref;
33719 }
33720
33721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1none(JNIEnv *env, jclass clz) {
33722         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
33723         *ret_copy = COption_HTLCClaimZ_none();
33724         int64_t ret_ref = tag_ptr(ret_copy, true);
33725         return ret_ref;
33726 }
33727
33728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33729         if (!ptr_is_owned(_res)) return;
33730         void* _res_ptr = untag_ptr(_res);
33731         CHECK_ACCESS(_res_ptr);
33732         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
33733         FREE(untag_ptr(_res));
33734         COption_HTLCClaimZ_free(_res_conv);
33735 }
33736
33737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33738         LDKCounterpartyCommitmentSecrets o_conv;
33739         o_conv.inner = untag_ptr(o);
33740         o_conv.is_owned = ptr_is_owned(o);
33741         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33742         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
33743         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
33744         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
33745         return tag_ptr(ret_conv, true);
33746 }
33747
33748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33749         void* e_ptr = untag_ptr(e);
33750         CHECK_ACCESS(e_ptr);
33751         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33752         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33753         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
33754         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
33755         return tag_ptr(ret_conv, true);
33756 }
33757
33758 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33759         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
33760         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
33761         return ret_conv;
33762 }
33763
33764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33765         if (!ptr_is_owned(_res)) return;
33766         void* _res_ptr = untag_ptr(_res);
33767         CHECK_ACCESS(_res_ptr);
33768         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
33769         FREE(untag_ptr(_res));
33770         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
33771 }
33772
33773 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
33774         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
33775         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
33776         return tag_ptr(ret_conv, true);
33777 }
33778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33779         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
33780         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
33781         return ret_conv;
33782 }
33783
33784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33785         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
33786         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
33787         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
33788         return tag_ptr(ret_conv, true);
33789 }
33790
33791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33792         LDKTxCreationKeys o_conv;
33793         o_conv.inner = untag_ptr(o);
33794         o_conv.is_owned = ptr_is_owned(o);
33795         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33796         o_conv = TxCreationKeys_clone(&o_conv);
33797         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
33798         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
33799         return tag_ptr(ret_conv, true);
33800 }
33801
33802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33803         void* e_ptr = untag_ptr(e);
33804         CHECK_ACCESS(e_ptr);
33805         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33806         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33807         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
33808         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
33809         return tag_ptr(ret_conv, true);
33810 }
33811
33812 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33813         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
33814         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
33815         return ret_conv;
33816 }
33817
33818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33819         if (!ptr_is_owned(_res)) return;
33820         void* _res_ptr = untag_ptr(_res);
33821         CHECK_ACCESS(_res_ptr);
33822         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
33823         FREE(untag_ptr(_res));
33824         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
33825 }
33826
33827 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
33828         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
33829         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
33830         return tag_ptr(ret_conv, true);
33831 }
33832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33833         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
33834         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
33835         return ret_conv;
33836 }
33837
33838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33839         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
33840         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
33841         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
33842         return tag_ptr(ret_conv, true);
33843 }
33844
33845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33846         LDKChannelPublicKeys o_conv;
33847         o_conv.inner = untag_ptr(o);
33848         o_conv.is_owned = ptr_is_owned(o);
33849         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33850         o_conv = ChannelPublicKeys_clone(&o_conv);
33851         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
33852         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
33853         return tag_ptr(ret_conv, true);
33854 }
33855
33856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33857         void* e_ptr = untag_ptr(e);
33858         CHECK_ACCESS(e_ptr);
33859         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33860         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33861         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
33862         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
33863         return tag_ptr(ret_conv, true);
33864 }
33865
33866 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33867         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
33868         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
33869         return ret_conv;
33870 }
33871
33872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33873         if (!ptr_is_owned(_res)) return;
33874         void* _res_ptr = untag_ptr(_res);
33875         CHECK_ACCESS(_res_ptr);
33876         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
33877         FREE(untag_ptr(_res));
33878         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
33879 }
33880
33881 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
33882         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
33883         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
33884         return tag_ptr(ret_conv, true);
33885 }
33886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33887         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
33888         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
33889         return ret_conv;
33890 }
33891
33892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33893         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
33894         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
33895         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
33896         return tag_ptr(ret_conv, true);
33897 }
33898
33899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33900         LDKHTLCOutputInCommitment o_conv;
33901         o_conv.inner = untag_ptr(o);
33902         o_conv.is_owned = ptr_is_owned(o);
33903         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33904         o_conv = HTLCOutputInCommitment_clone(&o_conv);
33905         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
33906         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
33907         return tag_ptr(ret_conv, true);
33908 }
33909
33910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33911         void* e_ptr = untag_ptr(e);
33912         CHECK_ACCESS(e_ptr);
33913         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33914         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33915         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
33916         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
33917         return tag_ptr(ret_conv, true);
33918 }
33919
33920 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33921         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
33922         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
33923         return ret_conv;
33924 }
33925
33926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33927         if (!ptr_is_owned(_res)) return;
33928         void* _res_ptr = untag_ptr(_res);
33929         CHECK_ACCESS(_res_ptr);
33930         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
33931         FREE(untag_ptr(_res));
33932         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
33933 }
33934
33935 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
33936         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
33937         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
33938         return tag_ptr(ret_conv, true);
33939 }
33940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33941         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
33942         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
33943         return ret_conv;
33944 }
33945
33946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33947         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
33948         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
33949         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
33950         return tag_ptr(ret_conv, true);
33951 }
33952
33953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33954         LDKCounterpartyChannelTransactionParameters o_conv;
33955         o_conv.inner = untag_ptr(o);
33956         o_conv.is_owned = ptr_is_owned(o);
33957         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33958         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
33959         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
33960         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
33961         return tag_ptr(ret_conv, true);
33962 }
33963
33964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33965         void* e_ptr = untag_ptr(e);
33966         CHECK_ACCESS(e_ptr);
33967         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33968         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33969         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
33970         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
33971         return tag_ptr(ret_conv, true);
33972 }
33973
33974 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33975         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
33976         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
33977         return ret_conv;
33978 }
33979
33980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33981         if (!ptr_is_owned(_res)) return;
33982         void* _res_ptr = untag_ptr(_res);
33983         CHECK_ACCESS(_res_ptr);
33984         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
33985         FREE(untag_ptr(_res));
33986         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
33987 }
33988
33989 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
33990         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
33991         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
33992         return tag_ptr(ret_conv, true);
33993 }
33994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33995         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
33996         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
33997         return ret_conv;
33998 }
33999
34000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34001         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
34002         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
34003         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
34004         return tag_ptr(ret_conv, true);
34005 }
34006
34007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34008         LDKChannelTransactionParameters o_conv;
34009         o_conv.inner = untag_ptr(o);
34010         o_conv.is_owned = ptr_is_owned(o);
34011         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34012         o_conv = ChannelTransactionParameters_clone(&o_conv);
34013         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
34014         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
34015         return tag_ptr(ret_conv, true);
34016 }
34017
34018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34019         void* e_ptr = untag_ptr(e);
34020         CHECK_ACCESS(e_ptr);
34021         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34022         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34023         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
34024         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
34025         return tag_ptr(ret_conv, true);
34026 }
34027
34028 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34029         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
34030         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
34031         return ret_conv;
34032 }
34033
34034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34035         if (!ptr_is_owned(_res)) return;
34036         void* _res_ptr = untag_ptr(_res);
34037         CHECK_ACCESS(_res_ptr);
34038         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
34039         FREE(untag_ptr(_res));
34040         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
34041 }
34042
34043 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
34044         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
34045         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
34046         return tag_ptr(ret_conv, true);
34047 }
34048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34049         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
34050         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
34051         return ret_conv;
34052 }
34053
34054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34055         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
34056         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
34057         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
34058         return tag_ptr(ret_conv, true);
34059 }
34060
34061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34062         LDKHolderCommitmentTransaction o_conv;
34063         o_conv.inner = untag_ptr(o);
34064         o_conv.is_owned = ptr_is_owned(o);
34065         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34066         o_conv = HolderCommitmentTransaction_clone(&o_conv);
34067         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
34068         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
34069         return tag_ptr(ret_conv, true);
34070 }
34071
34072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34073         void* e_ptr = untag_ptr(e);
34074         CHECK_ACCESS(e_ptr);
34075         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34076         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34077         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
34078         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
34079         return tag_ptr(ret_conv, true);
34080 }
34081
34082 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34083         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
34084         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
34085         return ret_conv;
34086 }
34087
34088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34089         if (!ptr_is_owned(_res)) return;
34090         void* _res_ptr = untag_ptr(_res);
34091         CHECK_ACCESS(_res_ptr);
34092         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
34093         FREE(untag_ptr(_res));
34094         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
34095 }
34096
34097 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
34098         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
34099         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
34100         return tag_ptr(ret_conv, true);
34101 }
34102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34103         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
34104         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
34105         return ret_conv;
34106 }
34107
34108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34109         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
34110         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
34111         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
34112         return tag_ptr(ret_conv, true);
34113 }
34114
34115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34116         LDKBuiltCommitmentTransaction o_conv;
34117         o_conv.inner = untag_ptr(o);
34118         o_conv.is_owned = ptr_is_owned(o);
34119         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34120         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
34121         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
34122         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
34123         return tag_ptr(ret_conv, true);
34124 }
34125
34126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34127         void* e_ptr = untag_ptr(e);
34128         CHECK_ACCESS(e_ptr);
34129         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34130         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34131         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
34132         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
34133         return tag_ptr(ret_conv, true);
34134 }
34135
34136 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34137         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
34138         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
34139         return ret_conv;
34140 }
34141
34142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34143         if (!ptr_is_owned(_res)) return;
34144         void* _res_ptr = untag_ptr(_res);
34145         CHECK_ACCESS(_res_ptr);
34146         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
34147         FREE(untag_ptr(_res));
34148         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
34149 }
34150
34151 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
34152         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
34153         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
34154         return tag_ptr(ret_conv, true);
34155 }
34156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34157         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
34158         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
34159         return ret_conv;
34160 }
34161
34162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34163         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
34164         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
34165         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
34166         return tag_ptr(ret_conv, true);
34167 }
34168
34169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34170         LDKTrustedClosingTransaction o_conv;
34171         o_conv.inner = untag_ptr(o);
34172         o_conv.is_owned = ptr_is_owned(o);
34173         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34174         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
34175         
34176         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
34177         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
34178         return tag_ptr(ret_conv, true);
34179 }
34180
34181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
34182         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
34183         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
34184         return tag_ptr(ret_conv, true);
34185 }
34186
34187 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34188         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
34189         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
34190         return ret_conv;
34191 }
34192
34193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34194         if (!ptr_is_owned(_res)) return;
34195         void* _res_ptr = untag_ptr(_res);
34196         CHECK_ACCESS(_res_ptr);
34197         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
34198         FREE(untag_ptr(_res));
34199         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
34200 }
34201
34202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34203         LDKCommitmentTransaction o_conv;
34204         o_conv.inner = untag_ptr(o);
34205         o_conv.is_owned = ptr_is_owned(o);
34206         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34207         o_conv = CommitmentTransaction_clone(&o_conv);
34208         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
34209         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
34210         return tag_ptr(ret_conv, true);
34211 }
34212
34213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34214         void* e_ptr = untag_ptr(e);
34215         CHECK_ACCESS(e_ptr);
34216         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34217         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34218         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
34219         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
34220         return tag_ptr(ret_conv, true);
34221 }
34222
34223 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34224         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
34225         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
34226         return ret_conv;
34227 }
34228
34229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34230         if (!ptr_is_owned(_res)) return;
34231         void* _res_ptr = untag_ptr(_res);
34232         CHECK_ACCESS(_res_ptr);
34233         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
34234         FREE(untag_ptr(_res));
34235         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
34236 }
34237
34238 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
34239         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
34240         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
34241         return tag_ptr(ret_conv, true);
34242 }
34243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34244         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
34245         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
34246         return ret_conv;
34247 }
34248
34249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34250         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
34251         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
34252         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
34253         return tag_ptr(ret_conv, true);
34254 }
34255
34256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34257         LDKTrustedCommitmentTransaction o_conv;
34258         o_conv.inner = untag_ptr(o);
34259         o_conv.is_owned = ptr_is_owned(o);
34260         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34261         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
34262         
34263         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
34264         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
34265         return tag_ptr(ret_conv, true);
34266 }
34267
34268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
34269         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
34270         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
34271         return tag_ptr(ret_conv, true);
34272 }
34273
34274 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34275         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
34276         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
34277         return ret_conv;
34278 }
34279
34280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34281         if (!ptr_is_owned(_res)) return;
34282         void* _res_ptr = untag_ptr(_res);
34283         CHECK_ACCESS(_res_ptr);
34284         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
34285         FREE(untag_ptr(_res));
34286         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
34287 }
34288
34289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
34290         LDKCVec_ECDSASignatureZ o_constr;
34291         o_constr.datalen = (*env)->GetArrayLength(env, o);
34292         if (o_constr.datalen > 0)
34293                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
34294         else
34295                 o_constr.data = NULL;
34296         for (size_t i = 0; i < o_constr.datalen; i++) {
34297                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
34298                 LDKECDSASignature o_conv_8_ref;
34299                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
34300                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
34301                 o_constr.data[i] = o_conv_8_ref;
34302         }
34303         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
34304         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_ok(o_constr);
34305         return tag_ptr(ret_conv, true);
34306 }
34307
34308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
34309         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
34310         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_err();
34311         return tag_ptr(ret_conv, true);
34312 }
34313
34314 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34315         LDKCResult_CVec_ECDSASignatureZNoneZ* o_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(o);
34316         jboolean ret_conv = CResult_CVec_ECDSASignatureZNoneZ_is_ok(o_conv);
34317         return ret_conv;
34318 }
34319
34320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34321         if (!ptr_is_owned(_res)) return;
34322         void* _res_ptr = untag_ptr(_res);
34323         CHECK_ACCESS(_res_ptr);
34324         LDKCResult_CVec_ECDSASignatureZNoneZ _res_conv = *(LDKCResult_CVec_ECDSASignatureZNoneZ*)(_res_ptr);
34325         FREE(untag_ptr(_res));
34326         CResult_CVec_ECDSASignatureZNoneZ_free(_res_conv);
34327 }
34328
34329 static inline uint64_t CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR arg) {
34330         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
34331         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(arg);
34332         return tag_ptr(ret_conv, true);
34333 }
34334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34335         LDKCResult_CVec_ECDSASignatureZNoneZ* arg_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(arg);
34336         int64_t ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(arg_conv);
34337         return ret_conv;
34338 }
34339
34340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34341         LDKCResult_CVec_ECDSASignatureZNoneZ* orig_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(orig);
34342         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
34343         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(orig_conv);
34344         return tag_ptr(ret_conv, true);
34345 }
34346
34347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
34348         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
34349         *ret_copy = COption_usizeZ_some(o);
34350         int64_t ret_ref = tag_ptr(ret_copy, true);
34351         return ret_ref;
34352 }
34353
34354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1none(JNIEnv *env, jclass clz) {
34355         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
34356         *ret_copy = COption_usizeZ_none();
34357         int64_t ret_ref = tag_ptr(ret_copy, true);
34358         return ret_ref;
34359 }
34360
34361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34362         if (!ptr_is_owned(_res)) return;
34363         void* _res_ptr = untag_ptr(_res);
34364         CHECK_ACCESS(_res_ptr);
34365         LDKCOption_usizeZ _res_conv = *(LDKCOption_usizeZ*)(_res_ptr);
34366         FREE(untag_ptr(_res));
34367         COption_usizeZ_free(_res_conv);
34368 }
34369
34370 static inline uint64_t COption_usizeZ_clone_ptr(LDKCOption_usizeZ *NONNULL_PTR arg) {
34371         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
34372         *ret_copy = COption_usizeZ_clone(arg);
34373         int64_t ret_ref = tag_ptr(ret_copy, true);
34374         return ret_ref;
34375 }
34376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34377         LDKCOption_usizeZ* arg_conv = (LDKCOption_usizeZ*)untag_ptr(arg);
34378         int64_t ret_conv = COption_usizeZ_clone_ptr(arg_conv);
34379         return ret_conv;
34380 }
34381
34382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34383         LDKCOption_usizeZ* orig_conv = (LDKCOption_usizeZ*)untag_ptr(orig);
34384         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
34385         *ret_copy = COption_usizeZ_clone(orig_conv);
34386         int64_t ret_ref = tag_ptr(ret_copy, true);
34387         return ret_ref;
34388 }
34389
34390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34391         LDKShutdownScript o_conv;
34392         o_conv.inner = untag_ptr(o);
34393         o_conv.is_owned = ptr_is_owned(o);
34394         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34395         o_conv = ShutdownScript_clone(&o_conv);
34396         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
34397         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
34398         return tag_ptr(ret_conv, true);
34399 }
34400
34401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34402         void* e_ptr = untag_ptr(e);
34403         CHECK_ACCESS(e_ptr);
34404         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34405         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34406         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
34407         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
34408         return tag_ptr(ret_conv, true);
34409 }
34410
34411 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34412         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
34413         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
34414         return ret_conv;
34415 }
34416
34417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34418         if (!ptr_is_owned(_res)) return;
34419         void* _res_ptr = untag_ptr(_res);
34420         CHECK_ACCESS(_res_ptr);
34421         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
34422         FREE(untag_ptr(_res));
34423         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
34424 }
34425
34426 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
34427         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
34428         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
34429         return tag_ptr(ret_conv, true);
34430 }
34431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34432         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
34433         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
34434         return ret_conv;
34435 }
34436
34437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34438         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
34439         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
34440         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
34441         return tag_ptr(ret_conv, true);
34442 }
34443
34444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34445         LDKShutdownScript o_conv;
34446         o_conv.inner = untag_ptr(o);
34447         o_conv.is_owned = ptr_is_owned(o);
34448         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34449         o_conv = ShutdownScript_clone(&o_conv);
34450         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
34451         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
34452         return tag_ptr(ret_conv, true);
34453 }
34454
34455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34456         LDKInvalidShutdownScript e_conv;
34457         e_conv.inner = untag_ptr(e);
34458         e_conv.is_owned = ptr_is_owned(e);
34459         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
34460         e_conv = InvalidShutdownScript_clone(&e_conv);
34461         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
34462         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
34463         return tag_ptr(ret_conv, true);
34464 }
34465
34466 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34467         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
34468         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
34469         return ret_conv;
34470 }
34471
34472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34473         if (!ptr_is_owned(_res)) return;
34474         void* _res_ptr = untag_ptr(_res);
34475         CHECK_ACCESS(_res_ptr);
34476         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
34477         FREE(untag_ptr(_res));
34478         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
34479 }
34480
34481 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
34482         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
34483         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
34484         return tag_ptr(ret_conv, true);
34485 }
34486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34487         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
34488         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
34489         return ret_conv;
34490 }
34491
34492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34493         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
34494         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
34495         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
34496         return tag_ptr(ret_conv, true);
34497 }
34498
34499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34500         void* o_ptr = untag_ptr(o);
34501         CHECK_ACCESS(o_ptr);
34502         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
34503         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
34504         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
34505         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
34506         return tag_ptr(ret_conv, true);
34507 }
34508
34509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34510         void* e_ptr = untag_ptr(e);
34511         CHECK_ACCESS(e_ptr);
34512         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34513         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34514         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
34515         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
34516         return tag_ptr(ret_conv, true);
34517 }
34518
34519 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34520         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
34521         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
34522         return ret_conv;
34523 }
34524
34525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34526         if (!ptr_is_owned(_res)) return;
34527         void* _res_ptr = untag_ptr(_res);
34528         CHECK_ACCESS(_res_ptr);
34529         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
34530         FREE(untag_ptr(_res));
34531         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
34532 }
34533
34534 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
34535         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
34536         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
34537         return tag_ptr(ret_conv, true);
34538 }
34539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34540         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
34541         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
34542         return ret_conv;
34543 }
34544
34545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34546         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
34547         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
34548         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
34549         return tag_ptr(ret_conv, true);
34550 }
34551
34552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34553         LDKClaimedHTLC o_conv;
34554         o_conv.inner = untag_ptr(o);
34555         o_conv.is_owned = ptr_is_owned(o);
34556         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34557         o_conv = ClaimedHTLC_clone(&o_conv);
34558         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
34559         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_ok(o_conv);
34560         return tag_ptr(ret_conv, true);
34561 }
34562
34563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34564         void* e_ptr = untag_ptr(e);
34565         CHECK_ACCESS(e_ptr);
34566         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34567         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34568         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
34569         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_err(e_conv);
34570         return tag_ptr(ret_conv, true);
34571 }
34572
34573 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34574         LDKCResult_ClaimedHTLCDecodeErrorZ* o_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(o);
34575         jboolean ret_conv = CResult_ClaimedHTLCDecodeErrorZ_is_ok(o_conv);
34576         return ret_conv;
34577 }
34578
34579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34580         if (!ptr_is_owned(_res)) return;
34581         void* _res_ptr = untag_ptr(_res);
34582         CHECK_ACCESS(_res_ptr);
34583         LDKCResult_ClaimedHTLCDecodeErrorZ _res_conv = *(LDKCResult_ClaimedHTLCDecodeErrorZ*)(_res_ptr);
34584         FREE(untag_ptr(_res));
34585         CResult_ClaimedHTLCDecodeErrorZ_free(_res_conv);
34586 }
34587
34588 static inline uint64_t CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR arg) {
34589         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
34590         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(arg);
34591         return tag_ptr(ret_conv, true);
34592 }
34593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34594         LDKCResult_ClaimedHTLCDecodeErrorZ* arg_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(arg);
34595         int64_t ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(arg_conv);
34596         return ret_conv;
34597 }
34598
34599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34600         LDKCResult_ClaimedHTLCDecodeErrorZ* orig_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(orig);
34601         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
34602         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(orig_conv);
34603         return tag_ptr(ret_conv, true);
34604 }
34605
34606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1some(JNIEnv *env, jclass clz, int64_t o) {
34607         void* o_ptr = untag_ptr(o);
34608         CHECK_ACCESS(o_ptr);
34609         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
34610         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
34611         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
34612         *ret_copy = COption_PathFailureZ_some(o_conv);
34613         int64_t ret_ref = tag_ptr(ret_copy, true);
34614         return ret_ref;
34615 }
34616
34617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1none(JNIEnv *env, jclass clz) {
34618         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
34619         *ret_copy = COption_PathFailureZ_none();
34620         int64_t ret_ref = tag_ptr(ret_copy, true);
34621         return ret_ref;
34622 }
34623
34624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34625         if (!ptr_is_owned(_res)) return;
34626         void* _res_ptr = untag_ptr(_res);
34627         CHECK_ACCESS(_res_ptr);
34628         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
34629         FREE(untag_ptr(_res));
34630         COption_PathFailureZ_free(_res_conv);
34631 }
34632
34633 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
34634         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
34635         *ret_copy = COption_PathFailureZ_clone(arg);
34636         int64_t ret_ref = tag_ptr(ret_copy, true);
34637         return ret_ref;
34638 }
34639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34640         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
34641         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
34642         return ret_conv;
34643 }
34644
34645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34646         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
34647         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
34648         *ret_copy = COption_PathFailureZ_clone(orig_conv);
34649         int64_t ret_ref = tag_ptr(ret_copy, true);
34650         return ret_ref;
34651 }
34652
34653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34654         void* o_ptr = untag_ptr(o);
34655         CHECK_ACCESS(o_ptr);
34656         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
34657         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
34658         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
34659         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
34660         return tag_ptr(ret_conv, true);
34661 }
34662
34663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34664         void* e_ptr = untag_ptr(e);
34665         CHECK_ACCESS(e_ptr);
34666         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34667         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34668         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
34669         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
34670         return tag_ptr(ret_conv, true);
34671 }
34672
34673 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34674         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
34675         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
34676         return ret_conv;
34677 }
34678
34679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34680         if (!ptr_is_owned(_res)) return;
34681         void* _res_ptr = untag_ptr(_res);
34682         CHECK_ACCESS(_res_ptr);
34683         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
34684         FREE(untag_ptr(_res));
34685         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
34686 }
34687
34688 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
34689         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
34690         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
34691         return tag_ptr(ret_conv, true);
34692 }
34693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34694         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
34695         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
34696         return ret_conv;
34697 }
34698
34699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34700         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
34701         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
34702         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
34703         return tag_ptr(ret_conv, true);
34704 }
34705
34706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
34707         void* o_ptr = untag_ptr(o);
34708         CHECK_ACCESS(o_ptr);
34709         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
34710         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
34711         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
34712         *ret_copy = COption_ClosureReasonZ_some(o_conv);
34713         int64_t ret_ref = tag_ptr(ret_copy, true);
34714         return ret_ref;
34715 }
34716
34717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
34718         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
34719         *ret_copy = COption_ClosureReasonZ_none();
34720         int64_t ret_ref = tag_ptr(ret_copy, true);
34721         return ret_ref;
34722 }
34723
34724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34725         if (!ptr_is_owned(_res)) return;
34726         void* _res_ptr = untag_ptr(_res);
34727         CHECK_ACCESS(_res_ptr);
34728         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
34729         FREE(untag_ptr(_res));
34730         COption_ClosureReasonZ_free(_res_conv);
34731 }
34732
34733 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
34734         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
34735         *ret_copy = COption_ClosureReasonZ_clone(arg);
34736         int64_t ret_ref = tag_ptr(ret_copy, true);
34737         return ret_ref;
34738 }
34739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34740         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
34741         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
34742         return ret_conv;
34743 }
34744
34745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34746         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
34747         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
34748         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
34749         int64_t ret_ref = tag_ptr(ret_copy, true);
34750         return ret_ref;
34751 }
34752
34753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34754         void* o_ptr = untag_ptr(o);
34755         CHECK_ACCESS(o_ptr);
34756         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
34757         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
34758         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
34759         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
34760         return tag_ptr(ret_conv, true);
34761 }
34762
34763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34764         void* e_ptr = untag_ptr(e);
34765         CHECK_ACCESS(e_ptr);
34766         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34767         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34768         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
34769         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
34770         return tag_ptr(ret_conv, true);
34771 }
34772
34773 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34774         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
34775         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
34776         return ret_conv;
34777 }
34778
34779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34780         if (!ptr_is_owned(_res)) return;
34781         void* _res_ptr = untag_ptr(_res);
34782         CHECK_ACCESS(_res_ptr);
34783         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
34784         FREE(untag_ptr(_res));
34785         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
34786 }
34787
34788 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
34789         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
34790         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
34791         return tag_ptr(ret_conv, true);
34792 }
34793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34794         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
34795         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
34796         return ret_conv;
34797 }
34798
34799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34800         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
34801         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
34802         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
34803         return tag_ptr(ret_conv, true);
34804 }
34805
34806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1some(JNIEnv *env, jclass clz, int64_t o) {
34807         void* o_ptr = untag_ptr(o);
34808         CHECK_ACCESS(o_ptr);
34809         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
34810         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
34811         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
34812         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
34813         int64_t ret_ref = tag_ptr(ret_copy, true);
34814         return ret_ref;
34815 }
34816
34817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1none(JNIEnv *env, jclass clz) {
34818         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
34819         *ret_copy = COption_HTLCDestinationZ_none();
34820         int64_t ret_ref = tag_ptr(ret_copy, true);
34821         return ret_ref;
34822 }
34823
34824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34825         if (!ptr_is_owned(_res)) return;
34826         void* _res_ptr = untag_ptr(_res);
34827         CHECK_ACCESS(_res_ptr);
34828         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
34829         FREE(untag_ptr(_res));
34830         COption_HTLCDestinationZ_free(_res_conv);
34831 }
34832
34833 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
34834         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
34835         *ret_copy = COption_HTLCDestinationZ_clone(arg);
34836         int64_t ret_ref = tag_ptr(ret_copy, true);
34837         return ret_ref;
34838 }
34839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34840         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
34841         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
34842         return ret_conv;
34843 }
34844
34845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34846         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
34847         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
34848         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
34849         int64_t ret_ref = tag_ptr(ret_copy, true);
34850         return ret_ref;
34851 }
34852
34853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34854         void* o_ptr = untag_ptr(o);
34855         CHECK_ACCESS(o_ptr);
34856         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
34857         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
34858         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
34859         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
34860         return tag_ptr(ret_conv, true);
34861 }
34862
34863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34864         void* e_ptr = untag_ptr(e);
34865         CHECK_ACCESS(e_ptr);
34866         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34867         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34868         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
34869         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
34870         return tag_ptr(ret_conv, true);
34871 }
34872
34873 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34874         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
34875         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
34876         return ret_conv;
34877 }
34878
34879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34880         if (!ptr_is_owned(_res)) return;
34881         void* _res_ptr = untag_ptr(_res);
34882         CHECK_ACCESS(_res_ptr);
34883         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
34884         FREE(untag_ptr(_res));
34885         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
34886 }
34887
34888 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
34889         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
34890         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
34891         return tag_ptr(ret_conv, true);
34892 }
34893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34894         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
34895         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
34896         return ret_conv;
34897 }
34898
34899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34900         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
34901         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
34902         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
34903         return tag_ptr(ret_conv, true);
34904 }
34905
34906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
34907         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_java(env, o);
34908         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
34909         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
34910         return tag_ptr(ret_conv, true);
34911 }
34912
34913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34914         void* e_ptr = untag_ptr(e);
34915         CHECK_ACCESS(e_ptr);
34916         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34917         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34918         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
34919         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
34920         return tag_ptr(ret_conv, true);
34921 }
34922
34923 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34924         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
34925         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
34926         return ret_conv;
34927 }
34928
34929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34930         if (!ptr_is_owned(_res)) return;
34931         void* _res_ptr = untag_ptr(_res);
34932         CHECK_ACCESS(_res_ptr);
34933         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
34934         FREE(untag_ptr(_res));
34935         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
34936 }
34937
34938 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
34939         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
34940         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
34941         return tag_ptr(ret_conv, true);
34942 }
34943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34944         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
34945         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
34946         return ret_conv;
34947 }
34948
34949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34950         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
34951         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
34952         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
34953         return tag_ptr(ret_conv, true);
34954 }
34955
34956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1some(JNIEnv *env, jclass clz, int8_tArray o) {
34957         LDKU128 o_ref;
34958         CHECK((*env)->GetArrayLength(env, o) == 16);
34959         (*env)->GetByteArrayRegion(env, o, 0, 16, o_ref.le_bytes);
34960         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
34961         *ret_copy = COption_U128Z_some(o_ref);
34962         int64_t ret_ref = tag_ptr(ret_copy, true);
34963         return ret_ref;
34964 }
34965
34966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1none(JNIEnv *env, jclass clz) {
34967         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
34968         *ret_copy = COption_U128Z_none();
34969         int64_t ret_ref = tag_ptr(ret_copy, true);
34970         return ret_ref;
34971 }
34972
34973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
34974         if (!ptr_is_owned(_res)) return;
34975         void* _res_ptr = untag_ptr(_res);
34976         CHECK_ACCESS(_res_ptr);
34977         LDKCOption_U128Z _res_conv = *(LDKCOption_U128Z*)(_res_ptr);
34978         FREE(untag_ptr(_res));
34979         COption_U128Z_free(_res_conv);
34980 }
34981
34982 static inline uint64_t COption_U128Z_clone_ptr(LDKCOption_U128Z *NONNULL_PTR arg) {
34983         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
34984         *ret_copy = COption_U128Z_clone(arg);
34985         int64_t ret_ref = tag_ptr(ret_copy, true);
34986         return ret_ref;
34987 }
34988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34989         LDKCOption_U128Z* arg_conv = (LDKCOption_U128Z*)untag_ptr(arg);
34990         int64_t ret_conv = COption_U128Z_clone_ptr(arg_conv);
34991         return ret_conv;
34992 }
34993
34994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34995         LDKCOption_U128Z* orig_conv = (LDKCOption_U128Z*)untag_ptr(orig);
34996         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
34997         *ret_copy = COption_U128Z_clone(orig_conv);
34998         int64_t ret_ref = tag_ptr(ret_copy, true);
34999         return ret_ref;
35000 }
35001
35002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ClaimedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
35003         LDKCVec_ClaimedHTLCZ _res_constr;
35004         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
35005         if (_res_constr.datalen > 0)
35006                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
35007         else
35008                 _res_constr.data = NULL;
35009         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
35010         for (size_t n = 0; n < _res_constr.datalen; n++) {
35011                 int64_t _res_conv_13 = _res_vals[n];
35012                 LDKClaimedHTLC _res_conv_13_conv;
35013                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
35014                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
35015                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
35016                 _res_constr.data[n] = _res_conv_13_conv;
35017         }
35018         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
35019         CVec_ClaimedHTLCZ_free(_res_constr);
35020 }
35021
35022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1some(JNIEnv *env, jclass clz, jclass o) {
35023         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_java(env, o);
35024         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
35025         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
35026         int64_t ret_ref = tag_ptr(ret_copy, true);
35027         return ret_ref;
35028 }
35029
35030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1none(JNIEnv *env, jclass clz) {
35031         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
35032         *ret_copy = COption_PaymentFailureReasonZ_none();
35033         int64_t ret_ref = tag_ptr(ret_copy, true);
35034         return ret_ref;
35035 }
35036
35037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35038         if (!ptr_is_owned(_res)) return;
35039         void* _res_ptr = untag_ptr(_res);
35040         CHECK_ACCESS(_res_ptr);
35041         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
35042         FREE(untag_ptr(_res));
35043         COption_PaymentFailureReasonZ_free(_res_conv);
35044 }
35045
35046 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
35047         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
35048         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
35049         int64_t ret_ref = tag_ptr(ret_copy, true);
35050         return ret_ref;
35051 }
35052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35053         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
35054         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
35055         return ret_conv;
35056 }
35057
35058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35059         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
35060         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
35061         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
35062         int64_t ret_ref = tag_ptr(ret_copy, true);
35063         return ret_ref;
35064 }
35065
35066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
35067         void* o_ptr = untag_ptr(o);
35068         CHECK_ACCESS(o_ptr);
35069         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
35070         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
35071         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
35072         *ret_copy = COption_EventZ_some(o_conv);
35073         int64_t ret_ref = tag_ptr(ret_copy, true);
35074         return ret_ref;
35075 }
35076
35077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
35078         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
35079         *ret_copy = COption_EventZ_none();
35080         int64_t ret_ref = tag_ptr(ret_copy, true);
35081         return ret_ref;
35082 }
35083
35084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35085         if (!ptr_is_owned(_res)) return;
35086         void* _res_ptr = untag_ptr(_res);
35087         CHECK_ACCESS(_res_ptr);
35088         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
35089         FREE(untag_ptr(_res));
35090         COption_EventZ_free(_res_conv);
35091 }
35092
35093 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
35094         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
35095         *ret_copy = COption_EventZ_clone(arg);
35096         int64_t ret_ref = tag_ptr(ret_copy, true);
35097         return ret_ref;
35098 }
35099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35100         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
35101         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
35102         return ret_conv;
35103 }
35104
35105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35106         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
35107         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
35108         *ret_copy = COption_EventZ_clone(orig_conv);
35109         int64_t ret_ref = tag_ptr(ret_copy, true);
35110         return ret_ref;
35111 }
35112
35113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35114         void* o_ptr = untag_ptr(o);
35115         CHECK_ACCESS(o_ptr);
35116         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
35117         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
35118         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
35119         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
35120         return tag_ptr(ret_conv, true);
35121 }
35122
35123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35124         void* e_ptr = untag_ptr(e);
35125         CHECK_ACCESS(e_ptr);
35126         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35127         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35128         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
35129         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
35130         return tag_ptr(ret_conv, true);
35131 }
35132
35133 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35134         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
35135         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
35136         return ret_conv;
35137 }
35138
35139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35140         if (!ptr_is_owned(_res)) return;
35141         void* _res_ptr = untag_ptr(_res);
35142         CHECK_ACCESS(_res_ptr);
35143         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
35144         FREE(untag_ptr(_res));
35145         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
35146 }
35147
35148 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
35149         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
35150         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
35151         return tag_ptr(ret_conv, true);
35152 }
35153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35154         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
35155         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
35156         return ret_conv;
35157 }
35158
35159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35160         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
35161         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
35162         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
35163         return tag_ptr(ret_conv, true);
35164 }
35165
35166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
35167         LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
35168         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
35169         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
35170         return tag_ptr(ret_conv, true);
35171 }
35172
35173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35174         void* e_ptr = untag_ptr(e);
35175         CHECK_ACCESS(e_ptr);
35176         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
35177         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
35178         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
35179         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
35180         return tag_ptr(ret_conv, true);
35181 }
35182
35183 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35184         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
35185         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
35186         return ret_conv;
35187 }
35188
35189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35190         if (!ptr_is_owned(_res)) return;
35191         void* _res_ptr = untag_ptr(_res);
35192         CHECK_ACCESS(_res_ptr);
35193         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
35194         FREE(untag_ptr(_res));
35195         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
35196 }
35197
35198 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
35199         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
35200         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
35201         return tag_ptr(ret_conv, true);
35202 }
35203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35204         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
35205         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
35206         return ret_conv;
35207 }
35208
35209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35210         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
35211         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
35212         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
35213         return tag_ptr(ret_conv, true);
35214 }
35215
35216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35217         LDKBolt11Invoice o_conv;
35218         o_conv.inner = untag_ptr(o);
35219         o_conv.is_owned = ptr_is_owned(o);
35220         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35221         o_conv = Bolt11Invoice_clone(&o_conv);
35222         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
35223         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
35224         return tag_ptr(ret_conv, true);
35225 }
35226
35227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35228         void* e_ptr = untag_ptr(e);
35229         CHECK_ACCESS(e_ptr);
35230         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
35231         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
35232         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
35233         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
35234         return tag_ptr(ret_conv, true);
35235 }
35236
35237 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35238         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
35239         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
35240         return ret_conv;
35241 }
35242
35243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35244         if (!ptr_is_owned(_res)) return;
35245         void* _res_ptr = untag_ptr(_res);
35246         CHECK_ACCESS(_res_ptr);
35247         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
35248         FREE(untag_ptr(_res));
35249         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
35250 }
35251
35252 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
35253         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
35254         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
35255         return tag_ptr(ret_conv, true);
35256 }
35257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35258         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
35259         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
35260         return ret_conv;
35261 }
35262
35263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35264         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
35265         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
35266         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
35267         return tag_ptr(ret_conv, true);
35268 }
35269
35270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35271         LDKSignedRawBolt11Invoice o_conv;
35272         o_conv.inner = untag_ptr(o);
35273         o_conv.is_owned = ptr_is_owned(o);
35274         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35275         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
35276         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
35277         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
35278         return tag_ptr(ret_conv, true);
35279 }
35280
35281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35282         void* e_ptr = untag_ptr(e);
35283         CHECK_ACCESS(e_ptr);
35284         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
35285         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
35286         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
35287         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
35288         return tag_ptr(ret_conv, true);
35289 }
35290
35291 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35292         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
35293         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
35294         return ret_conv;
35295 }
35296
35297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35298         if (!ptr_is_owned(_res)) return;
35299         void* _res_ptr = untag_ptr(_res);
35300         CHECK_ACCESS(_res_ptr);
35301         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
35302         FREE(untag_ptr(_res));
35303         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
35304 }
35305
35306 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
35307         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
35308         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
35309         return tag_ptr(ret_conv, true);
35310 }
35311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35312         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
35313         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
35314         return ret_conv;
35315 }
35316
35317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35318         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
35319         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
35320         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
35321         return tag_ptr(ret_conv, true);
35322 }
35323
35324 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
35325         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
35326         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
35327         return tag_ptr(ret_conv, true);
35328 }
35329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35330         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
35331         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
35332         return ret_conv;
35333 }
35334
35335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35336         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
35337         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
35338         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
35339         return tag_ptr(ret_conv, true);
35340 }
35341
35342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b, int64_t c) {
35343         LDKRawBolt11Invoice a_conv;
35344         a_conv.inner = untag_ptr(a);
35345         a_conv.is_owned = ptr_is_owned(a);
35346         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35347         a_conv = RawBolt11Invoice_clone(&a_conv);
35348         LDKThirtyTwoBytes b_ref;
35349         CHECK((*env)->GetArrayLength(env, b) == 32);
35350         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
35351         LDKBolt11InvoiceSignature c_conv;
35352         c_conv.inner = untag_ptr(c);
35353         c_conv.is_owned = ptr_is_owned(c);
35354         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
35355         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
35356         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
35357         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
35358         return tag_ptr(ret_conv, true);
35359 }
35360
35361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35362         if (!ptr_is_owned(_res)) return;
35363         void* _res_ptr = untag_ptr(_res);
35364         CHECK_ACCESS(_res_ptr);
35365         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
35366         FREE(untag_ptr(_res));
35367         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
35368 }
35369
35370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35371         LDKPayeePubKey o_conv;
35372         o_conv.inner = untag_ptr(o);
35373         o_conv.is_owned = ptr_is_owned(o);
35374         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35375         o_conv = PayeePubKey_clone(&o_conv);
35376         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
35377         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_ok(o_conv);
35378         return tag_ptr(ret_conv, true);
35379 }
35380
35381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
35382         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
35383         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
35384         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_err(e_conv);
35385         return tag_ptr(ret_conv, true);
35386 }
35387
35388 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35389         LDKCResult_PayeePubKeySecp256k1ErrorZ* o_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(o);
35390         jboolean ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o_conv);
35391         return ret_conv;
35392 }
35393
35394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35395         if (!ptr_is_owned(_res)) return;
35396         void* _res_ptr = untag_ptr(_res);
35397         CHECK_ACCESS(_res_ptr);
35398         LDKCResult_PayeePubKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PayeePubKeySecp256k1ErrorZ*)(_res_ptr);
35399         FREE(untag_ptr(_res));
35400         CResult_PayeePubKeySecp256k1ErrorZ_free(_res_conv);
35401 }
35402
35403 static inline uint64_t CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR arg) {
35404         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
35405         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(arg);
35406         return tag_ptr(ret_conv, true);
35407 }
35408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35409         LDKCResult_PayeePubKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(arg);
35410         int64_t ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(arg_conv);
35411         return ret_conv;
35412 }
35413
35414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35415         LDKCResult_PayeePubKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(orig);
35416         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
35417         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(orig_conv);
35418         return tag_ptr(ret_conv, true);
35419 }
35420
35421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
35422         LDKCVec_PrivateRouteZ _res_constr;
35423         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
35424         if (_res_constr.datalen > 0)
35425                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
35426         else
35427                 _res_constr.data = NULL;
35428         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
35429         for (size_t o = 0; o < _res_constr.datalen; o++) {
35430                 int64_t _res_conv_14 = _res_vals[o];
35431                 LDKPrivateRoute _res_conv_14_conv;
35432                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
35433                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
35434                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
35435                 _res_constr.data[o] = _res_conv_14_conv;
35436         }
35437         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
35438         CVec_PrivateRouteZ_free(_res_constr);
35439 }
35440
35441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35442         LDKPositiveTimestamp o_conv;
35443         o_conv.inner = untag_ptr(o);
35444         o_conv.is_owned = ptr_is_owned(o);
35445         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35446         o_conv = PositiveTimestamp_clone(&o_conv);
35447         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
35448         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
35449         return tag_ptr(ret_conv, true);
35450 }
35451
35452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
35453         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
35454         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
35455         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
35456         return tag_ptr(ret_conv, true);
35457 }
35458
35459 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35460         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
35461         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
35462         return ret_conv;
35463 }
35464
35465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35466         if (!ptr_is_owned(_res)) return;
35467         void* _res_ptr = untag_ptr(_res);
35468         CHECK_ACCESS(_res_ptr);
35469         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
35470         FREE(untag_ptr(_res));
35471         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
35472 }
35473
35474 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
35475         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
35476         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
35477         return tag_ptr(ret_conv, true);
35478 }
35479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35480         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
35481         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
35482         return ret_conv;
35483 }
35484
35485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35486         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
35487         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
35488         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
35489         return tag_ptr(ret_conv, true);
35490 }
35491
35492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
35493         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
35494         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
35495         return tag_ptr(ret_conv, true);
35496 }
35497
35498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
35499         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_java(env, e);
35500         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
35501         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
35502         return tag_ptr(ret_conv, true);
35503 }
35504
35505 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35506         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
35507         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
35508         return ret_conv;
35509 }
35510
35511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35512         if (!ptr_is_owned(_res)) return;
35513         void* _res_ptr = untag_ptr(_res);
35514         CHECK_ACCESS(_res_ptr);
35515         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
35516         FREE(untag_ptr(_res));
35517         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
35518 }
35519
35520 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
35521         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
35522         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
35523         return tag_ptr(ret_conv, true);
35524 }
35525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35526         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
35527         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
35528         return ret_conv;
35529 }
35530
35531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35532         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
35533         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
35534         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
35535         return tag_ptr(ret_conv, true);
35536 }
35537
35538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35539         LDKBolt11Invoice o_conv;
35540         o_conv.inner = untag_ptr(o);
35541         o_conv.is_owned = ptr_is_owned(o);
35542         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35543         o_conv = Bolt11Invoice_clone(&o_conv);
35544         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
35545         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
35546         return tag_ptr(ret_conv, true);
35547 }
35548
35549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
35550         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_java(env, e);
35551         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
35552         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
35553         return tag_ptr(ret_conv, true);
35554 }
35555
35556 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35557         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
35558         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
35559         return ret_conv;
35560 }
35561
35562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35563         if (!ptr_is_owned(_res)) return;
35564         void* _res_ptr = untag_ptr(_res);
35565         CHECK_ACCESS(_res_ptr);
35566         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
35567         FREE(untag_ptr(_res));
35568         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
35569 }
35570
35571 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
35572         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
35573         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
35574         return tag_ptr(ret_conv, true);
35575 }
35576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35577         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
35578         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
35579         return ret_conv;
35580 }
35581
35582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35583         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
35584         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
35585         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
35586         return tag_ptr(ret_conv, true);
35587 }
35588
35589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35590         LDKDescription o_conv;
35591         o_conv.inner = untag_ptr(o);
35592         o_conv.is_owned = ptr_is_owned(o);
35593         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35594         o_conv = Description_clone(&o_conv);
35595         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
35596         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
35597         return tag_ptr(ret_conv, true);
35598 }
35599
35600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
35601         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
35602         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
35603         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
35604         return tag_ptr(ret_conv, true);
35605 }
35606
35607 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35608         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
35609         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
35610         return ret_conv;
35611 }
35612
35613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35614         if (!ptr_is_owned(_res)) return;
35615         void* _res_ptr = untag_ptr(_res);
35616         CHECK_ACCESS(_res_ptr);
35617         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
35618         FREE(untag_ptr(_res));
35619         CResult_DescriptionCreationErrorZ_free(_res_conv);
35620 }
35621
35622 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
35623         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
35624         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
35625         return tag_ptr(ret_conv, true);
35626 }
35627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35628         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
35629         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
35630         return ret_conv;
35631 }
35632
35633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35634         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
35635         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
35636         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
35637         return tag_ptr(ret_conv, true);
35638 }
35639
35640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35641         LDKPrivateRoute o_conv;
35642         o_conv.inner = untag_ptr(o);
35643         o_conv.is_owned = ptr_is_owned(o);
35644         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35645         o_conv = PrivateRoute_clone(&o_conv);
35646         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
35647         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
35648         return tag_ptr(ret_conv, true);
35649 }
35650
35651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
35652         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
35653         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
35654         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
35655         return tag_ptr(ret_conv, true);
35656 }
35657
35658 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35659         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
35660         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
35661         return ret_conv;
35662 }
35663
35664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35665         if (!ptr_is_owned(_res)) return;
35666         void* _res_ptr = untag_ptr(_res);
35667         CHECK_ACCESS(_res_ptr);
35668         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
35669         FREE(untag_ptr(_res));
35670         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
35671 }
35672
35673 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
35674         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
35675         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
35676         return tag_ptr(ret_conv, true);
35677 }
35678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35679         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
35680         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
35681         return ret_conv;
35682 }
35683
35684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35685         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
35686         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
35687         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
35688         return tag_ptr(ret_conv, true);
35689 }
35690
35691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35692         LDKOutPoint o_conv;
35693         o_conv.inner = untag_ptr(o);
35694         o_conv.is_owned = ptr_is_owned(o);
35695         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35696         o_conv = OutPoint_clone(&o_conv);
35697         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
35698         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
35699         return tag_ptr(ret_conv, true);
35700 }
35701
35702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35703         void* e_ptr = untag_ptr(e);
35704         CHECK_ACCESS(e_ptr);
35705         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35706         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35707         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
35708         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
35709         return tag_ptr(ret_conv, true);
35710 }
35711
35712 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35713         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
35714         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
35715         return ret_conv;
35716 }
35717
35718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35719         if (!ptr_is_owned(_res)) return;
35720         void* _res_ptr = untag_ptr(_res);
35721         CHECK_ACCESS(_res_ptr);
35722         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
35723         FREE(untag_ptr(_res));
35724         CResult_OutPointDecodeErrorZ_free(_res_conv);
35725 }
35726
35727 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
35728         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
35729         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
35730         return tag_ptr(ret_conv, true);
35731 }
35732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35733         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
35734         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
35735         return ret_conv;
35736 }
35737
35738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35739         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
35740         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
35741         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
35742         return tag_ptr(ret_conv, true);
35743 }
35744
35745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35746         LDKBigSize o_conv;
35747         o_conv.inner = untag_ptr(o);
35748         o_conv.is_owned = ptr_is_owned(o);
35749         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35750         o_conv = BigSize_clone(&o_conv);
35751         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
35752         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
35753         return tag_ptr(ret_conv, true);
35754 }
35755
35756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35757         void* e_ptr = untag_ptr(e);
35758         CHECK_ACCESS(e_ptr);
35759         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35760         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35761         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
35762         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
35763         return tag_ptr(ret_conv, true);
35764 }
35765
35766 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35767         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
35768         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
35769         return ret_conv;
35770 }
35771
35772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35773         if (!ptr_is_owned(_res)) return;
35774         void* _res_ptr = untag_ptr(_res);
35775         CHECK_ACCESS(_res_ptr);
35776         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
35777         FREE(untag_ptr(_res));
35778         CResult_BigSizeDecodeErrorZ_free(_res_conv);
35779 }
35780
35781 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
35782         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
35783         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
35784         return tag_ptr(ret_conv, true);
35785 }
35786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35787         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
35788         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
35789         return ret_conv;
35790 }
35791
35792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35793         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
35794         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
35795         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
35796         return tag_ptr(ret_conv, true);
35797 }
35798
35799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35800         LDKHostname o_conv;
35801         o_conv.inner = untag_ptr(o);
35802         o_conv.is_owned = ptr_is_owned(o);
35803         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35804         o_conv = Hostname_clone(&o_conv);
35805         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
35806         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
35807         return tag_ptr(ret_conv, true);
35808 }
35809
35810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35811         void* e_ptr = untag_ptr(e);
35812         CHECK_ACCESS(e_ptr);
35813         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35814         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35815         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
35816         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
35817         return tag_ptr(ret_conv, true);
35818 }
35819
35820 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35821         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
35822         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
35823         return ret_conv;
35824 }
35825
35826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35827         if (!ptr_is_owned(_res)) return;
35828         void* _res_ptr = untag_ptr(_res);
35829         CHECK_ACCESS(_res_ptr);
35830         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
35831         FREE(untag_ptr(_res));
35832         CResult_HostnameDecodeErrorZ_free(_res_conv);
35833 }
35834
35835 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
35836         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
35837         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
35838         return tag_ptr(ret_conv, true);
35839 }
35840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35841         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
35842         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
35843         return ret_conv;
35844 }
35845
35846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35847         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
35848         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
35849         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
35850         return tag_ptr(ret_conv, true);
35851 }
35852
35853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35854         LDKTransactionU16LenLimited o_conv;
35855         o_conv.inner = untag_ptr(o);
35856         o_conv.is_owned = ptr_is_owned(o);
35857         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35858         o_conv = TransactionU16LenLimited_clone(&o_conv);
35859         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
35860         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
35861         return tag_ptr(ret_conv, true);
35862 }
35863
35864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1err(JNIEnv *env, jclass clz) {
35865         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
35866         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
35867         return tag_ptr(ret_conv, true);
35868 }
35869
35870 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35871         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
35872         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
35873         return ret_conv;
35874 }
35875
35876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35877         if (!ptr_is_owned(_res)) return;
35878         void* _res_ptr = untag_ptr(_res);
35879         CHECK_ACCESS(_res_ptr);
35880         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
35881         FREE(untag_ptr(_res));
35882         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
35883 }
35884
35885 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
35886         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
35887         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
35888         return tag_ptr(ret_conv, true);
35889 }
35890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35891         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
35892         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
35893         return ret_conv;
35894 }
35895
35896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35897         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
35898         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
35899         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
35900         return tag_ptr(ret_conv, true);
35901 }
35902
35903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35904         LDKTransactionU16LenLimited o_conv;
35905         o_conv.inner = untag_ptr(o);
35906         o_conv.is_owned = ptr_is_owned(o);
35907         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35908         o_conv = TransactionU16LenLimited_clone(&o_conv);
35909         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
35910         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
35911         return tag_ptr(ret_conv, true);
35912 }
35913
35914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35915         void* e_ptr = untag_ptr(e);
35916         CHECK_ACCESS(e_ptr);
35917         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35918         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35919         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
35920         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
35921         return tag_ptr(ret_conv, true);
35922 }
35923
35924 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35925         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
35926         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
35927         return ret_conv;
35928 }
35929
35930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35931         if (!ptr_is_owned(_res)) return;
35932         void* _res_ptr = untag_ptr(_res);
35933         CHECK_ACCESS(_res_ptr);
35934         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
35935         FREE(untag_ptr(_res));
35936         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
35937 }
35938
35939 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
35940         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
35941         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
35942         return tag_ptr(ret_conv, true);
35943 }
35944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35945         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
35946         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
35947         return ret_conv;
35948 }
35949
35950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35951         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
35952         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
35953         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
35954         return tag_ptr(ret_conv, true);
35955 }
35956
35957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35958         LDKUntrustedString o_conv;
35959         o_conv.inner = untag_ptr(o);
35960         o_conv.is_owned = ptr_is_owned(o);
35961         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35962         o_conv = UntrustedString_clone(&o_conv);
35963         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
35964         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
35965         return tag_ptr(ret_conv, true);
35966 }
35967
35968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35969         void* e_ptr = untag_ptr(e);
35970         CHECK_ACCESS(e_ptr);
35971         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35972         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35973         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
35974         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
35975         return tag_ptr(ret_conv, true);
35976 }
35977
35978 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35979         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
35980         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
35981         return ret_conv;
35982 }
35983
35984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35985         if (!ptr_is_owned(_res)) return;
35986         void* _res_ptr = untag_ptr(_res);
35987         CHECK_ACCESS(_res_ptr);
35988         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
35989         FREE(untag_ptr(_res));
35990         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
35991 }
35992
35993 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
35994         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
35995         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
35996         return tag_ptr(ret_conv, true);
35997 }
35998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35999         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
36000         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
36001         return ret_conv;
36002 }
36003
36004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36005         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
36006         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
36007         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
36008         return tag_ptr(ret_conv, true);
36009 }
36010
36011 static inline uint64_t C2Tuple__u832u16Z_clone_ptr(LDKC2Tuple__u832u16Z *NONNULL_PTR arg) {
36012         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
36013         *ret_conv = C2Tuple__u832u16Z_clone(arg);
36014         return tag_ptr(ret_conv, true);
36015 }
36016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36017         LDKC2Tuple__u832u16Z* arg_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(arg);
36018         int64_t ret_conv = C2Tuple__u832u16Z_clone_ptr(arg_conv);
36019         return ret_conv;
36020 }
36021
36022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36023         LDKC2Tuple__u832u16Z* orig_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(orig);
36024         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
36025         *ret_conv = C2Tuple__u832u16Z_clone(orig_conv);
36026         return tag_ptr(ret_conv, true);
36027 }
36028
36029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1new(JNIEnv *env, jclass clz, int8_tArray a, int16_t b) {
36030         LDKThirtyTwoBytes a_ref;
36031         CHECK((*env)->GetArrayLength(env, a) == 32);
36032         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
36033         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
36034         *ret_conv = C2Tuple__u832u16Z_new(a_ref, b);
36035         return tag_ptr(ret_conv, true);
36036 }
36037
36038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
36039         if (!ptr_is_owned(_res)) return;
36040         void* _res_ptr = untag_ptr(_res);
36041         CHECK_ACCESS(_res_ptr);
36042         LDKC2Tuple__u832u16Z _res_conv = *(LDKC2Tuple__u832u16Z*)(_res_ptr);
36043         FREE(untag_ptr(_res));
36044         C2Tuple__u832u16Z_free(_res_conv);
36045 }
36046
36047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36048         LDKPaymentRelay o_conv;
36049         o_conv.inner = untag_ptr(o);
36050         o_conv.is_owned = ptr_is_owned(o);
36051         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36052         o_conv = PaymentRelay_clone(&o_conv);
36053         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
36054         *ret_conv = CResult_PaymentRelayDecodeErrorZ_ok(o_conv);
36055         return tag_ptr(ret_conv, true);
36056 }
36057
36058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36059         void* e_ptr = untag_ptr(e);
36060         CHECK_ACCESS(e_ptr);
36061         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36062         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36063         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
36064         *ret_conv = CResult_PaymentRelayDecodeErrorZ_err(e_conv);
36065         return tag_ptr(ret_conv, true);
36066 }
36067
36068 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36069         LDKCResult_PaymentRelayDecodeErrorZ* o_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(o);
36070         jboolean ret_conv = CResult_PaymentRelayDecodeErrorZ_is_ok(o_conv);
36071         return ret_conv;
36072 }
36073
36074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36075         if (!ptr_is_owned(_res)) return;
36076         void* _res_ptr = untag_ptr(_res);
36077         CHECK_ACCESS(_res_ptr);
36078         LDKCResult_PaymentRelayDecodeErrorZ _res_conv = *(LDKCResult_PaymentRelayDecodeErrorZ*)(_res_ptr);
36079         FREE(untag_ptr(_res));
36080         CResult_PaymentRelayDecodeErrorZ_free(_res_conv);
36081 }
36082
36083 static inline uint64_t CResult_PaymentRelayDecodeErrorZ_clone_ptr(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR arg) {
36084         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
36085         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(arg);
36086         return tag_ptr(ret_conv, true);
36087 }
36088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36089         LDKCResult_PaymentRelayDecodeErrorZ* arg_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(arg);
36090         int64_t ret_conv = CResult_PaymentRelayDecodeErrorZ_clone_ptr(arg_conv);
36091         return ret_conv;
36092 }
36093
36094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36095         LDKCResult_PaymentRelayDecodeErrorZ* orig_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(orig);
36096         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
36097         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(orig_conv);
36098         return tag_ptr(ret_conv, true);
36099 }
36100
36101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36102         LDKPaymentConstraints o_conv;
36103         o_conv.inner = untag_ptr(o);
36104         o_conv.is_owned = ptr_is_owned(o);
36105         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36106         o_conv = PaymentConstraints_clone(&o_conv);
36107         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
36108         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_ok(o_conv);
36109         return tag_ptr(ret_conv, true);
36110 }
36111
36112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36113         void* e_ptr = untag_ptr(e);
36114         CHECK_ACCESS(e_ptr);
36115         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36116         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36117         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
36118         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_err(e_conv);
36119         return tag_ptr(ret_conv, true);
36120 }
36121
36122 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36123         LDKCResult_PaymentConstraintsDecodeErrorZ* o_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(o);
36124         jboolean ret_conv = CResult_PaymentConstraintsDecodeErrorZ_is_ok(o_conv);
36125         return ret_conv;
36126 }
36127
36128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36129         if (!ptr_is_owned(_res)) return;
36130         void* _res_ptr = untag_ptr(_res);
36131         CHECK_ACCESS(_res_ptr);
36132         LDKCResult_PaymentConstraintsDecodeErrorZ _res_conv = *(LDKCResult_PaymentConstraintsDecodeErrorZ*)(_res_ptr);
36133         FREE(untag_ptr(_res));
36134         CResult_PaymentConstraintsDecodeErrorZ_free(_res_conv);
36135 }
36136
36137 static inline uint64_t CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR arg) {
36138         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
36139         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(arg);
36140         return tag_ptr(ret_conv, true);
36141 }
36142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36143         LDKCResult_PaymentConstraintsDecodeErrorZ* arg_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(arg);
36144         int64_t ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(arg_conv);
36145         return ret_conv;
36146 }
36147
36148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36149         LDKCResult_PaymentConstraintsDecodeErrorZ* orig_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(orig);
36150         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
36151         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(orig_conv);
36152         return tag_ptr(ret_conv, true);
36153 }
36154
36155 static inline uint64_t C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR arg) {
36156         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
36157         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(arg);
36158         return tag_ptr(ret_conv, true);
36159 }
36160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36161         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(arg);
36162         int64_t ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(arg_conv);
36163         return ret_conv;
36164 }
36165
36166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36167         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(orig);
36168         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
36169         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig_conv);
36170         return tag_ptr(ret_conv, true);
36171 }
36172
36173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b, int64_t c) {
36174         LDKThirtyTwoBytes a_ref;
36175         CHECK((*env)->GetArrayLength(env, a) == 32);
36176         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
36177         LDKRecipientOnionFields b_conv;
36178         b_conv.inner = untag_ptr(b);
36179         b_conv.is_owned = ptr_is_owned(b);
36180         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36181         b_conv = RecipientOnionFields_clone(&b_conv);
36182         LDKRouteParameters c_conv;
36183         c_conv.inner = untag_ptr(c);
36184         c_conv.is_owned = ptr_is_owned(c);
36185         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
36186         c_conv = RouteParameters_clone(&c_conv);
36187         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
36188         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(a_ref, b_conv, c_conv);
36189         return tag_ptr(ret_conv, true);
36190 }
36191
36192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36193         if (!ptr_is_owned(_res)) return;
36194         void* _res_ptr = untag_ptr(_res);
36195         CHECK_ACCESS(_res_ptr);
36196         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(_res_ptr);
36197         FREE(untag_ptr(_res));
36198         C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res_conv);
36199 }
36200
36201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36202         void* o_ptr = untag_ptr(o);
36203         CHECK_ACCESS(o_ptr);
36204         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ o_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(o_ptr);
36205         o_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone((LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(o));
36206         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
36207         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o_conv);
36208         return tag_ptr(ret_conv, true);
36209 }
36210
36211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1err(JNIEnv *env, jclass clz) {
36212         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
36213         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err();
36214         return tag_ptr(ret_conv, true);
36215 }
36216
36217 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36218         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* o_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(o);
36219         jboolean ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o_conv);
36220         return ret_conv;
36221 }
36222
36223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36224         if (!ptr_is_owned(_res)) return;
36225         void* _res_ptr = untag_ptr(_res);
36226         CHECK_ACCESS(_res_ptr);
36227         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ _res_conv = *(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)(_res_ptr);
36228         FREE(untag_ptr(_res));
36229         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res_conv);
36230 }
36231
36232 static inline uint64_t CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR arg) {
36233         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
36234         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(arg);
36235         return tag_ptr(ret_conv, true);
36236 }
36237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36238         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* arg_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(arg);
36239         int64_t ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(arg_conv);
36240         return ret_conv;
36241 }
36242
36243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36244         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* orig_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(orig);
36245         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
36246         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig_conv);
36247         return tag_ptr(ret_conv, true);
36248 }
36249
36250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
36251         LDKStr o_conv = java_to_owned_str(env, o);
36252         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
36253         *ret_conv = CResult_StrSecp256k1ErrorZ_ok(o_conv);
36254         return tag_ptr(ret_conv, true);
36255 }
36256
36257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
36258         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
36259         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
36260         *ret_conv = CResult_StrSecp256k1ErrorZ_err(e_conv);
36261         return tag_ptr(ret_conv, true);
36262 }
36263
36264 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36265         LDKCResult_StrSecp256k1ErrorZ* o_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(o);
36266         jboolean ret_conv = CResult_StrSecp256k1ErrorZ_is_ok(o_conv);
36267         return ret_conv;
36268 }
36269
36270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36271         if (!ptr_is_owned(_res)) return;
36272         void* _res_ptr = untag_ptr(_res);
36273         CHECK_ACCESS(_res_ptr);
36274         LDKCResult_StrSecp256k1ErrorZ _res_conv = *(LDKCResult_StrSecp256k1ErrorZ*)(_res_ptr);
36275         FREE(untag_ptr(_res));
36276         CResult_StrSecp256k1ErrorZ_free(_res_conv);
36277 }
36278
36279 static inline uint64_t CResult_StrSecp256k1ErrorZ_clone_ptr(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR arg) {
36280         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
36281         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(arg);
36282         return tag_ptr(ret_conv, true);
36283 }
36284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36285         LDKCResult_StrSecp256k1ErrorZ* arg_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(arg);
36286         int64_t ret_conv = CResult_StrSecp256k1ErrorZ_clone_ptr(arg_conv);
36287         return ret_conv;
36288 }
36289
36290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36291         LDKCResult_StrSecp256k1ErrorZ* orig_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(orig);
36292         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
36293         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(orig_conv);
36294         return tag_ptr(ret_conv, true);
36295 }
36296
36297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36298         void* o_ptr = untag_ptr(o);
36299         CHECK_ACCESS(o_ptr);
36300         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
36301         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
36302         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
36303         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
36304         return tag_ptr(ret_conv, true);
36305 }
36306
36307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
36308         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_java(env, e);
36309         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
36310         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
36311         return tag_ptr(ret_conv, true);
36312 }
36313
36314 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36315         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
36316         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
36317         return ret_conv;
36318 }
36319
36320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36321         if (!ptr_is_owned(_res)) return;
36322         void* _res_ptr = untag_ptr(_res);
36323         CHECK_ACCESS(_res_ptr);
36324         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
36325         FREE(untag_ptr(_res));
36326         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
36327 }
36328
36329 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
36330         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
36331         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
36332         return tag_ptr(ret_conv, true);
36333 }
36334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36335         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
36336         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
36337         return ret_conv;
36338 }
36339
36340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36341         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
36342         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
36343         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
36344         return tag_ptr(ret_conv, true);
36345 }
36346
36347 static inline uint64_t C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR arg) {
36348         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
36349         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(arg);
36350         return tag_ptr(ret_conv, true);
36351 }
36352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36353         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* arg_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(arg);
36354         int64_t ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(arg_conv);
36355         return ret_conv;
36356 }
36357
36358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36359         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* orig_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(orig);
36360         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
36361         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(orig_conv);
36362         return tag_ptr(ret_conv, true);
36363 }
36364
36365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b, int64_t c) {
36366         LDKPublicKey a_ref;
36367         CHECK((*env)->GetArrayLength(env, a) == 33);
36368         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
36369         LDKOnionMessage b_conv;
36370         b_conv.inner = untag_ptr(b);
36371         b_conv.is_owned = ptr_is_owned(b);
36372         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36373         b_conv = OnionMessage_clone(&b_conv);
36374         void* c_ptr = untag_ptr(c);
36375         CHECK_ACCESS(c_ptr);
36376         LDKCOption_CVec_SocketAddressZZ c_conv = *(LDKCOption_CVec_SocketAddressZZ*)(c_ptr);
36377         c_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(c));
36378         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
36379         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(a_ref, b_conv, c_conv);
36380         return tag_ptr(ret_conv, true);
36381 }
36382
36383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36384         if (!ptr_is_owned(_res)) return;
36385         void* _res_ptr = untag_ptr(_res);
36386         CHECK_ACCESS(_res_ptr);
36387         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ _res_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(_res_ptr);
36388         FREE(untag_ptr(_res));
36389         C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(_res_conv);
36390 }
36391
36392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36393         void* o_ptr = untag_ptr(o);
36394         CHECK_ACCESS(o_ptr);
36395         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ o_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(o_ptr);
36396         o_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone((LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(o));
36397         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
36398         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(o_conv);
36399         return tag_ptr(ret_conv, true);
36400 }
36401
36402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36403         void* e_ptr = untag_ptr(e);
36404         CHECK_ACCESS(e_ptr);
36405         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
36406         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
36407         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
36408         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(e_conv);
36409         return tag_ptr(ret_conv, true);
36410 }
36411
36412 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36413         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* o_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(o);
36414         jboolean ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(o_conv);
36415         return ret_conv;
36416 }
36417
36418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36419         if (!ptr_is_owned(_res)) return;
36420         void* _res_ptr = untag_ptr(_res);
36421         CHECK_ACCESS(_res_ptr);
36422         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ _res_conv = *(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)(_res_ptr);
36423         FREE(untag_ptr(_res));
36424         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(_res_conv);
36425 }
36426
36427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36428         void* o_ptr = untag_ptr(o);
36429         CHECK_ACCESS(o_ptr);
36430         LDKPeeledOnion o_conv = *(LDKPeeledOnion*)(o_ptr);
36431         o_conv = PeeledOnion_clone((LDKPeeledOnion*)untag_ptr(o));
36432         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
36433         *ret_conv = CResult_PeeledOnionNoneZ_ok(o_conv);
36434         return tag_ptr(ret_conv, true);
36435 }
36436
36437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1err(JNIEnv *env, jclass clz) {
36438         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
36439         *ret_conv = CResult_PeeledOnionNoneZ_err();
36440         return tag_ptr(ret_conv, true);
36441 }
36442
36443 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36444         LDKCResult_PeeledOnionNoneZ* o_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(o);
36445         jboolean ret_conv = CResult_PeeledOnionNoneZ_is_ok(o_conv);
36446         return ret_conv;
36447 }
36448
36449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36450         if (!ptr_is_owned(_res)) return;
36451         void* _res_ptr = untag_ptr(_res);
36452         CHECK_ACCESS(_res_ptr);
36453         LDKCResult_PeeledOnionNoneZ _res_conv = *(LDKCResult_PeeledOnionNoneZ*)(_res_ptr);
36454         FREE(untag_ptr(_res));
36455         CResult_PeeledOnionNoneZ_free(_res_conv);
36456 }
36457
36458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36459         void* o_ptr = untag_ptr(o);
36460         CHECK_ACCESS(o_ptr);
36461         LDKSendSuccess o_conv = *(LDKSendSuccess*)(o_ptr);
36462         o_conv = SendSuccess_clone((LDKSendSuccess*)untag_ptr(o));
36463         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
36464         *ret_conv = CResult_SendSuccessSendErrorZ_ok(o_conv);
36465         return tag_ptr(ret_conv, true);
36466 }
36467
36468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36469         void* e_ptr = untag_ptr(e);
36470         CHECK_ACCESS(e_ptr);
36471         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
36472         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
36473         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
36474         *ret_conv = CResult_SendSuccessSendErrorZ_err(e_conv);
36475         return tag_ptr(ret_conv, true);
36476 }
36477
36478 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36479         LDKCResult_SendSuccessSendErrorZ* o_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(o);
36480         jboolean ret_conv = CResult_SendSuccessSendErrorZ_is_ok(o_conv);
36481         return ret_conv;
36482 }
36483
36484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36485         if (!ptr_is_owned(_res)) return;
36486         void* _res_ptr = untag_ptr(_res);
36487         CHECK_ACCESS(_res_ptr);
36488         LDKCResult_SendSuccessSendErrorZ _res_conv = *(LDKCResult_SendSuccessSendErrorZ*)(_res_ptr);
36489         FREE(untag_ptr(_res));
36490         CResult_SendSuccessSendErrorZ_free(_res_conv);
36491 }
36492
36493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36494         LDKBlindedPath o_conv;
36495         o_conv.inner = untag_ptr(o);
36496         o_conv.is_owned = ptr_is_owned(o);
36497         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36498         o_conv = BlindedPath_clone(&o_conv);
36499         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
36500         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
36501         return tag_ptr(ret_conv, true);
36502 }
36503
36504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1err(JNIEnv *env, jclass clz) {
36505         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
36506         *ret_conv = CResult_BlindedPathNoneZ_err();
36507         return tag_ptr(ret_conv, true);
36508 }
36509
36510 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36511         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
36512         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
36513         return ret_conv;
36514 }
36515
36516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36517         if (!ptr_is_owned(_res)) return;
36518         void* _res_ptr = untag_ptr(_res);
36519         CHECK_ACCESS(_res_ptr);
36520         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
36521         FREE(untag_ptr(_res));
36522         CResult_BlindedPathNoneZ_free(_res_conv);
36523 }
36524
36525 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
36526         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
36527         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
36528         return tag_ptr(ret_conv, true);
36529 }
36530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36531         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
36532         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
36533         return ret_conv;
36534 }
36535
36536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36537         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
36538         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
36539         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
36540         return tag_ptr(ret_conv, true);
36541 }
36542
36543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36544         void* o_ptr = untag_ptr(o);
36545         CHECK_ACCESS(o_ptr);
36546         LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_ptr);
36547         o_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o));
36548         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
36549         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o_conv);
36550         return tag_ptr(ret_conv, true);
36551 }
36552
36553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1err(JNIEnv *env, jclass clz) {
36554         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
36555         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err();
36556         return tag_ptr(ret_conv, true);
36557 }
36558
36559 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36560         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* o_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(o);
36561         jboolean ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o_conv);
36562         return ret_conv;
36563 }
36564
36565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36566         if (!ptr_is_owned(_res)) return;
36567         void* _res_ptr = untag_ptr(_res);
36568         CHECK_ACCESS(_res_ptr);
36569         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res_conv = *(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)(_res_ptr);
36570         FREE(untag_ptr(_res));
36571         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res_conv);
36572 }
36573
36574 static inline uint64_t CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR arg) {
36575         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
36576         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(arg);
36577         return tag_ptr(ret_conv, true);
36578 }
36579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36580         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* arg_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(arg);
36581         int64_t ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(arg_conv);
36582         return ret_conv;
36583 }
36584
36585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36586         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* orig_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(orig);
36587         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
36588         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig_conv);
36589         return tag_ptr(ret_conv, true);
36590 }
36591
36592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ForwardNodeZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
36593         LDKCVec_ForwardNodeZ _res_constr;
36594         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
36595         if (_res_constr.datalen > 0)
36596                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
36597         else
36598                 _res_constr.data = NULL;
36599         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
36600         for (size_t n = 0; n < _res_constr.datalen; n++) {
36601                 int64_t _res_conv_13 = _res_vals[n];
36602                 LDKForwardNode _res_conv_13_conv;
36603                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
36604                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
36605                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
36606                 _res_constr.data[n] = _res_conv_13_conv;
36607         }
36608         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
36609         CVec_ForwardNodeZ_free(_res_constr);
36610 }
36611
36612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36613         LDKBlindedPath o_conv;
36614         o_conv.inner = untag_ptr(o);
36615         o_conv.is_owned = ptr_is_owned(o);
36616         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36617         o_conv = BlindedPath_clone(&o_conv);
36618         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
36619         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
36620         return tag_ptr(ret_conv, true);
36621 }
36622
36623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36624         void* e_ptr = untag_ptr(e);
36625         CHECK_ACCESS(e_ptr);
36626         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36627         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36628         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
36629         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
36630         return tag_ptr(ret_conv, true);
36631 }
36632
36633 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36634         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
36635         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
36636         return ret_conv;
36637 }
36638
36639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36640         if (!ptr_is_owned(_res)) return;
36641         void* _res_ptr = untag_ptr(_res);
36642         CHECK_ACCESS(_res_ptr);
36643         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
36644         FREE(untag_ptr(_res));
36645         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
36646 }
36647
36648 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
36649         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
36650         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
36651         return tag_ptr(ret_conv, true);
36652 }
36653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36654         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
36655         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
36656         return ret_conv;
36657 }
36658
36659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36660         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
36661         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
36662         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
36663         return tag_ptr(ret_conv, true);
36664 }
36665
36666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36667         LDKBlindedHop o_conv;
36668         o_conv.inner = untag_ptr(o);
36669         o_conv.is_owned = ptr_is_owned(o);
36670         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36671         o_conv = BlindedHop_clone(&o_conv);
36672         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
36673         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
36674         return tag_ptr(ret_conv, true);
36675 }
36676
36677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36678         void* e_ptr = untag_ptr(e);
36679         CHECK_ACCESS(e_ptr);
36680         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36681         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36682         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
36683         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
36684         return tag_ptr(ret_conv, true);
36685 }
36686
36687 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36688         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
36689         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
36690         return ret_conv;
36691 }
36692
36693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36694         if (!ptr_is_owned(_res)) return;
36695         void* _res_ptr = untag_ptr(_res);
36696         CHECK_ACCESS(_res_ptr);
36697         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
36698         FREE(untag_ptr(_res));
36699         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
36700 }
36701
36702 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
36703         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
36704         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
36705         return tag_ptr(ret_conv, true);
36706 }
36707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36708         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
36709         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
36710         return ret_conv;
36711 }
36712
36713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36714         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
36715         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
36716         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
36717         return tag_ptr(ret_conv, true);
36718 }
36719
36720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36721         LDKInvoiceError o_conv;
36722         o_conv.inner = untag_ptr(o);
36723         o_conv.is_owned = ptr_is_owned(o);
36724         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36725         o_conv = InvoiceError_clone(&o_conv);
36726         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
36727         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
36728         return tag_ptr(ret_conv, true);
36729 }
36730
36731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36732         void* e_ptr = untag_ptr(e);
36733         CHECK_ACCESS(e_ptr);
36734         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36735         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36736         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
36737         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
36738         return tag_ptr(ret_conv, true);
36739 }
36740
36741 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36742         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
36743         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
36744         return ret_conv;
36745 }
36746
36747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36748         if (!ptr_is_owned(_res)) return;
36749         void* _res_ptr = untag_ptr(_res);
36750         CHECK_ACCESS(_res_ptr);
36751         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
36752         FREE(untag_ptr(_res));
36753         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
36754 }
36755
36756 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
36757         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
36758         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
36759         return tag_ptr(ret_conv, true);
36760 }
36761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36762         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
36763         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
36764         return ret_conv;
36765 }
36766
36767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36768         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
36769         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
36770         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
36771         return tag_ptr(ret_conv, true);
36772 }
36773
36774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36775         LDKDelayedPaymentBasepoint o_conv;
36776         o_conv.inner = untag_ptr(o);
36777         o_conv.is_owned = ptr_is_owned(o);
36778         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36779         o_conv = DelayedPaymentBasepoint_clone(&o_conv);
36780         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
36781         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_ok(o_conv);
36782         return tag_ptr(ret_conv, true);
36783 }
36784
36785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36786         void* e_ptr = untag_ptr(e);
36787         CHECK_ACCESS(e_ptr);
36788         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36789         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36790         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
36791         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_err(e_conv);
36792         return tag_ptr(ret_conv, true);
36793 }
36794
36795 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36796         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(o);
36797         jboolean ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(o_conv);
36798         return ret_conv;
36799 }
36800
36801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36802         if (!ptr_is_owned(_res)) return;
36803         void* _res_ptr = untag_ptr(_res);
36804         CHECK_ACCESS(_res_ptr);
36805         LDKCResult_DelayedPaymentBasepointDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)(_res_ptr);
36806         FREE(untag_ptr(_res));
36807         CResult_DelayedPaymentBasepointDecodeErrorZ_free(_res_conv);
36808 }
36809
36810 static inline uint64_t CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR arg) {
36811         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
36812         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(arg);
36813         return tag_ptr(ret_conv, true);
36814 }
36815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36816         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(arg);
36817         int64_t ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(arg_conv);
36818         return ret_conv;
36819 }
36820
36821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36822         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(orig);
36823         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
36824         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(orig_conv);
36825         return tag_ptr(ret_conv, true);
36826 }
36827
36828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36829         LDKDelayedPaymentKey o_conv;
36830         o_conv.inner = untag_ptr(o);
36831         o_conv.is_owned = ptr_is_owned(o);
36832         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36833         o_conv = DelayedPaymentKey_clone(&o_conv);
36834         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
36835         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_ok(o_conv);
36836         return tag_ptr(ret_conv, true);
36837 }
36838
36839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36840         void* e_ptr = untag_ptr(e);
36841         CHECK_ACCESS(e_ptr);
36842         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36843         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36844         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
36845         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_err(e_conv);
36846         return tag_ptr(ret_conv, true);
36847 }
36848
36849 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36850         LDKCResult_DelayedPaymentKeyDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(o);
36851         jboolean ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(o_conv);
36852         return ret_conv;
36853 }
36854
36855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36856         if (!ptr_is_owned(_res)) return;
36857         void* _res_ptr = untag_ptr(_res);
36858         CHECK_ACCESS(_res_ptr);
36859         LDKCResult_DelayedPaymentKeyDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentKeyDecodeErrorZ*)(_res_ptr);
36860         FREE(untag_ptr(_res));
36861         CResult_DelayedPaymentKeyDecodeErrorZ_free(_res_conv);
36862 }
36863
36864 static inline uint64_t CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR arg) {
36865         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
36866         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(arg);
36867         return tag_ptr(ret_conv, true);
36868 }
36869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36870         LDKCResult_DelayedPaymentKeyDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(arg);
36871         int64_t ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(arg_conv);
36872         return ret_conv;
36873 }
36874
36875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36876         LDKCResult_DelayedPaymentKeyDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(orig);
36877         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
36878         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(orig_conv);
36879         return tag_ptr(ret_conv, true);
36880 }
36881
36882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36883         LDKHtlcBasepoint o_conv;
36884         o_conv.inner = untag_ptr(o);
36885         o_conv.is_owned = ptr_is_owned(o);
36886         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36887         o_conv = HtlcBasepoint_clone(&o_conv);
36888         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
36889         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_ok(o_conv);
36890         return tag_ptr(ret_conv, true);
36891 }
36892
36893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36894         void* e_ptr = untag_ptr(e);
36895         CHECK_ACCESS(e_ptr);
36896         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36897         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36898         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
36899         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_err(e_conv);
36900         return tag_ptr(ret_conv, true);
36901 }
36902
36903 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36904         LDKCResult_HtlcBasepointDecodeErrorZ* o_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(o);
36905         jboolean ret_conv = CResult_HtlcBasepointDecodeErrorZ_is_ok(o_conv);
36906         return ret_conv;
36907 }
36908
36909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36910         if (!ptr_is_owned(_res)) return;
36911         void* _res_ptr = untag_ptr(_res);
36912         CHECK_ACCESS(_res_ptr);
36913         LDKCResult_HtlcBasepointDecodeErrorZ _res_conv = *(LDKCResult_HtlcBasepointDecodeErrorZ*)(_res_ptr);
36914         FREE(untag_ptr(_res));
36915         CResult_HtlcBasepointDecodeErrorZ_free(_res_conv);
36916 }
36917
36918 static inline uint64_t CResult_HtlcBasepointDecodeErrorZ_clone_ptr(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR arg) {
36919         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
36920         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(arg);
36921         return tag_ptr(ret_conv, true);
36922 }
36923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36924         LDKCResult_HtlcBasepointDecodeErrorZ* arg_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(arg);
36925         int64_t ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone_ptr(arg_conv);
36926         return ret_conv;
36927 }
36928
36929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36930         LDKCResult_HtlcBasepointDecodeErrorZ* orig_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(orig);
36931         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
36932         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(orig_conv);
36933         return tag_ptr(ret_conv, true);
36934 }
36935
36936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36937         LDKHtlcKey o_conv;
36938         o_conv.inner = untag_ptr(o);
36939         o_conv.is_owned = ptr_is_owned(o);
36940         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36941         o_conv = HtlcKey_clone(&o_conv);
36942         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
36943         *ret_conv = CResult_HtlcKeyDecodeErrorZ_ok(o_conv);
36944         return tag_ptr(ret_conv, true);
36945 }
36946
36947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36948         void* e_ptr = untag_ptr(e);
36949         CHECK_ACCESS(e_ptr);
36950         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36951         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36952         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
36953         *ret_conv = CResult_HtlcKeyDecodeErrorZ_err(e_conv);
36954         return tag_ptr(ret_conv, true);
36955 }
36956
36957 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36958         LDKCResult_HtlcKeyDecodeErrorZ* o_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(o);
36959         jboolean ret_conv = CResult_HtlcKeyDecodeErrorZ_is_ok(o_conv);
36960         return ret_conv;
36961 }
36962
36963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36964         if (!ptr_is_owned(_res)) return;
36965         void* _res_ptr = untag_ptr(_res);
36966         CHECK_ACCESS(_res_ptr);
36967         LDKCResult_HtlcKeyDecodeErrorZ _res_conv = *(LDKCResult_HtlcKeyDecodeErrorZ*)(_res_ptr);
36968         FREE(untag_ptr(_res));
36969         CResult_HtlcKeyDecodeErrorZ_free(_res_conv);
36970 }
36971
36972 static inline uint64_t CResult_HtlcKeyDecodeErrorZ_clone_ptr(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR arg) {
36973         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
36974         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(arg);
36975         return tag_ptr(ret_conv, true);
36976 }
36977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36978         LDKCResult_HtlcKeyDecodeErrorZ* arg_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(arg);
36979         int64_t ret_conv = CResult_HtlcKeyDecodeErrorZ_clone_ptr(arg_conv);
36980         return ret_conv;
36981 }
36982
36983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36984         LDKCResult_HtlcKeyDecodeErrorZ* orig_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(orig);
36985         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
36986         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(orig_conv);
36987         return tag_ptr(ret_conv, true);
36988 }
36989
36990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36991         LDKRevocationBasepoint o_conv;
36992         o_conv.inner = untag_ptr(o);
36993         o_conv.is_owned = ptr_is_owned(o);
36994         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36995         o_conv = RevocationBasepoint_clone(&o_conv);
36996         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
36997         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_ok(o_conv);
36998         return tag_ptr(ret_conv, true);
36999 }
37000
37001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37002         void* e_ptr = untag_ptr(e);
37003         CHECK_ACCESS(e_ptr);
37004         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37005         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37006         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
37007         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_err(e_conv);
37008         return tag_ptr(ret_conv, true);
37009 }
37010
37011 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37012         LDKCResult_RevocationBasepointDecodeErrorZ* o_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(o);
37013         jboolean ret_conv = CResult_RevocationBasepointDecodeErrorZ_is_ok(o_conv);
37014         return ret_conv;
37015 }
37016
37017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37018         if (!ptr_is_owned(_res)) return;
37019         void* _res_ptr = untag_ptr(_res);
37020         CHECK_ACCESS(_res_ptr);
37021         LDKCResult_RevocationBasepointDecodeErrorZ _res_conv = *(LDKCResult_RevocationBasepointDecodeErrorZ*)(_res_ptr);
37022         FREE(untag_ptr(_res));
37023         CResult_RevocationBasepointDecodeErrorZ_free(_res_conv);
37024 }
37025
37026 static inline uint64_t CResult_RevocationBasepointDecodeErrorZ_clone_ptr(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR arg) {
37027         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
37028         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(arg);
37029         return tag_ptr(ret_conv, true);
37030 }
37031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37032         LDKCResult_RevocationBasepointDecodeErrorZ* arg_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(arg);
37033         int64_t ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone_ptr(arg_conv);
37034         return ret_conv;
37035 }
37036
37037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37038         LDKCResult_RevocationBasepointDecodeErrorZ* orig_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(orig);
37039         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
37040         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(orig_conv);
37041         return tag_ptr(ret_conv, true);
37042 }
37043
37044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37045         LDKRevocationKey o_conv;
37046         o_conv.inner = untag_ptr(o);
37047         o_conv.is_owned = ptr_is_owned(o);
37048         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37049         o_conv = RevocationKey_clone(&o_conv);
37050         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
37051         *ret_conv = CResult_RevocationKeyDecodeErrorZ_ok(o_conv);
37052         return tag_ptr(ret_conv, true);
37053 }
37054
37055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37056         void* e_ptr = untag_ptr(e);
37057         CHECK_ACCESS(e_ptr);
37058         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37059         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37060         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
37061         *ret_conv = CResult_RevocationKeyDecodeErrorZ_err(e_conv);
37062         return tag_ptr(ret_conv, true);
37063 }
37064
37065 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37066         LDKCResult_RevocationKeyDecodeErrorZ* o_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(o);
37067         jboolean ret_conv = CResult_RevocationKeyDecodeErrorZ_is_ok(o_conv);
37068         return ret_conv;
37069 }
37070
37071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37072         if (!ptr_is_owned(_res)) return;
37073         void* _res_ptr = untag_ptr(_res);
37074         CHECK_ACCESS(_res_ptr);
37075         LDKCResult_RevocationKeyDecodeErrorZ _res_conv = *(LDKCResult_RevocationKeyDecodeErrorZ*)(_res_ptr);
37076         FREE(untag_ptr(_res));
37077         CResult_RevocationKeyDecodeErrorZ_free(_res_conv);
37078 }
37079
37080 static inline uint64_t CResult_RevocationKeyDecodeErrorZ_clone_ptr(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR arg) {
37081         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
37082         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(arg);
37083         return tag_ptr(ret_conv, true);
37084 }
37085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37086         LDKCResult_RevocationKeyDecodeErrorZ* arg_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(arg);
37087         int64_t ret_conv = CResult_RevocationKeyDecodeErrorZ_clone_ptr(arg_conv);
37088         return ret_conv;
37089 }
37090
37091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37092         LDKCResult_RevocationKeyDecodeErrorZ* orig_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(orig);
37093         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
37094         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(orig_conv);
37095         return tag_ptr(ret_conv, true);
37096 }
37097
37098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
37099         void* o_ptr = untag_ptr(o);
37100         CHECK_ACCESS(o_ptr);
37101         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
37102         if (o_conv.free == LDKFilter_JCalls_free) {
37103                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37104                 LDKFilter_JCalls_cloned(&o_conv);
37105         }
37106         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
37107         *ret_copy = COption_FilterZ_some(o_conv);
37108         int64_t ret_ref = tag_ptr(ret_copy, true);
37109         return ret_ref;
37110 }
37111
37112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
37113         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
37114         *ret_copy = COption_FilterZ_none();
37115         int64_t ret_ref = tag_ptr(ret_copy, true);
37116         return ret_ref;
37117 }
37118
37119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37120         if (!ptr_is_owned(_res)) return;
37121         void* _res_ptr = untag_ptr(_res);
37122         CHECK_ACCESS(_res_ptr);
37123         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
37124         FREE(untag_ptr(_res));
37125         COption_FilterZ_free(_res_conv);
37126 }
37127
37128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37129         LDKLockedChannelMonitor o_conv;
37130         o_conv.inner = untag_ptr(o);
37131         o_conv.is_owned = ptr_is_owned(o);
37132         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37133         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
37134         
37135         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
37136         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
37137         return tag_ptr(ret_conv, true);
37138 }
37139
37140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
37141         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
37142         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
37143         return tag_ptr(ret_conv, true);
37144 }
37145
37146 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37147         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
37148         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
37149         return ret_conv;
37150 }
37151
37152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37153         if (!ptr_is_owned(_res)) return;
37154         void* _res_ptr = untag_ptr(_res);
37155         CHECK_ACCESS(_res_ptr);
37156         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
37157         FREE(untag_ptr(_res));
37158         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
37159 }
37160
37161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
37162         LDKCVec_OutPointZ _res_constr;
37163         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
37164         if (_res_constr.datalen > 0)
37165                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
37166         else
37167                 _res_constr.data = NULL;
37168         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
37169         for (size_t k = 0; k < _res_constr.datalen; k++) {
37170                 int64_t _res_conv_10 = _res_vals[k];
37171                 LDKOutPoint _res_conv_10_conv;
37172                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
37173                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
37174                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
37175                 _res_constr.data[k] = _res_conv_10_conv;
37176         }
37177         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
37178         CVec_OutPointZ_free(_res_constr);
37179 }
37180
37181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorUpdateIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
37182         LDKCVec_MonitorUpdateIdZ _res_constr;
37183         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
37184         if (_res_constr.datalen > 0)
37185                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
37186         else
37187                 _res_constr.data = NULL;
37188         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
37189         for (size_t r = 0; r < _res_constr.datalen; r++) {
37190                 int64_t _res_conv_17 = _res_vals[r];
37191                 LDKMonitorUpdateId _res_conv_17_conv;
37192                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
37193                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
37194                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
37195                 _res_constr.data[r] = _res_conv_17_conv;
37196         }
37197         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
37198         CVec_MonitorUpdateIdZ_free(_res_constr);
37199 }
37200
37201 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
37202         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
37203         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
37204         return tag_ptr(ret_conv, true);
37205 }
37206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37207         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
37208         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
37209         return ret_conv;
37210 }
37211
37212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37213         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
37214         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
37215         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
37216         return tag_ptr(ret_conv, true);
37217 }
37218
37219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b) {
37220         LDKOutPoint a_conv;
37221         a_conv.inner = untag_ptr(a);
37222         a_conv.is_owned = ptr_is_owned(a);
37223         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37224         a_conv = OutPoint_clone(&a_conv);
37225         LDKCVec_MonitorUpdateIdZ b_constr;
37226         b_constr.datalen = (*env)->GetArrayLength(env, b);
37227         if (b_constr.datalen > 0)
37228                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
37229         else
37230                 b_constr.data = NULL;
37231         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
37232         for (size_t r = 0; r < b_constr.datalen; r++) {
37233                 int64_t b_conv_17 = b_vals[r];
37234                 LDKMonitorUpdateId b_conv_17_conv;
37235                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
37236                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
37237                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
37238                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
37239                 b_constr.data[r] = b_conv_17_conv;
37240         }
37241         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
37242         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
37243         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
37244         return tag_ptr(ret_conv, true);
37245 }
37246
37247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37248         if (!ptr_is_owned(_res)) return;
37249         void* _res_ptr = untag_ptr(_res);
37250         CHECK_ACCESS(_res_ptr);
37251         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
37252         FREE(untag_ptr(_res));
37253         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
37254 }
37255
37256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1OutPointCVec_1MonitorUpdateIdZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
37257         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
37258         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
37259         if (_res_constr.datalen > 0)
37260                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
37261         else
37262                 _res_constr.data = NULL;
37263         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
37264         for (size_t p = 0; p < _res_constr.datalen; p++) {
37265                 int64_t _res_conv_41 = _res_vals[p];
37266                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
37267                 CHECK_ACCESS(_res_conv_41_ptr);
37268                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
37269                 FREE(untag_ptr(_res_conv_41));
37270                 _res_constr.data[p] = _res_conv_41_conv;
37271         }
37272         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
37273         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
37274 }
37275
37276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37277         if (!ptr_is_owned(this_ptr)) return;
37278         void* this_ptr_ptr = untag_ptr(this_ptr);
37279         CHECK_ACCESS(this_ptr_ptr);
37280         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
37281         FREE(untag_ptr(this_ptr));
37282         APIError_free(this_ptr_conv);
37283 }
37284
37285 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
37286         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
37287         *ret_copy = APIError_clone(arg);
37288         int64_t ret_ref = tag_ptr(ret_copy, true);
37289         return ret_ref;
37290 }
37291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37292         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
37293         int64_t ret_conv = APIError_clone_ptr(arg_conv);
37294         return ret_conv;
37295 }
37296
37297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37298         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
37299         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
37300         *ret_copy = APIError_clone(orig_conv);
37301         int64_t ret_ref = tag_ptr(ret_copy, true);
37302         return ret_ref;
37303 }
37304
37305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
37306         LDKStr err_conv = java_to_owned_str(env, err);
37307         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
37308         *ret_copy = APIError_apimisuse_error(err_conv);
37309         int64_t ret_ref = tag_ptr(ret_copy, true);
37310         return ret_ref;
37311 }
37312
37313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
37314         LDKStr err_conv = java_to_owned_str(env, err);
37315         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
37316         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
37317         int64_t ret_ref = tag_ptr(ret_copy, true);
37318         return ret_ref;
37319 }
37320
37321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1invalid_1route(JNIEnv *env, jclass clz, jstring err) {
37322         LDKStr err_conv = java_to_owned_str(env, err);
37323         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
37324         *ret_copy = APIError_invalid_route(err_conv);
37325         int64_t ret_ref = tag_ptr(ret_copy, true);
37326         return ret_ref;
37327 }
37328
37329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
37330         LDKStr err_conv = java_to_owned_str(env, err);
37331         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
37332         *ret_copy = APIError_channel_unavailable(err_conv);
37333         int64_t ret_ref = tag_ptr(ret_copy, true);
37334         return ret_ref;
37335 }
37336
37337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1in_1progress(JNIEnv *env, jclass clz) {
37338         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
37339         *ret_copy = APIError_monitor_update_in_progress();
37340         int64_t ret_ref = tag_ptr(ret_copy, true);
37341         return ret_ref;
37342 }
37343
37344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
37345         LDKShutdownScript script_conv;
37346         script_conv.inner = untag_ptr(script);
37347         script_conv.is_owned = ptr_is_owned(script);
37348         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
37349         script_conv = ShutdownScript_clone(&script_conv);
37350         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
37351         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
37352         int64_t ret_ref = tag_ptr(ret_copy, true);
37353         return ret_ref;
37354 }
37355
37356 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_APIError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37357         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
37358         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
37359         jboolean ret_conv = APIError_eq(a_conv, b_conv);
37360         return ret_conv;
37361 }
37362
37363 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_APIError_1write(JNIEnv *env, jclass clz, int64_t obj) {
37364         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
37365         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
37366         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37367         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37368         CVec_u8Z_free(ret_var);
37369         return ret_arr;
37370 }
37371
37372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37373         LDKu8slice ser_ref;
37374         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37375         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37376         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
37377         *ret_conv = APIError_read(ser_ref);
37378         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37379         return tag_ptr(ret_conv, true);
37380 }
37381
37382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37383         LDKBigSize this_obj_conv;
37384         this_obj_conv.inner = untag_ptr(this_obj);
37385         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37387         BigSize_free(this_obj_conv);
37388 }
37389
37390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
37391         LDKBigSize this_ptr_conv;
37392         this_ptr_conv.inner = untag_ptr(this_ptr);
37393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37395         this_ptr_conv.is_owned = false;
37396         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
37397         return ret_conv;
37398 }
37399
37400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37401         LDKBigSize this_ptr_conv;
37402         this_ptr_conv.inner = untag_ptr(this_ptr);
37403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37405         this_ptr_conv.is_owned = false;
37406         BigSize_set_a(&this_ptr_conv, val);
37407 }
37408
37409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
37410         LDKBigSize ret_var = BigSize_new(a_arg);
37411         int64_t ret_ref = 0;
37412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37414         return ret_ref;
37415 }
37416
37417 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
37418         LDKBigSize ret_var = BigSize_clone(arg);
37419         int64_t ret_ref = 0;
37420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37422         return ret_ref;
37423 }
37424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37425         LDKBigSize arg_conv;
37426         arg_conv.inner = untag_ptr(arg);
37427         arg_conv.is_owned = ptr_is_owned(arg);
37428         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37429         arg_conv.is_owned = false;
37430         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
37431         return ret_conv;
37432 }
37433
37434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37435         LDKBigSize orig_conv;
37436         orig_conv.inner = untag_ptr(orig);
37437         orig_conv.is_owned = ptr_is_owned(orig);
37438         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37439         orig_conv.is_owned = false;
37440         LDKBigSize ret_var = BigSize_clone(&orig_conv);
37441         int64_t ret_ref = 0;
37442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37444         return ret_ref;
37445 }
37446
37447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1hash(JNIEnv *env, jclass clz, int64_t o) {
37448         LDKBigSize o_conv;
37449         o_conv.inner = untag_ptr(o);
37450         o_conv.is_owned = ptr_is_owned(o);
37451         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37452         o_conv.is_owned = false;
37453         int64_t ret_conv = BigSize_hash(&o_conv);
37454         return ret_conv;
37455 }
37456
37457 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BigSize_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37458         LDKBigSize a_conv;
37459         a_conv.inner = untag_ptr(a);
37460         a_conv.is_owned = ptr_is_owned(a);
37461         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37462         a_conv.is_owned = false;
37463         LDKBigSize b_conv;
37464         b_conv.inner = untag_ptr(b);
37465         b_conv.is_owned = ptr_is_owned(b);
37466         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37467         b_conv.is_owned = false;
37468         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
37469         return ret_conv;
37470 }
37471
37472 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigSize_1write(JNIEnv *env, jclass clz, int64_t obj) {
37473         LDKBigSize obj_conv;
37474         obj_conv.inner = untag_ptr(obj);
37475         obj_conv.is_owned = ptr_is_owned(obj);
37476         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37477         obj_conv.is_owned = false;
37478         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
37479         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37480         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37481         CVec_u8Z_free(ret_var);
37482         return ret_arr;
37483 }
37484
37485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37486         LDKu8slice ser_ref;
37487         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37488         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37489         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
37490         *ret_conv = BigSize_read(ser_ref);
37491         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37492         return tag_ptr(ret_conv, true);
37493 }
37494
37495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Hostname_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37496         LDKHostname this_obj_conv;
37497         this_obj_conv.inner = untag_ptr(this_obj);
37498         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37500         Hostname_free(this_obj_conv);
37501 }
37502
37503 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
37504         LDKHostname ret_var = Hostname_clone(arg);
37505         int64_t ret_ref = 0;
37506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37508         return ret_ref;
37509 }
37510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37511         LDKHostname arg_conv;
37512         arg_conv.inner = untag_ptr(arg);
37513         arg_conv.is_owned = ptr_is_owned(arg);
37514         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37515         arg_conv.is_owned = false;
37516         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
37517         return ret_conv;
37518 }
37519
37520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37521         LDKHostname orig_conv;
37522         orig_conv.inner = untag_ptr(orig);
37523         orig_conv.is_owned = ptr_is_owned(orig);
37524         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37525         orig_conv.is_owned = false;
37526         LDKHostname ret_var = Hostname_clone(&orig_conv);
37527         int64_t ret_ref = 0;
37528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37530         return ret_ref;
37531 }
37532
37533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1hash(JNIEnv *env, jclass clz, int64_t o) {
37534         LDKHostname o_conv;
37535         o_conv.inner = untag_ptr(o);
37536         o_conv.is_owned = ptr_is_owned(o);
37537         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37538         o_conv.is_owned = false;
37539         int64_t ret_conv = Hostname_hash(&o_conv);
37540         return ret_conv;
37541 }
37542
37543 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Hostname_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37544         LDKHostname a_conv;
37545         a_conv.inner = untag_ptr(a);
37546         a_conv.is_owned = ptr_is_owned(a);
37547         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37548         a_conv.is_owned = false;
37549         LDKHostname b_conv;
37550         b_conv.inner = untag_ptr(b);
37551         b_conv.is_owned = ptr_is_owned(b);
37552         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37553         b_conv.is_owned = false;
37554         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
37555         return ret_conv;
37556 }
37557
37558 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Hostname_1len(JNIEnv *env, jclass clz, int64_t this_arg) {
37559         LDKHostname this_arg_conv;
37560         this_arg_conv.inner = untag_ptr(this_arg);
37561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37563         this_arg_conv.is_owned = false;
37564         int8_t ret_conv = Hostname_len(&this_arg_conv);
37565         return ret_conv;
37566 }
37567
37568 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Hostname_1write(JNIEnv *env, jclass clz, int64_t obj) {
37569         LDKHostname obj_conv;
37570         obj_conv.inner = untag_ptr(obj);
37571         obj_conv.is_owned = ptr_is_owned(obj);
37572         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37573         obj_conv.is_owned = false;
37574         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
37575         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37576         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37577         CVec_u8Z_free(ret_var);
37578         return ret_arr;
37579 }
37580
37581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37582         LDKu8slice ser_ref;
37583         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37584         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37585         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
37586         *ret_conv = Hostname_read(ser_ref);
37587         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37588         return tag_ptr(ret_conv, true);
37589 }
37590
37591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37592         LDKTransactionU16LenLimited this_obj_conv;
37593         this_obj_conv.inner = untag_ptr(this_obj);
37594         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37596         TransactionU16LenLimited_free(this_obj_conv);
37597 }
37598
37599 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
37600         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
37601         int64_t ret_ref = 0;
37602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37604         return ret_ref;
37605 }
37606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37607         LDKTransactionU16LenLimited arg_conv;
37608         arg_conv.inner = untag_ptr(arg);
37609         arg_conv.is_owned = ptr_is_owned(arg);
37610         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37611         arg_conv.is_owned = false;
37612         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
37613         return ret_conv;
37614 }
37615
37616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37617         LDKTransactionU16LenLimited orig_conv;
37618         orig_conv.inner = untag_ptr(orig);
37619         orig_conv.is_owned = ptr_is_owned(orig);
37620         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37621         orig_conv.is_owned = false;
37622         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
37623         int64_t ret_ref = 0;
37624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37626         return ret_ref;
37627 }
37628
37629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1hash(JNIEnv *env, jclass clz, int64_t o) {
37630         LDKTransactionU16LenLimited o_conv;
37631         o_conv.inner = untag_ptr(o);
37632         o_conv.is_owned = ptr_is_owned(o);
37633         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37634         o_conv.is_owned = false;
37635         int64_t ret_conv = TransactionU16LenLimited_hash(&o_conv);
37636         return ret_conv;
37637 }
37638
37639 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37640         LDKTransactionU16LenLimited a_conv;
37641         a_conv.inner = untag_ptr(a);
37642         a_conv.is_owned = ptr_is_owned(a);
37643         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37644         a_conv.is_owned = false;
37645         LDKTransactionU16LenLimited b_conv;
37646         b_conv.inner = untag_ptr(b);
37647         b_conv.is_owned = ptr_is_owned(b);
37648         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37649         b_conv.is_owned = false;
37650         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
37651         return ret_conv;
37652 }
37653
37654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1new(JNIEnv *env, jclass clz, int8_tArray transaction) {
37655         LDKTransaction transaction_ref;
37656         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
37657         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
37658         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
37659         transaction_ref.data_is_owned = true;
37660         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
37661         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
37662         return tag_ptr(ret_conv, true);
37663 }
37664
37665 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1into_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
37666         LDKTransactionU16LenLimited this_arg_conv;
37667         this_arg_conv.inner = untag_ptr(this_arg);
37668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37670         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
37671         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
37672         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37673         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37674         Transaction_free(ret_var);
37675         return ret_arr;
37676 }
37677
37678 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1write(JNIEnv *env, jclass clz, int64_t obj) {
37679         LDKTransactionU16LenLimited obj_conv;
37680         obj_conv.inner = untag_ptr(obj);
37681         obj_conv.is_owned = ptr_is_owned(obj);
37682         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37683         obj_conv.is_owned = false;
37684         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
37685         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37686         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37687         CVec_u8Z_free(ret_var);
37688         return ret_arr;
37689 }
37690
37691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37692         LDKu8slice ser_ref;
37693         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37694         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37695         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
37696         *ret_conv = TransactionU16LenLimited_read(ser_ref);
37697         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37698         return tag_ptr(ret_conv, true);
37699 }
37700
37701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
37702         LDKu8slice msg_ref;
37703         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
37704         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
37705         uint8_t sk_arr[32];
37706         CHECK((*env)->GetArrayLength(env, sk) == 32);
37707         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
37708         uint8_t (*sk_ref)[32] = &sk_arr;
37709         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
37710         *ret_conv = sign(msg_ref, sk_ref);
37711         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
37712         return tag_ptr(ret_conv, true);
37713 }
37714
37715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
37716         LDKu8slice msg_ref;
37717         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
37718         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
37719         LDKStr sig_conv = java_to_owned_str(env, sig);
37720         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
37721         *ret_conv = recover_pk(msg_ref, sig_conv);
37722         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
37723         return tag_ptr(ret_conv, true);
37724 }
37725
37726 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
37727         LDKu8slice msg_ref;
37728         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
37729         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
37730         LDKStr sig_conv = java_to_owned_str(env, sig);
37731         LDKPublicKey pk_ref;
37732         CHECK((*env)->GetArrayLength(env, pk) == 33);
37733         (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
37734         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
37735         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
37736         return ret_conv;
37737 }
37738
37739 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
37740         LDKu8slice hrp_bytes_ref;
37741         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
37742         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
37743         LDKCVec_U5Z data_without_signature_constr;
37744         data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
37745         if (data_without_signature_constr.datalen > 0)
37746                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
37747         else
37748                 data_without_signature_constr.data = NULL;
37749         int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
37750         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
37751                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
37752                 
37753                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
37754         }
37755         (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
37756         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
37757         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37758         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37759         CVec_u8Z_free(ret_var);
37760         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
37761         return ret_arr;
37762 }
37763
37764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KVStore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37765         if (!ptr_is_owned(this_ptr)) return;
37766         void* this_ptr_ptr = untag_ptr(this_ptr);
37767         CHECK_ACCESS(this_ptr_ptr);
37768         LDKKVStore this_ptr_conv = *(LDKKVStore*)(this_ptr_ptr);
37769         FREE(untag_ptr(this_ptr));
37770         KVStore_free(this_ptr_conv);
37771 }
37772
37773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37774         if (!ptr_is_owned(this_ptr)) return;
37775         void* this_ptr_ptr = untag_ptr(this_ptr);
37776         CHECK_ACCESS(this_ptr_ptr);
37777         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
37778         FREE(untag_ptr(this_ptr));
37779         Persister_free(this_ptr_conv);
37780 }
37781
37782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_read_1channel_1monitors(JNIEnv *env, jclass clz, int64_t kv_store, int64_t entropy_source, int64_t signer_provider) {
37783         void* kv_store_ptr = untag_ptr(kv_store);
37784         CHECK_ACCESS(kv_store_ptr);
37785         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
37786         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
37787                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37788                 LDKKVStore_JCalls_cloned(&kv_store_conv);
37789         }
37790         void* entropy_source_ptr = untag_ptr(entropy_source);
37791         CHECK_ACCESS(entropy_source_ptr);
37792         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
37793         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
37794                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37795                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
37796         }
37797         void* signer_provider_ptr = untag_ptr(signer_provider);
37798         CHECK_ACCESS(signer_provider_ptr);
37799         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
37800         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
37801                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37802                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
37803         }
37804         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
37805         *ret_conv = read_channel_monitors(kv_store_conv, entropy_source_conv, signer_provider_conv);
37806         return tag_ptr(ret_conv, true);
37807 }
37808
37809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37810         LDKMonitorUpdatingPersister this_obj_conv;
37811         this_obj_conv.inner = untag_ptr(this_obj);
37812         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37814         MonitorUpdatingPersister_free(this_obj_conv);
37815 }
37816
37817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1new(JNIEnv *env, jclass clz, int64_t kv_store, int64_t logger, int64_t maximum_pending_updates, int64_t entropy_source, int64_t signer_provider) {
37818         void* kv_store_ptr = untag_ptr(kv_store);
37819         CHECK_ACCESS(kv_store_ptr);
37820         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
37821         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
37822                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37823                 LDKKVStore_JCalls_cloned(&kv_store_conv);
37824         }
37825         void* logger_ptr = untag_ptr(logger);
37826         CHECK_ACCESS(logger_ptr);
37827         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
37828         if (logger_conv.free == LDKLogger_JCalls_free) {
37829                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37830                 LDKLogger_JCalls_cloned(&logger_conv);
37831         }
37832         void* entropy_source_ptr = untag_ptr(entropy_source);
37833         CHECK_ACCESS(entropy_source_ptr);
37834         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
37835         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
37836                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37837                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
37838         }
37839         void* signer_provider_ptr = untag_ptr(signer_provider);
37840         CHECK_ACCESS(signer_provider_ptr);
37841         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
37842         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
37843                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37844                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
37845         }
37846         LDKMonitorUpdatingPersister ret_var = MonitorUpdatingPersister_new(kv_store_conv, logger_conv, maximum_pending_updates, entropy_source_conv, signer_provider_conv);
37847         int64_t ret_ref = 0;
37848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37850         return ret_ref;
37851 }
37852
37853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1read_1all_1channel_1monitors_1with_1updates(JNIEnv *env, jclass clz, int64_t this_arg, int64_t broadcaster, int64_t fee_estimator) {
37854         LDKMonitorUpdatingPersister this_arg_conv;
37855         this_arg_conv.inner = untag_ptr(this_arg);
37856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37858         this_arg_conv.is_owned = false;
37859         void* broadcaster_ptr = untag_ptr(broadcaster);
37860         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
37861         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
37862         void* fee_estimator_ptr = untag_ptr(fee_estimator);
37863         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
37864         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
37865         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
37866         *ret_conv = MonitorUpdatingPersister_read_all_channel_monitors_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv);
37867         return tag_ptr(ret_conv, true);
37868 }
37869
37870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1read_1channel_1monitor_1with_1updates(JNIEnv *env, jclass clz, int64_t this_arg, int64_t broadcaster, int64_t fee_estimator, jstring monitor_key) {
37871         LDKMonitorUpdatingPersister this_arg_conv;
37872         this_arg_conv.inner = untag_ptr(this_arg);
37873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37875         this_arg_conv.is_owned = false;
37876         void* broadcaster_ptr = untag_ptr(broadcaster);
37877         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
37878         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
37879         void* fee_estimator_ptr = untag_ptr(fee_estimator);
37880         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
37881         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
37882         LDKStr monitor_key_conv = java_to_owned_str(env, monitor_key);
37883         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
37884         *ret_conv = MonitorUpdatingPersister_read_channel_monitor_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv, monitor_key_conv);
37885         return tag_ptr(ret_conv, true);
37886 }
37887
37888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1cleanup_1stale_1updates(JNIEnv *env, jclass clz, int64_t this_arg, jboolean lazy) {
37889         LDKMonitorUpdatingPersister this_arg_conv;
37890         this_arg_conv.inner = untag_ptr(this_arg);
37891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37893         this_arg_conv.is_owned = false;
37894         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
37895         *ret_conv = MonitorUpdatingPersister_cleanup_stale_updates(&this_arg_conv, lazy);
37896         return tag_ptr(ret_conv, true);
37897 }
37898
37899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
37900         LDKMonitorUpdatingPersister this_arg_conv;
37901         this_arg_conv.inner = untag_ptr(this_arg);
37902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37904         this_arg_conv.is_owned = false;
37905         LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
37906         *ret_ret = MonitorUpdatingPersister_as_Persist(&this_arg_conv);
37907         return tag_ptr(ret_ret, true);
37908 }
37909
37910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UntrustedString_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37911         LDKUntrustedString this_obj_conv;
37912         this_obj_conv.inner = untag_ptr(this_obj);
37913         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37915         UntrustedString_free(this_obj_conv);
37916 }
37917
37918 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_UntrustedString_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
37919         LDKUntrustedString this_ptr_conv;
37920         this_ptr_conv.inner = untag_ptr(this_ptr);
37921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37923         this_ptr_conv.is_owned = false;
37924         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
37925         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
37926         Str_free(ret_str);
37927         return ret_conv;
37928 }
37929
37930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UntrustedString_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
37931         LDKUntrustedString this_ptr_conv;
37932         this_ptr_conv.inner = untag_ptr(this_ptr);
37933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37935         this_ptr_conv.is_owned = false;
37936         LDKStr val_conv = java_to_owned_str(env, val);
37937         UntrustedString_set_a(&this_ptr_conv, val_conv);
37938 }
37939
37940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1new(JNIEnv *env, jclass clz, jstring a_arg) {
37941         LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
37942         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
37943         int64_t ret_ref = 0;
37944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37946         return ret_ref;
37947 }
37948
37949 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
37950         LDKUntrustedString ret_var = UntrustedString_clone(arg);
37951         int64_t ret_ref = 0;
37952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37954         return ret_ref;
37955 }
37956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37957         LDKUntrustedString arg_conv;
37958         arg_conv.inner = untag_ptr(arg);
37959         arg_conv.is_owned = ptr_is_owned(arg);
37960         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37961         arg_conv.is_owned = false;
37962         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
37963         return ret_conv;
37964 }
37965
37966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37967         LDKUntrustedString orig_conv;
37968         orig_conv.inner = untag_ptr(orig);
37969         orig_conv.is_owned = ptr_is_owned(orig);
37970         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37971         orig_conv.is_owned = false;
37972         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
37973         int64_t ret_ref = 0;
37974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37976         return ret_ref;
37977 }
37978
37979 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UntrustedString_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37980         LDKUntrustedString a_conv;
37981         a_conv.inner = untag_ptr(a);
37982         a_conv.is_owned = ptr_is_owned(a);
37983         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37984         a_conv.is_owned = false;
37985         LDKUntrustedString b_conv;
37986         b_conv.inner = untag_ptr(b);
37987         b_conv.is_owned = ptr_is_owned(b);
37988         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37989         b_conv.is_owned = false;
37990         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
37991         return ret_conv;
37992 }
37993
37994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1hash(JNIEnv *env, jclass clz, int64_t o) {
37995         LDKUntrustedString o_conv;
37996         o_conv.inner = untag_ptr(o);
37997         o_conv.is_owned = ptr_is_owned(o);
37998         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37999         o_conv.is_owned = false;
38000         int64_t ret_conv = UntrustedString_hash(&o_conv);
38001         return ret_conv;
38002 }
38003
38004 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UntrustedString_1write(JNIEnv *env, jclass clz, int64_t obj) {
38005         LDKUntrustedString obj_conv;
38006         obj_conv.inner = untag_ptr(obj);
38007         obj_conv.is_owned = ptr_is_owned(obj);
38008         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38009         obj_conv.is_owned = false;
38010         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
38011         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38012         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38013         CVec_u8Z_free(ret_var);
38014         return ret_arr;
38015 }
38016
38017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38018         LDKu8slice ser_ref;
38019         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38020         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38021         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
38022         *ret_conv = UntrustedString_read(ser_ref);
38023         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38024         return tag_ptr(ret_conv, true);
38025 }
38026
38027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38028         LDKPrintableString this_obj_conv;
38029         this_obj_conv.inner = untag_ptr(this_obj);
38030         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38032         PrintableString_free(this_obj_conv);
38033 }
38034
38035 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_PrintableString_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
38036         LDKPrintableString this_ptr_conv;
38037         this_ptr_conv.inner = untag_ptr(this_ptr);
38038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38040         this_ptr_conv.is_owned = false;
38041         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
38042         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
38043         Str_free(ret_str);
38044         return ret_conv;
38045 }
38046
38047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
38048         LDKPrintableString this_ptr_conv;
38049         this_ptr_conv.inner = untag_ptr(this_ptr);
38050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38052         this_ptr_conv.is_owned = false;
38053         LDKStr val_conv = java_to_owned_str(env, val);
38054         PrintableString_set_a(&this_ptr_conv, val_conv);
38055 }
38056
38057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrintableString_1new(JNIEnv *env, jclass clz, jstring a_arg) {
38058         LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
38059         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
38060         int64_t ret_ref = 0;
38061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38063         return ret_ref;
38064 }
38065
38066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38067         if (!ptr_is_owned(this_ptr)) return;
38068         void* this_ptr_ptr = untag_ptr(this_ptr);
38069         CHECK_ACCESS(this_ptr_ptr);
38070         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
38071         FREE(untag_ptr(this_ptr));
38072         FutureCallback_free(this_ptr_conv);
38073 }
38074
38075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38076         LDKFuture this_obj_conv;
38077         this_obj_conv.inner = untag_ptr(this_obj);
38078         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38080         Future_free(this_obj_conv);
38081 }
38082
38083 static inline uint64_t Future_clone_ptr(LDKFuture *NONNULL_PTR arg) {
38084         LDKFuture ret_var = Future_clone(arg);
38085         int64_t ret_ref = 0;
38086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38088         return ret_ref;
38089 }
38090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Future_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38091         LDKFuture arg_conv;
38092         arg_conv.inner = untag_ptr(arg);
38093         arg_conv.is_owned = ptr_is_owned(arg);
38094         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38095         arg_conv.is_owned = false;
38096         int64_t ret_conv = Future_clone_ptr(&arg_conv);
38097         return ret_conv;
38098 }
38099
38100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Future_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38101         LDKFuture orig_conv;
38102         orig_conv.inner = untag_ptr(orig);
38103         orig_conv.is_owned = ptr_is_owned(orig);
38104         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38105         orig_conv.is_owned = false;
38106         LDKFuture ret_var = Future_clone(&orig_conv);
38107         int64_t ret_ref = 0;
38108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38110         return ret_ref;
38111 }
38112
38113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1register_1callback_1fn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t callback) {
38114         LDKFuture this_arg_conv;
38115         this_arg_conv.inner = untag_ptr(this_arg);
38116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38118         this_arg_conv.is_owned = false;
38119         void* callback_ptr = untag_ptr(callback);
38120         CHECK_ACCESS(callback_ptr);
38121         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
38122         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
38123                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38124                 LDKFutureCallback_JCalls_cloned(&callback_conv);
38125         }
38126         Future_register_callback_fn(&this_arg_conv, callback_conv);
38127 }
38128
38129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1wait(JNIEnv *env, jclass clz, int64_t this_arg) {
38130         LDKFuture this_arg_conv;
38131         this_arg_conv.inner = untag_ptr(this_arg);
38132         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38134         this_arg_conv = Future_clone(&this_arg_conv);
38135         Future_wait(this_arg_conv);
38136 }
38137
38138 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Future_1wait_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
38139         LDKFuture this_arg_conv;
38140         this_arg_conv.inner = untag_ptr(this_arg);
38141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38143         this_arg_conv = Future_clone(&this_arg_conv);
38144         jboolean ret_conv = Future_wait_timeout(this_arg_conv, max_wait);
38145         return ret_conv;
38146 }
38147
38148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sleeper_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38149         LDKSleeper this_obj_conv;
38150         this_obj_conv.inner = untag_ptr(this_obj);
38151         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38153         Sleeper_free(this_obj_conv);
38154 }
38155
38156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1from_1single_1future(JNIEnv *env, jclass clz, int64_t future) {
38157         LDKFuture future_conv;
38158         future_conv.inner = untag_ptr(future);
38159         future_conv.is_owned = ptr_is_owned(future);
38160         CHECK_INNER_FIELD_ACCESS_OR_NULL(future_conv);
38161         future_conv = Future_clone(&future_conv);
38162         LDKSleeper ret_var = Sleeper_from_single_future(future_conv);
38163         int64_t ret_ref = 0;
38164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38166         return ret_ref;
38167 }
38168
38169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1from_1two_1futures(JNIEnv *env, jclass clz, int64_t fut_a, int64_t fut_b) {
38170         LDKFuture fut_a_conv;
38171         fut_a_conv.inner = untag_ptr(fut_a);
38172         fut_a_conv.is_owned = ptr_is_owned(fut_a);
38173         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_a_conv);
38174         fut_a_conv = Future_clone(&fut_a_conv);
38175         LDKFuture fut_b_conv;
38176         fut_b_conv.inner = untag_ptr(fut_b);
38177         fut_b_conv.is_owned = ptr_is_owned(fut_b);
38178         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_b_conv);
38179         fut_b_conv = Future_clone(&fut_b_conv);
38180         LDKSleeper ret_var = Sleeper_from_two_futures(fut_a_conv, fut_b_conv);
38181         int64_t ret_ref = 0;
38182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38184         return ret_ref;
38185 }
38186
38187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1new(JNIEnv *env, jclass clz, int64_tArray futures) {
38188         LDKCVec_FutureZ futures_constr;
38189         futures_constr.datalen = (*env)->GetArrayLength(env, futures);
38190         if (futures_constr.datalen > 0)
38191                 futures_constr.data = MALLOC(futures_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
38192         else
38193                 futures_constr.data = NULL;
38194         int64_t* futures_vals = (*env)->GetLongArrayElements (env, futures, NULL);
38195         for (size_t i = 0; i < futures_constr.datalen; i++) {
38196                 int64_t futures_conv_8 = futures_vals[i];
38197                 LDKFuture futures_conv_8_conv;
38198                 futures_conv_8_conv.inner = untag_ptr(futures_conv_8);
38199                 futures_conv_8_conv.is_owned = ptr_is_owned(futures_conv_8);
38200                 CHECK_INNER_FIELD_ACCESS_OR_NULL(futures_conv_8_conv);
38201                 futures_conv_8_conv = Future_clone(&futures_conv_8_conv);
38202                 futures_constr.data[i] = futures_conv_8_conv;
38203         }
38204         (*env)->ReleaseLongArrayElements(env, futures, futures_vals, 0);
38205         LDKSleeper ret_var = Sleeper_new(futures_constr);
38206         int64_t ret_ref = 0;
38207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38209         return ret_ref;
38210 }
38211
38212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sleeper_1wait(JNIEnv *env, jclass clz, int64_t this_arg) {
38213         LDKSleeper this_arg_conv;
38214         this_arg_conv.inner = untag_ptr(this_arg);
38215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38217         this_arg_conv.is_owned = false;
38218         Sleeper_wait(&this_arg_conv);
38219 }
38220
38221 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sleeper_1wait_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
38222         LDKSleeper this_arg_conv;
38223         this_arg_conv.inner = untag_ptr(this_arg);
38224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38226         this_arg_conv.is_owned = false;
38227         jboolean ret_conv = Sleeper_wait_timeout(&this_arg_conv, max_wait);
38228         return ret_conv;
38229 }
38230
38231 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38232         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
38233         jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
38234         return ret_conv;
38235 }
38236
38237 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
38238         jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
38239         return ret_conv;
38240 }
38241
38242 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
38243         jclass ret_conv = LDKLevel_to_java(env, Level_trace());
38244         return ret_conv;
38245 }
38246
38247 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
38248         jclass ret_conv = LDKLevel_to_java(env, Level_debug());
38249         return ret_conv;
38250 }
38251
38252 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
38253         jclass ret_conv = LDKLevel_to_java(env, Level_info());
38254         return ret_conv;
38255 }
38256
38257 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
38258         jclass ret_conv = LDKLevel_to_java(env, Level_warn());
38259         return ret_conv;
38260 }
38261
38262 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
38263         jclass ret_conv = LDKLevel_to_java(env, Level_error());
38264         return ret_conv;
38265 }
38266
38267 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38268         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
38269         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
38270         jboolean ret_conv = Level_eq(a_conv, b_conv);
38271         return ret_conv;
38272 }
38273
38274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
38275         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
38276         int64_t ret_conv = Level_hash(o_conv);
38277         return ret_conv;
38278 }
38279
38280 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
38281         jclass ret_conv = LDKLevel_to_java(env, Level_max());
38282         return ret_conv;
38283 }
38284
38285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38286         LDKRecord this_obj_conv;
38287         this_obj_conv.inner = untag_ptr(this_obj);
38288         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38290         Record_free(this_obj_conv);
38291 }
38292
38293 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
38294         LDKRecord this_ptr_conv;
38295         this_ptr_conv.inner = untag_ptr(this_ptr);
38296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38298         this_ptr_conv.is_owned = false;
38299         jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
38300         return ret_conv;
38301 }
38302
38303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
38304         LDKRecord this_ptr_conv;
38305         this_ptr_conv.inner = untag_ptr(this_ptr);
38306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38308         this_ptr_conv.is_owned = false;
38309         LDKLevel val_conv = LDKLevel_from_java(env, val);
38310         Record_set_level(&this_ptr_conv, val_conv);
38311 }
38312
38313 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Record_1get_1peer_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
38314         LDKRecord this_ptr_conv;
38315         this_ptr_conv.inner = untag_ptr(this_ptr);
38316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38318         this_ptr_conv.is_owned = false;
38319         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38320         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Record_get_peer_id(&this_ptr_conv).compressed_form);
38321         return ret_arr;
38322 }
38323
38324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1peer_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38325         LDKRecord this_ptr_conv;
38326         this_ptr_conv.inner = untag_ptr(this_ptr);
38327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38329         this_ptr_conv.is_owned = false;
38330         LDKPublicKey val_ref;
38331         CHECK((*env)->GetArrayLength(env, val) == 33);
38332         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38333         Record_set_peer_id(&this_ptr_conv, val_ref);
38334 }
38335
38336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
38337         LDKRecord this_ptr_conv;
38338         this_ptr_conv.inner = untag_ptr(this_ptr);
38339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38341         this_ptr_conv.is_owned = false;
38342         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
38343         *ret_copy = Record_get_channel_id(&this_ptr_conv);
38344         int64_t ret_ref = tag_ptr(ret_copy, true);
38345         return ret_ref;
38346 }
38347
38348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38349         LDKRecord this_ptr_conv;
38350         this_ptr_conv.inner = untag_ptr(this_ptr);
38351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38353         this_ptr_conv.is_owned = false;
38354         void* val_ptr = untag_ptr(val);
38355         CHECK_ACCESS(val_ptr);
38356         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
38357         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
38358         Record_set_channel_id(&this_ptr_conv, val_conv);
38359 }
38360
38361 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
38362         LDKRecord this_ptr_conv;
38363         this_ptr_conv.inner = untag_ptr(this_ptr);
38364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38366         this_ptr_conv.is_owned = false;
38367         LDKStr ret_str = Record_get_args(&this_ptr_conv);
38368         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
38369         Str_free(ret_str);
38370         return ret_conv;
38371 }
38372
38373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
38374         LDKRecord this_ptr_conv;
38375         this_ptr_conv.inner = untag_ptr(this_ptr);
38376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38378         this_ptr_conv.is_owned = false;
38379         LDKStr val_conv = java_to_owned_str(env, val);
38380         Record_set_args(&this_ptr_conv, val_conv);
38381 }
38382
38383 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
38384         LDKRecord this_ptr_conv;
38385         this_ptr_conv.inner = untag_ptr(this_ptr);
38386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38388         this_ptr_conv.is_owned = false;
38389         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
38390         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
38391         Str_free(ret_str);
38392         return ret_conv;
38393 }
38394
38395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
38396         LDKRecord this_ptr_conv;
38397         this_ptr_conv.inner = untag_ptr(this_ptr);
38398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38400         this_ptr_conv.is_owned = false;
38401         LDKStr val_conv = java_to_owned_str(env, val);
38402         Record_set_module_path(&this_ptr_conv, val_conv);
38403 }
38404
38405 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
38406         LDKRecord this_ptr_conv;
38407         this_ptr_conv.inner = untag_ptr(this_ptr);
38408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38410         this_ptr_conv.is_owned = false;
38411         LDKStr ret_str = Record_get_file(&this_ptr_conv);
38412         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
38413         Str_free(ret_str);
38414         return ret_conv;
38415 }
38416
38417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
38418         LDKRecord this_ptr_conv;
38419         this_ptr_conv.inner = untag_ptr(this_ptr);
38420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38422         this_ptr_conv.is_owned = false;
38423         LDKStr val_conv = java_to_owned_str(env, val);
38424         Record_set_file(&this_ptr_conv, val_conv);
38425 }
38426
38427 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
38428         LDKRecord this_ptr_conv;
38429         this_ptr_conv.inner = untag_ptr(this_ptr);
38430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38432         this_ptr_conv.is_owned = false;
38433         int32_t ret_conv = Record_get_line(&this_ptr_conv);
38434         return ret_conv;
38435 }
38436
38437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
38438         LDKRecord this_ptr_conv;
38439         this_ptr_conv.inner = untag_ptr(this_ptr);
38440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38442         this_ptr_conv.is_owned = false;
38443         Record_set_line(&this_ptr_conv, val);
38444 }
38445
38446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1new(JNIEnv *env, jclass clz, jclass level_arg, int8_tArray peer_id_arg, int64_t channel_id_arg, jstring args_arg, jstring module_path_arg, jstring file_arg, int32_t line_arg) {
38447         LDKLevel level_arg_conv = LDKLevel_from_java(env, level_arg);
38448         LDKPublicKey peer_id_arg_ref;
38449         CHECK((*env)->GetArrayLength(env, peer_id_arg) == 33);
38450         (*env)->GetByteArrayRegion(env, peer_id_arg, 0, 33, peer_id_arg_ref.compressed_form);
38451         void* channel_id_arg_ptr = untag_ptr(channel_id_arg);
38452         CHECK_ACCESS(channel_id_arg_ptr);
38453         LDKCOption_ThirtyTwoBytesZ channel_id_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(channel_id_arg_ptr);
38454         channel_id_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(channel_id_arg));
38455         LDKStr args_arg_conv = java_to_owned_str(env, args_arg);
38456         LDKStr module_path_arg_conv = java_to_owned_str(env, module_path_arg);
38457         LDKStr file_arg_conv = java_to_owned_str(env, file_arg);
38458         LDKRecord ret_var = Record_new(level_arg_conv, peer_id_arg_ref, channel_id_arg_conv, args_arg_conv, module_path_arg_conv, file_arg_conv, line_arg);
38459         int64_t ret_ref = 0;
38460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38462         return ret_ref;
38463 }
38464
38465 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
38466         LDKRecord ret_var = Record_clone(arg);
38467         int64_t ret_ref = 0;
38468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38470         return ret_ref;
38471 }
38472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38473         LDKRecord arg_conv;
38474         arg_conv.inner = untag_ptr(arg);
38475         arg_conv.is_owned = ptr_is_owned(arg);
38476         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38477         arg_conv.is_owned = false;
38478         int64_t ret_conv = Record_clone_ptr(&arg_conv);
38479         return ret_conv;
38480 }
38481
38482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38483         LDKRecord orig_conv;
38484         orig_conv.inner = untag_ptr(orig);
38485         orig_conv.is_owned = ptr_is_owned(orig);
38486         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38487         orig_conv.is_owned = false;
38488         LDKRecord ret_var = Record_clone(&orig_conv);
38489         int64_t ret_ref = 0;
38490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38492         return ret_ref;
38493 }
38494
38495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38496         if (!ptr_is_owned(this_ptr)) return;
38497         void* this_ptr_ptr = untag_ptr(this_ptr);
38498         CHECK_ACCESS(this_ptr_ptr);
38499         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
38500         FREE(untag_ptr(this_ptr));
38501         Logger_free(this_ptr_conv);
38502 }
38503
38504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38505         LDKChannelHandshakeConfig this_obj_conv;
38506         this_obj_conv.inner = untag_ptr(this_obj);
38507         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38509         ChannelHandshakeConfig_free(this_obj_conv);
38510 }
38511
38512 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
38513         LDKChannelHandshakeConfig this_ptr_conv;
38514         this_ptr_conv.inner = untag_ptr(this_ptr);
38515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38517         this_ptr_conv.is_owned = false;
38518         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
38519         return ret_conv;
38520 }
38521
38522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
38523         LDKChannelHandshakeConfig this_ptr_conv;
38524         this_ptr_conv.inner = untag_ptr(this_ptr);
38525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38527         this_ptr_conv.is_owned = false;
38528         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
38529 }
38530
38531 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
38532         LDKChannelHandshakeConfig this_ptr_conv;
38533         this_ptr_conv.inner = untag_ptr(this_ptr);
38534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38536         this_ptr_conv.is_owned = false;
38537         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
38538         return ret_conv;
38539 }
38540
38541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
38542         LDKChannelHandshakeConfig this_ptr_conv;
38543         this_ptr_conv.inner = untag_ptr(this_ptr);
38544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38546         this_ptr_conv.is_owned = false;
38547         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
38548 }
38549
38550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
38551         LDKChannelHandshakeConfig this_ptr_conv;
38552         this_ptr_conv.inner = untag_ptr(this_ptr);
38553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38555         this_ptr_conv.is_owned = false;
38556         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
38557         return ret_conv;
38558 }
38559
38560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38561         LDKChannelHandshakeConfig this_ptr_conv;
38562         this_ptr_conv.inner = untag_ptr(this_ptr);
38563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38565         this_ptr_conv.is_owned = false;
38566         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
38567 }
38568
38569 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1max_1inbound_1htlc_1value_1in_1flight_1percent_1of_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
38570         LDKChannelHandshakeConfig this_ptr_conv;
38571         this_ptr_conv.inner = untag_ptr(this_ptr);
38572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38574         this_ptr_conv.is_owned = false;
38575         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
38576         return ret_conv;
38577 }
38578
38579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1max_1inbound_1htlc_1value_1in_1flight_1percent_1of_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
38580         LDKChannelHandshakeConfig this_ptr_conv;
38581         this_ptr_conv.inner = untag_ptr(this_ptr);
38582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38584         this_ptr_conv.is_owned = false;
38585         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
38586 }
38587
38588 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) {
38589         LDKChannelHandshakeConfig this_ptr_conv;
38590         this_ptr_conv.inner = untag_ptr(this_ptr);
38591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38593         this_ptr_conv.is_owned = false;
38594         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
38595         return ret_conv;
38596 }
38597
38598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
38599         LDKChannelHandshakeConfig this_ptr_conv;
38600         this_ptr_conv.inner = untag_ptr(this_ptr);
38601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38603         this_ptr_conv.is_owned = false;
38604         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
38605 }
38606
38607 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
38608         LDKChannelHandshakeConfig this_ptr_conv;
38609         this_ptr_conv.inner = untag_ptr(this_ptr);
38610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38612         this_ptr_conv.is_owned = false;
38613         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
38614         return ret_conv;
38615 }
38616
38617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
38618         LDKChannelHandshakeConfig this_ptr_conv;
38619         this_ptr_conv.inner = untag_ptr(this_ptr);
38620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38622         this_ptr_conv.is_owned = false;
38623         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
38624 }
38625
38626 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
38627         LDKChannelHandshakeConfig this_ptr_conv;
38628         this_ptr_conv.inner = untag_ptr(this_ptr);
38629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38631         this_ptr_conv.is_owned = false;
38632         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
38633         return ret_conv;
38634 }
38635
38636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
38637         LDKChannelHandshakeConfig this_ptr_conv;
38638         this_ptr_conv.inner = untag_ptr(this_ptr);
38639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38641         this_ptr_conv.is_owned = false;
38642         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
38643 }
38644
38645 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1their_1channel_1reserve_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
38646         LDKChannelHandshakeConfig this_ptr_conv;
38647         this_ptr_conv.inner = untag_ptr(this_ptr);
38648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38650         this_ptr_conv.is_owned = false;
38651         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
38652         return ret_conv;
38653 }
38654
38655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1their_1channel_1reserve_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
38656         LDKChannelHandshakeConfig this_ptr_conv;
38657         this_ptr_conv.inner = untag_ptr(this_ptr);
38658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38660         this_ptr_conv.is_owned = false;
38661         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
38662 }
38663
38664 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_ptr) {
38665         LDKChannelHandshakeConfig this_ptr_conv;
38666         this_ptr_conv.inner = untag_ptr(this_ptr);
38667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38669         this_ptr_conv.is_owned = false;
38670         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
38671         return ret_conv;
38672 }
38673
38674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
38675         LDKChannelHandshakeConfig this_ptr_conv;
38676         this_ptr_conv.inner = untag_ptr(this_ptr);
38677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38679         this_ptr_conv.is_owned = false;
38680         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
38681 }
38682
38683 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
38684         LDKChannelHandshakeConfig this_ptr_conv;
38685         this_ptr_conv.inner = untag_ptr(this_ptr);
38686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38688         this_ptr_conv.is_owned = false;
38689         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
38690         return ret_conv;
38691 }
38692
38693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
38694         LDKChannelHandshakeConfig this_ptr_conv;
38695         this_ptr_conv.inner = untag_ptr(this_ptr);
38696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38698         this_ptr_conv.is_owned = false;
38699         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
38700 }
38701
38702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1new(JNIEnv *env, jclass clz, int32_t minimum_depth_arg, int16_t our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg, int8_t max_inbound_htlc_value_in_flight_percent_of_channel_arg, jboolean negotiate_scid_privacy_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg, int32_t their_channel_reserve_proportional_millionths_arg, jboolean negotiate_anchors_zero_fee_htlc_tx_arg, int16_t our_max_accepted_htlcs_arg) {
38703         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg, max_inbound_htlc_value_in_flight_percent_of_channel_arg, negotiate_scid_privacy_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, their_channel_reserve_proportional_millionths_arg, negotiate_anchors_zero_fee_htlc_tx_arg, our_max_accepted_htlcs_arg);
38704         int64_t ret_ref = 0;
38705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38707         return ret_ref;
38708 }
38709
38710 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
38711         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
38712         int64_t ret_ref = 0;
38713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38715         return ret_ref;
38716 }
38717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38718         LDKChannelHandshakeConfig arg_conv;
38719         arg_conv.inner = untag_ptr(arg);
38720         arg_conv.is_owned = ptr_is_owned(arg);
38721         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38722         arg_conv.is_owned = false;
38723         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
38724         return ret_conv;
38725 }
38726
38727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38728         LDKChannelHandshakeConfig orig_conv;
38729         orig_conv.inner = untag_ptr(orig);
38730         orig_conv.is_owned = ptr_is_owned(orig);
38731         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38732         orig_conv.is_owned = false;
38733         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
38734         int64_t ret_ref = 0;
38735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38737         return ret_ref;
38738 }
38739
38740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
38741         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
38742         int64_t ret_ref = 0;
38743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38745         return ret_ref;
38746 }
38747
38748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38749         LDKChannelHandshakeLimits this_obj_conv;
38750         this_obj_conv.inner = untag_ptr(this_obj);
38751         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38753         ChannelHandshakeLimits_free(this_obj_conv);
38754 }
38755
38756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
38757         LDKChannelHandshakeLimits this_ptr_conv;
38758         this_ptr_conv.inner = untag_ptr(this_ptr);
38759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38761         this_ptr_conv.is_owned = false;
38762         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
38763         return ret_conv;
38764 }
38765
38766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38767         LDKChannelHandshakeLimits this_ptr_conv;
38768         this_ptr_conv.inner = untag_ptr(this_ptr);
38769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38771         this_ptr_conv.is_owned = false;
38772         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
38773 }
38774
38775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
38776         LDKChannelHandshakeLimits this_ptr_conv;
38777         this_ptr_conv.inner = untag_ptr(this_ptr);
38778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38780         this_ptr_conv.is_owned = false;
38781         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
38782         return ret_conv;
38783 }
38784
38785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38786         LDKChannelHandshakeLimits this_ptr_conv;
38787         this_ptr_conv.inner = untag_ptr(this_ptr);
38788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38790         this_ptr_conv.is_owned = false;
38791         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
38792 }
38793
38794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
38795         LDKChannelHandshakeLimits this_ptr_conv;
38796         this_ptr_conv.inner = untag_ptr(this_ptr);
38797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38799         this_ptr_conv.is_owned = false;
38800         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
38801         return ret_conv;
38802 }
38803
38804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38805         LDKChannelHandshakeLimits this_ptr_conv;
38806         this_ptr_conv.inner = untag_ptr(this_ptr);
38807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38809         this_ptr_conv.is_owned = false;
38810         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
38811 }
38812
38813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
38814         LDKChannelHandshakeLimits this_ptr_conv;
38815         this_ptr_conv.inner = untag_ptr(this_ptr);
38816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38818         this_ptr_conv.is_owned = false;
38819         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
38820         return ret_conv;
38821 }
38822
38823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38824         LDKChannelHandshakeLimits this_ptr_conv;
38825         this_ptr_conv.inner = untag_ptr(this_ptr);
38826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38828         this_ptr_conv.is_owned = false;
38829         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
38830 }
38831
38832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
38833         LDKChannelHandshakeLimits this_ptr_conv;
38834         this_ptr_conv.inner = untag_ptr(this_ptr);
38835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38837         this_ptr_conv.is_owned = false;
38838         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
38839         return ret_conv;
38840 }
38841
38842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38843         LDKChannelHandshakeLimits this_ptr_conv;
38844         this_ptr_conv.inner = untag_ptr(this_ptr);
38845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38847         this_ptr_conv.is_owned = false;
38848         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
38849 }
38850
38851 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
38852         LDKChannelHandshakeLimits this_ptr_conv;
38853         this_ptr_conv.inner = untag_ptr(this_ptr);
38854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38856         this_ptr_conv.is_owned = false;
38857         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
38858         return ret_conv;
38859 }
38860
38861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
38862         LDKChannelHandshakeLimits this_ptr_conv;
38863         this_ptr_conv.inner = untag_ptr(this_ptr);
38864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38866         this_ptr_conv.is_owned = false;
38867         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
38868 }
38869
38870 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
38871         LDKChannelHandshakeLimits this_ptr_conv;
38872         this_ptr_conv.inner = untag_ptr(this_ptr);
38873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38875         this_ptr_conv.is_owned = false;
38876         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
38877         return ret_conv;
38878 }
38879
38880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
38881         LDKChannelHandshakeLimits this_ptr_conv;
38882         this_ptr_conv.inner = untag_ptr(this_ptr);
38883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38885         this_ptr_conv.is_owned = false;
38886         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
38887 }
38888
38889 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr) {
38890         LDKChannelHandshakeLimits this_ptr_conv;
38891         this_ptr_conv.inner = untag_ptr(this_ptr);
38892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38894         this_ptr_conv.is_owned = false;
38895         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
38896         return ret_conv;
38897 }
38898
38899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
38900         LDKChannelHandshakeLimits this_ptr_conv;
38901         this_ptr_conv.inner = untag_ptr(this_ptr);
38902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38904         this_ptr_conv.is_owned = false;
38905         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
38906 }
38907
38908 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
38909         LDKChannelHandshakeLimits this_ptr_conv;
38910         this_ptr_conv.inner = untag_ptr(this_ptr);
38911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38913         this_ptr_conv.is_owned = false;
38914         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
38915         return ret_conv;
38916 }
38917
38918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
38919         LDKChannelHandshakeLimits this_ptr_conv;
38920         this_ptr_conv.inner = untag_ptr(this_ptr);
38921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38923         this_ptr_conv.is_owned = false;
38924         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
38925 }
38926
38927 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
38928         LDKChannelHandshakeLimits this_ptr_conv;
38929         this_ptr_conv.inner = untag_ptr(this_ptr);
38930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38932         this_ptr_conv.is_owned = false;
38933         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
38934         return ret_conv;
38935 }
38936
38937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
38938         LDKChannelHandshakeLimits this_ptr_conv;
38939         this_ptr_conv.inner = untag_ptr(this_ptr);
38940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38942         this_ptr_conv.is_owned = false;
38943         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
38944 }
38945
38946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1new(JNIEnv *env, jclass clz, int64_t min_funding_satoshis_arg, int64_t max_funding_satoshis_arg, int64_t max_htlc_minimum_msat_arg, int64_t min_max_htlc_value_in_flight_msat_arg, int64_t max_channel_reserve_satoshis_arg, int16_t min_max_accepted_htlcs_arg, int32_t max_minimum_depth_arg, jboolean trust_own_funding_0conf_arg, jboolean force_announced_channel_preference_arg, int16_t their_to_self_delay_arg) {
38947         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_new(min_funding_satoshis_arg, max_funding_satoshis_arg, max_htlc_minimum_msat_arg, min_max_htlc_value_in_flight_msat_arg, max_channel_reserve_satoshis_arg, min_max_accepted_htlcs_arg, max_minimum_depth_arg, trust_own_funding_0conf_arg, force_announced_channel_preference_arg, their_to_self_delay_arg);
38948         int64_t ret_ref = 0;
38949         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38950         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38951         return ret_ref;
38952 }
38953
38954 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
38955         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
38956         int64_t ret_ref = 0;
38957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38959         return ret_ref;
38960 }
38961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38962         LDKChannelHandshakeLimits arg_conv;
38963         arg_conv.inner = untag_ptr(arg);
38964         arg_conv.is_owned = ptr_is_owned(arg);
38965         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38966         arg_conv.is_owned = false;
38967         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
38968         return ret_conv;
38969 }
38970
38971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38972         LDKChannelHandshakeLimits orig_conv;
38973         orig_conv.inner = untag_ptr(orig);
38974         orig_conv.is_owned = ptr_is_owned(orig);
38975         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38976         orig_conv.is_owned = false;
38977         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
38978         int64_t ret_ref = 0;
38979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38981         return ret_ref;
38982 }
38983
38984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
38985         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
38986         int64_t ret_ref = 0;
38987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38989         return ret_ref;
38990 }
38991
38992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38993         if (!ptr_is_owned(this_ptr)) return;
38994         void* this_ptr_ptr = untag_ptr(this_ptr);
38995         CHECK_ACCESS(this_ptr_ptr);
38996         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
38997         FREE(untag_ptr(this_ptr));
38998         MaxDustHTLCExposure_free(this_ptr_conv);
38999 }
39000
39001 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
39002         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
39003         *ret_copy = MaxDustHTLCExposure_clone(arg);
39004         int64_t ret_ref = tag_ptr(ret_copy, true);
39005         return ret_ref;
39006 }
39007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39008         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
39009         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
39010         return ret_conv;
39011 }
39012
39013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39014         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
39015         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
39016         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
39017         int64_t ret_ref = tag_ptr(ret_copy, true);
39018         return ret_ref;
39019 }
39020
39021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1fixed_1limit_1msat(JNIEnv *env, jclass clz, int64_t a) {
39022         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
39023         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
39024         int64_t ret_ref = tag_ptr(ret_copy, true);
39025         return ret_ref;
39026 }
39027
39028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1fee_1rate_1multiplier(JNIEnv *env, jclass clz, int64_t a) {
39029         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
39030         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
39031         int64_t ret_ref = tag_ptr(ret_copy, true);
39032         return ret_ref;
39033 }
39034
39035 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39036         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
39037         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
39038         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
39039         return ret_conv;
39040 }
39041
39042 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1write(JNIEnv *env, jclass clz, int64_t obj) {
39043         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
39044         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
39045         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39046         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39047         CVec_u8Z_free(ret_var);
39048         return ret_arr;
39049 }
39050
39051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39052         LDKu8slice ser_ref;
39053         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39054         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39055         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
39056         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
39057         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39058         return tag_ptr(ret_conv, true);
39059 }
39060
39061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39062         LDKChannelConfig this_obj_conv;
39063         this_obj_conv.inner = untag_ptr(this_obj);
39064         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39066         ChannelConfig_free(this_obj_conv);
39067 }
39068
39069 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
39070         LDKChannelConfig this_ptr_conv;
39071         this_ptr_conv.inner = untag_ptr(this_ptr);
39072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39074         this_ptr_conv.is_owned = false;
39075         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
39076         return ret_conv;
39077 }
39078
39079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
39080         LDKChannelConfig this_ptr_conv;
39081         this_ptr_conv.inner = untag_ptr(this_ptr);
39082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39084         this_ptr_conv.is_owned = false;
39085         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
39086 }
39087
39088 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39089         LDKChannelConfig this_ptr_conv;
39090         this_ptr_conv.inner = untag_ptr(this_ptr);
39091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39093         this_ptr_conv.is_owned = false;
39094         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
39095         return ret_conv;
39096 }
39097
39098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
39099         LDKChannelConfig this_ptr_conv;
39100         this_ptr_conv.inner = untag_ptr(this_ptr);
39101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39103         this_ptr_conv.is_owned = false;
39104         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
39105 }
39106
39107 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
39108         LDKChannelConfig this_ptr_conv;
39109         this_ptr_conv.inner = untag_ptr(this_ptr);
39110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39112         this_ptr_conv.is_owned = false;
39113         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
39114         return ret_conv;
39115 }
39116
39117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
39118         LDKChannelConfig this_ptr_conv;
39119         this_ptr_conv.inner = untag_ptr(this_ptr);
39120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39122         this_ptr_conv.is_owned = false;
39123         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
39124 }
39125
39126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure(JNIEnv *env, jclass clz, int64_t this_ptr) {
39127         LDKChannelConfig this_ptr_conv;
39128         this_ptr_conv.inner = untag_ptr(this_ptr);
39129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39131         this_ptr_conv.is_owned = false;
39132         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
39133         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
39134         int64_t ret_ref = tag_ptr(ret_copy, true);
39135         return ret_ref;
39136 }
39137
39138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1max_1dust_1htlc_1exposure(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39139         LDKChannelConfig this_ptr_conv;
39140         this_ptr_conv.inner = untag_ptr(this_ptr);
39141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39143         this_ptr_conv.is_owned = false;
39144         void* val_ptr = untag_ptr(val);
39145         CHECK_ACCESS(val_ptr);
39146         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
39147         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
39148         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
39149 }
39150
39151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
39152         LDKChannelConfig this_ptr_conv;
39153         this_ptr_conv.inner = untag_ptr(this_ptr);
39154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39156         this_ptr_conv.is_owned = false;
39157         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
39158         return ret_conv;
39159 }
39160
39161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39162         LDKChannelConfig this_ptr_conv;
39163         this_ptr_conv.inner = untag_ptr(this_ptr);
39164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39166         this_ptr_conv.is_owned = false;
39167         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
39168 }
39169
39170 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1accept_1underpaying_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
39171         LDKChannelConfig this_ptr_conv;
39172         this_ptr_conv.inner = untag_ptr(this_ptr);
39173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39175         this_ptr_conv.is_owned = false;
39176         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
39177         return ret_conv;
39178 }
39179
39180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1accept_1underpaying_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39181         LDKChannelConfig this_ptr_conv;
39182         this_ptr_conv.inner = untag_ptr(this_ptr);
39183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39185         this_ptr_conv.is_owned = false;
39186         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
39187 }
39188
39189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, int64_t max_dust_htlc_exposure_arg, int64_t force_close_avoidance_max_fee_satoshis_arg, jboolean accept_underpaying_htlcs_arg) {
39190         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
39191         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
39192         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
39193         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
39194         LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, max_dust_htlc_exposure_arg_conv, force_close_avoidance_max_fee_satoshis_arg, accept_underpaying_htlcs_arg);
39195         int64_t ret_ref = 0;
39196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39198         return ret_ref;
39199 }
39200
39201 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
39202         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
39203         int64_t ret_ref = 0;
39204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39206         return ret_ref;
39207 }
39208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39209         LDKChannelConfig arg_conv;
39210         arg_conv.inner = untag_ptr(arg);
39211         arg_conv.is_owned = ptr_is_owned(arg);
39212         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39213         arg_conv.is_owned = false;
39214         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
39215         return ret_conv;
39216 }
39217
39218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39219         LDKChannelConfig orig_conv;
39220         orig_conv.inner = untag_ptr(orig);
39221         orig_conv.is_owned = ptr_is_owned(orig);
39222         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39223         orig_conv.is_owned = false;
39224         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
39225         int64_t ret_ref = 0;
39226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39228         return ret_ref;
39229 }
39230
39231 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39232         LDKChannelConfig a_conv;
39233         a_conv.inner = untag_ptr(a);
39234         a_conv.is_owned = ptr_is_owned(a);
39235         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39236         a_conv.is_owned = false;
39237         LDKChannelConfig b_conv;
39238         b_conv.inner = untag_ptr(b);
39239         b_conv.is_owned = ptr_is_owned(b);
39240         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39241         b_conv.is_owned = false;
39242         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
39243         return ret_conv;
39244 }
39245
39246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1apply(JNIEnv *env, jclass clz, int64_t this_arg, int64_t update) {
39247         LDKChannelConfig this_arg_conv;
39248         this_arg_conv.inner = untag_ptr(this_arg);
39249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39251         this_arg_conv.is_owned = false;
39252         LDKChannelConfigUpdate update_conv;
39253         update_conv.inner = untag_ptr(update);
39254         update_conv.is_owned = ptr_is_owned(update);
39255         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
39256         update_conv.is_owned = false;
39257         ChannelConfig_apply(&this_arg_conv, &update_conv);
39258 }
39259
39260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
39261         LDKChannelConfig ret_var = ChannelConfig_default();
39262         int64_t ret_ref = 0;
39263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39265         return ret_ref;
39266 }
39267
39268 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
39269         LDKChannelConfig obj_conv;
39270         obj_conv.inner = untag_ptr(obj);
39271         obj_conv.is_owned = ptr_is_owned(obj);
39272         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39273         obj_conv.is_owned = false;
39274         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
39275         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39276         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39277         CVec_u8Z_free(ret_var);
39278         return ret_arr;
39279 }
39280
39281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39282         LDKu8slice ser_ref;
39283         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39284         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39285         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
39286         *ret_conv = ChannelConfig_read(ser_ref);
39287         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39288         return tag_ptr(ret_conv, true);
39289 }
39290
39291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39292         LDKChannelConfigUpdate this_obj_conv;
39293         this_obj_conv.inner = untag_ptr(this_obj);
39294         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39296         ChannelConfigUpdate_free(this_obj_conv);
39297 }
39298
39299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
39300         LDKChannelConfigUpdate this_ptr_conv;
39301         this_ptr_conv.inner = untag_ptr(this_ptr);
39302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39304         this_ptr_conv.is_owned = false;
39305         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39306         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
39307         int64_t ret_ref = tag_ptr(ret_copy, true);
39308         return ret_ref;
39309 }
39310
39311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1set_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39312         LDKChannelConfigUpdate this_ptr_conv;
39313         this_ptr_conv.inner = untag_ptr(this_ptr);
39314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39316         this_ptr_conv.is_owned = false;
39317         void* val_ptr = untag_ptr(val);
39318         CHECK_ACCESS(val_ptr);
39319         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
39320         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
39321         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
39322 }
39323
39324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39325         LDKChannelConfigUpdate this_ptr_conv;
39326         this_ptr_conv.inner = untag_ptr(this_ptr);
39327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39329         this_ptr_conv.is_owned = false;
39330         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39331         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
39332         int64_t ret_ref = tag_ptr(ret_copy, true);
39333         return ret_ref;
39334 }
39335
39336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1set_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39337         LDKChannelConfigUpdate this_ptr_conv;
39338         this_ptr_conv.inner = untag_ptr(this_ptr);
39339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39341         this_ptr_conv.is_owned = false;
39342         void* val_ptr = untag_ptr(val);
39343         CHECK_ACCESS(val_ptr);
39344         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
39345         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
39346         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
39347 }
39348
39349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
39350         LDKChannelConfigUpdate this_ptr_conv;
39351         this_ptr_conv.inner = untag_ptr(this_ptr);
39352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39354         this_ptr_conv.is_owned = false;
39355         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
39356         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
39357         int64_t ret_ref = tag_ptr(ret_copy, true);
39358         return ret_ref;
39359 }
39360
39361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39362         LDKChannelConfigUpdate this_ptr_conv;
39363         this_ptr_conv.inner = untag_ptr(this_ptr);
39364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39366         this_ptr_conv.is_owned = false;
39367         void* val_ptr = untag_ptr(val);
39368         CHECK_ACCESS(val_ptr);
39369         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
39370         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
39371         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
39372 }
39373
39374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39375         LDKChannelConfigUpdate this_ptr_conv;
39376         this_ptr_conv.inner = untag_ptr(this_ptr);
39377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39379         this_ptr_conv.is_owned = false;
39380         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
39381         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
39382         int64_t ret_ref = tag_ptr(ret_copy, true);
39383         return ret_ref;
39384 }
39385
39386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1set_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39387         LDKChannelConfigUpdate this_ptr_conv;
39388         this_ptr_conv.inner = untag_ptr(this_ptr);
39389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39391         this_ptr_conv.is_owned = false;
39392         void* val_ptr = untag_ptr(val);
39393         CHECK_ACCESS(val_ptr);
39394         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
39395         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
39396         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
39397 }
39398
39399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
39400         LDKChannelConfigUpdate this_ptr_conv;
39401         this_ptr_conv.inner = untag_ptr(this_ptr);
39402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39404         this_ptr_conv.is_owned = false;
39405         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39406         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
39407         int64_t ret_ref = tag_ptr(ret_copy, true);
39408         return ret_ref;
39409 }
39410
39411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1set_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39412         LDKChannelConfigUpdate this_ptr_conv;
39413         this_ptr_conv.inner = untag_ptr(this_ptr);
39414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39416         this_ptr_conv.is_owned = false;
39417         void* val_ptr = untag_ptr(val);
39418         CHECK_ACCESS(val_ptr);
39419         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39420         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39421         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
39422 }
39423
39424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1new(JNIEnv *env, jclass clz, int64_t forwarding_fee_proportional_millionths_arg, int64_t forwarding_fee_base_msat_arg, int64_t cltv_expiry_delta_arg, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
39425         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
39426         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
39427         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
39428         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
39429         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
39430         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
39431         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
39432         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
39433         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
39434         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
39435         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
39436         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
39437         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
39438         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
39439         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
39440         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
39441         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
39442         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
39443         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
39444         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
39445         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_new(forwarding_fee_proportional_millionths_arg_conv, forwarding_fee_base_msat_arg_conv, cltv_expiry_delta_arg_conv, max_dust_htlc_exposure_msat_arg_conv, force_close_avoidance_max_fee_satoshis_arg_conv);
39446         int64_t ret_ref = 0;
39447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39449         return ret_ref;
39450 }
39451
39452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1default(JNIEnv *env, jclass clz) {
39453         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
39454         int64_t ret_ref = 0;
39455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39457         return ret_ref;
39458 }
39459
39460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39461         LDKUserConfig this_obj_conv;
39462         this_obj_conv.inner = untag_ptr(this_obj);
39463         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39465         UserConfig_free(this_obj_conv);
39466 }
39467
39468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
39469         LDKUserConfig this_ptr_conv;
39470         this_ptr_conv.inner = untag_ptr(this_ptr);
39471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39473         this_ptr_conv.is_owned = false;
39474         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
39475         int64_t ret_ref = 0;
39476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39478         return ret_ref;
39479 }
39480
39481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39482         LDKUserConfig this_ptr_conv;
39483         this_ptr_conv.inner = untag_ptr(this_ptr);
39484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39486         this_ptr_conv.is_owned = false;
39487         LDKChannelHandshakeConfig val_conv;
39488         val_conv.inner = untag_ptr(val);
39489         val_conv.is_owned = ptr_is_owned(val);
39490         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39491         val_conv = ChannelHandshakeConfig_clone(&val_conv);
39492         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
39493 }
39494
39495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
39496         LDKUserConfig this_ptr_conv;
39497         this_ptr_conv.inner = untag_ptr(this_ptr);
39498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39500         this_ptr_conv.is_owned = false;
39501         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
39502         int64_t ret_ref = 0;
39503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39505         return ret_ref;
39506 }
39507
39508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39509         LDKUserConfig this_ptr_conv;
39510         this_ptr_conv.inner = untag_ptr(this_ptr);
39511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39513         this_ptr_conv.is_owned = false;
39514         LDKChannelHandshakeLimits val_conv;
39515         val_conv.inner = untag_ptr(val);
39516         val_conv.is_owned = ptr_is_owned(val);
39517         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39518         val_conv = ChannelHandshakeLimits_clone(&val_conv);
39519         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
39520 }
39521
39522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
39523         LDKUserConfig this_ptr_conv;
39524         this_ptr_conv.inner = untag_ptr(this_ptr);
39525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39527         this_ptr_conv.is_owned = false;
39528         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
39529         int64_t ret_ref = 0;
39530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39532         return ret_ref;
39533 }
39534
39535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39536         LDKUserConfig this_ptr_conv;
39537         this_ptr_conv.inner = untag_ptr(this_ptr);
39538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39540         this_ptr_conv.is_owned = false;
39541         LDKChannelConfig val_conv;
39542         val_conv.inner = untag_ptr(val);
39543         val_conv.is_owned = ptr_is_owned(val);
39544         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39545         val_conv = ChannelConfig_clone(&val_conv);
39546         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
39547 }
39548
39549 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
39550         LDKUserConfig this_ptr_conv;
39551         this_ptr_conv.inner = untag_ptr(this_ptr);
39552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39554         this_ptr_conv.is_owned = false;
39555         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
39556         return ret_conv;
39557 }
39558
39559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39560         LDKUserConfig this_ptr_conv;
39561         this_ptr_conv.inner = untag_ptr(this_ptr);
39562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39564         this_ptr_conv.is_owned = false;
39565         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
39566 }
39567
39568 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
39569         LDKUserConfig this_ptr_conv;
39570         this_ptr_conv.inner = untag_ptr(this_ptr);
39571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39573         this_ptr_conv.is_owned = false;
39574         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
39575         return ret_conv;
39576 }
39577
39578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39579         LDKUserConfig this_ptr_conv;
39580         this_ptr_conv.inner = untag_ptr(this_ptr);
39581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39583         this_ptr_conv.is_owned = false;
39584         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
39585 }
39586
39587 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
39588         LDKUserConfig this_ptr_conv;
39589         this_ptr_conv.inner = untag_ptr(this_ptr);
39590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39592         this_ptr_conv.is_owned = false;
39593         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
39594         return ret_conv;
39595 }
39596
39597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39598         LDKUserConfig this_ptr_conv;
39599         this_ptr_conv.inner = untag_ptr(this_ptr);
39600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39602         this_ptr_conv.is_owned = false;
39603         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
39604 }
39605
39606 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
39607         LDKUserConfig this_ptr_conv;
39608         this_ptr_conv.inner = untag_ptr(this_ptr);
39609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39611         this_ptr_conv.is_owned = false;
39612         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
39613         return ret_conv;
39614 }
39615
39616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39617         LDKUserConfig this_ptr_conv;
39618         this_ptr_conv.inner = untag_ptr(this_ptr);
39619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39621         this_ptr_conv.is_owned = false;
39622         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
39623 }
39624
39625 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1mpp_1keysend(JNIEnv *env, jclass clz, int64_t this_ptr) {
39626         LDKUserConfig this_ptr_conv;
39627         this_ptr_conv.inner = untag_ptr(this_ptr);
39628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39630         this_ptr_conv.is_owned = false;
39631         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
39632         return ret_conv;
39633 }
39634
39635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1mpp_1keysend(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39636         LDKUserConfig this_ptr_conv;
39637         this_ptr_conv.inner = untag_ptr(this_ptr);
39638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39640         this_ptr_conv.is_owned = false;
39641         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
39642 }
39643
39644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t channel_handshake_config_arg, int64_t channel_handshake_limits_arg, int64_t channel_config_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg, jboolean manually_accept_inbound_channels_arg, jboolean accept_intercept_htlcs_arg, jboolean accept_mpp_keysend_arg) {
39645         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
39646         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
39647         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
39648         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
39649         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
39650         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
39651         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
39652         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
39653         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
39654         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
39655         LDKChannelConfig channel_config_arg_conv;
39656         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
39657         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
39658         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
39659         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
39660         LDKUserConfig ret_var = UserConfig_new(channel_handshake_config_arg_conv, channel_handshake_limits_arg_conv, channel_config_arg_conv, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg, manually_accept_inbound_channels_arg, accept_intercept_htlcs_arg, accept_mpp_keysend_arg);
39661         int64_t ret_ref = 0;
39662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39664         return ret_ref;
39665 }
39666
39667 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
39668         LDKUserConfig ret_var = UserConfig_clone(arg);
39669         int64_t ret_ref = 0;
39670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39672         return ret_ref;
39673 }
39674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39675         LDKUserConfig arg_conv;
39676         arg_conv.inner = untag_ptr(arg);
39677         arg_conv.is_owned = ptr_is_owned(arg);
39678         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39679         arg_conv.is_owned = false;
39680         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
39681         return ret_conv;
39682 }
39683
39684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39685         LDKUserConfig orig_conv;
39686         orig_conv.inner = untag_ptr(orig);
39687         orig_conv.is_owned = ptr_is_owned(orig);
39688         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39689         orig_conv.is_owned = false;
39690         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
39691         int64_t ret_ref = 0;
39692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39694         return ret_ref;
39695 }
39696
39697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
39698         LDKUserConfig ret_var = UserConfig_default();
39699         int64_t ret_ref = 0;
39700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39702         return ret_ref;
39703 }
39704
39705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39706         LDKBestBlock this_obj_conv;
39707         this_obj_conv.inner = untag_ptr(this_obj);
39708         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39710         BestBlock_free(this_obj_conv);
39711 }
39712
39713 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
39714         LDKBestBlock ret_var = BestBlock_clone(arg);
39715         int64_t ret_ref = 0;
39716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39718         return ret_ref;
39719 }
39720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39721         LDKBestBlock arg_conv;
39722         arg_conv.inner = untag_ptr(arg);
39723         arg_conv.is_owned = ptr_is_owned(arg);
39724         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39725         arg_conv.is_owned = false;
39726         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
39727         return ret_conv;
39728 }
39729
39730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39731         LDKBestBlock orig_conv;
39732         orig_conv.inner = untag_ptr(orig);
39733         orig_conv.is_owned = ptr_is_owned(orig);
39734         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39735         orig_conv.is_owned = false;
39736         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
39737         int64_t ret_ref = 0;
39738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39740         return ret_ref;
39741 }
39742
39743 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BestBlock_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39744         LDKBestBlock a_conv;
39745         a_conv.inner = untag_ptr(a);
39746         a_conv.is_owned = ptr_is_owned(a);
39747         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39748         a_conv.is_owned = false;
39749         LDKBestBlock b_conv;
39750         b_conv.inner = untag_ptr(b);
39751         b_conv.is_owned = ptr_is_owned(b);
39752         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39753         b_conv.is_owned = false;
39754         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
39755         return ret_conv;
39756 }
39757
39758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1network(JNIEnv *env, jclass clz, jclass network) {
39759         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
39760         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
39761         int64_t ret_ref = 0;
39762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39764         return ret_ref;
39765 }
39766
39767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
39768         LDKThirtyTwoBytes block_hash_ref;
39769         CHECK((*env)->GetArrayLength(env, block_hash) == 32);
39770         (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
39771         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
39772         int64_t ret_ref = 0;
39773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39775         return ret_ref;
39776 }
39777
39778 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
39779         LDKBestBlock this_arg_conv;
39780         this_arg_conv.inner = untag_ptr(this_arg);
39781         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39783         this_arg_conv.is_owned = false;
39784         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39785         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
39786         return ret_arr;
39787 }
39788
39789 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
39790         LDKBestBlock this_arg_conv;
39791         this_arg_conv.inner = untag_ptr(this_arg);
39792         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39794         this_arg_conv.is_owned = false;
39795         int32_t ret_conv = BestBlock_height(&this_arg_conv);
39796         return ret_conv;
39797 }
39798
39799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39800         if (!ptr_is_owned(this_ptr)) return;
39801         void* this_ptr_ptr = untag_ptr(this_ptr);
39802         CHECK_ACCESS(this_ptr_ptr);
39803         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
39804         FREE(untag_ptr(this_ptr));
39805         Listen_free(this_ptr_conv);
39806 }
39807
39808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39809         if (!ptr_is_owned(this_ptr)) return;
39810         void* this_ptr_ptr = untag_ptr(this_ptr);
39811         CHECK_ACCESS(this_ptr_ptr);
39812         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
39813         FREE(untag_ptr(this_ptr));
39814         Confirm_free(this_ptr_conv);
39815 }
39816
39817 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39818         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
39819         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_clone(orig_conv));
39820         return ret_conv;
39821 }
39822
39823 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1completed(JNIEnv *env, jclass clz) {
39824         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_completed());
39825         return ret_conv;
39826 }
39827
39828 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1in_1progress(JNIEnv *env, jclass clz) {
39829         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_in_progress());
39830         return ret_conv;
39831 }
39832
39833 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1unrecoverable_1error(JNIEnv *env, jclass clz) {
39834         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_unrecoverable_error());
39835         return ret_conv;
39836 }
39837
39838 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39839         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
39840         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
39841         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
39842         return ret_conv;
39843 }
39844
39845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39846         if (!ptr_is_owned(this_ptr)) return;
39847         void* this_ptr_ptr = untag_ptr(this_ptr);
39848         CHECK_ACCESS(this_ptr_ptr);
39849         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
39850         FREE(untag_ptr(this_ptr));
39851         Watch_free(this_ptr_conv);
39852 }
39853
39854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39855         if (!ptr_is_owned(this_ptr)) return;
39856         void* this_ptr_ptr = untag_ptr(this_ptr);
39857         CHECK_ACCESS(this_ptr_ptr);
39858         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
39859         FREE(untag_ptr(this_ptr));
39860         Filter_free(this_ptr_conv);
39861 }
39862
39863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39864         LDKWatchedOutput this_obj_conv;
39865         this_obj_conv.inner = untag_ptr(this_obj);
39866         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39868         WatchedOutput_free(this_obj_conv);
39869 }
39870
39871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
39872         LDKWatchedOutput this_ptr_conv;
39873         this_ptr_conv.inner = untag_ptr(this_ptr);
39874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39876         this_ptr_conv.is_owned = false;
39877         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
39878         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
39879         int64_t ret_ref = tag_ptr(ret_copy, true);
39880         return ret_ref;
39881 }
39882
39883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39884         LDKWatchedOutput this_ptr_conv;
39885         this_ptr_conv.inner = untag_ptr(this_ptr);
39886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39888         this_ptr_conv.is_owned = false;
39889         void* val_ptr = untag_ptr(val);
39890         CHECK_ACCESS(val_ptr);
39891         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
39892         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
39893         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
39894 }
39895
39896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
39897         LDKWatchedOutput this_ptr_conv;
39898         this_ptr_conv.inner = untag_ptr(this_ptr);
39899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39901         this_ptr_conv.is_owned = false;
39902         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
39903         int64_t ret_ref = 0;
39904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39906         return ret_ref;
39907 }
39908
39909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39910         LDKWatchedOutput this_ptr_conv;
39911         this_ptr_conv.inner = untag_ptr(this_ptr);
39912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39914         this_ptr_conv.is_owned = false;
39915         LDKOutPoint val_conv;
39916         val_conv.inner = untag_ptr(val);
39917         val_conv.is_owned = ptr_is_owned(val);
39918         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39919         val_conv = OutPoint_clone(&val_conv);
39920         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
39921 }
39922
39923 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
39924         LDKWatchedOutput this_ptr_conv;
39925         this_ptr_conv.inner = untag_ptr(this_ptr);
39926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39928         this_ptr_conv.is_owned = false;
39929         LDKCVec_u8Z ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
39930         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39931         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39932         CVec_u8Z_free(ret_var);
39933         return ret_arr;
39934 }
39935
39936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39937         LDKWatchedOutput this_ptr_conv;
39938         this_ptr_conv.inner = untag_ptr(this_ptr);
39939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39941         this_ptr_conv.is_owned = false;
39942         LDKCVec_u8Z val_ref;
39943         val_ref.datalen = (*env)->GetArrayLength(env, val);
39944         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
39945         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
39946         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
39947 }
39948
39949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1new(JNIEnv *env, jclass clz, int64_t block_hash_arg, int64_t outpoint_arg, int8_tArray script_pubkey_arg) {
39950         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
39951         CHECK_ACCESS(block_hash_arg_ptr);
39952         LDKCOption_ThirtyTwoBytesZ block_hash_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(block_hash_arg_ptr);
39953         block_hash_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(block_hash_arg));
39954         LDKOutPoint outpoint_arg_conv;
39955         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
39956         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
39957         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
39958         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
39959         LDKCVec_u8Z script_pubkey_arg_ref;
39960         script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
39961         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
39962         (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
39963         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
39964         int64_t ret_ref = 0;
39965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39967         return ret_ref;
39968 }
39969
39970 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
39971         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
39972         int64_t ret_ref = 0;
39973         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39974         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39975         return ret_ref;
39976 }
39977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39978         LDKWatchedOutput arg_conv;
39979         arg_conv.inner = untag_ptr(arg);
39980         arg_conv.is_owned = ptr_is_owned(arg);
39981         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39982         arg_conv.is_owned = false;
39983         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
39984         return ret_conv;
39985 }
39986
39987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39988         LDKWatchedOutput orig_conv;
39989         orig_conv.inner = untag_ptr(orig);
39990         orig_conv.is_owned = ptr_is_owned(orig);
39991         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39992         orig_conv.is_owned = false;
39993         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
39994         int64_t ret_ref = 0;
39995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39997         return ret_ref;
39998 }
39999
40000 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40001         LDKWatchedOutput a_conv;
40002         a_conv.inner = untag_ptr(a);
40003         a_conv.is_owned = ptr_is_owned(a);
40004         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40005         a_conv.is_owned = false;
40006         LDKWatchedOutput b_conv;
40007         b_conv.inner = untag_ptr(b);
40008         b_conv.is_owned = ptr_is_owned(b);
40009         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40010         b_conv.is_owned = false;
40011         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
40012         return ret_conv;
40013 }
40014
40015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
40016         LDKWatchedOutput o_conv;
40017         o_conv.inner = untag_ptr(o);
40018         o_conv.is_owned = ptr_is_owned(o);
40019         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40020         o_conv.is_owned = false;
40021         int64_t ret_conv = WatchedOutput_hash(&o_conv);
40022         return ret_conv;
40023 }
40024
40025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40026         if (!ptr_is_owned(this_ptr)) return;
40027         void* this_ptr_ptr = untag_ptr(this_ptr);
40028         CHECK_ACCESS(this_ptr_ptr);
40029         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
40030         FREE(untag_ptr(this_ptr));
40031         BroadcasterInterface_free(this_ptr_conv);
40032 }
40033
40034 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40035         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
40036         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
40037         return ret_conv;
40038 }
40039
40040 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1on_1chain_1sweep(JNIEnv *env, jclass clz) {
40041         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_on_chain_sweep());
40042         return ret_conv;
40043 }
40044
40045 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1min_1allowed_1anchor_1channel_1remote_1fee(JNIEnv *env, jclass clz) {
40046         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_min_allowed_anchor_channel_remote_fee());
40047         return ret_conv;
40048 }
40049
40050 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1min_1allowed_1non_1anchor_1channel_1remote_1fee(JNIEnv *env, jclass clz) {
40051         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee());
40052         return ret_conv;
40053 }
40054
40055 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1anchor_1channel_1fee(JNIEnv *env, jclass clz) {
40056         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_anchor_channel_fee());
40057         return ret_conv;
40058 }
40059
40060 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1non_1anchor_1channel_1fee(JNIEnv *env, jclass clz) {
40061         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_non_anchor_channel_fee());
40062         return ret_conv;
40063 }
40064
40065 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1channel_1close_1minimum(JNIEnv *env, jclass clz) {
40066         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_channel_close_minimum());
40067         return ret_conv;
40068 }
40069
40070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1hash(JNIEnv *env, jclass clz, int64_t o) {
40071         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
40072         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
40073         return ret_conv;
40074 }
40075
40076 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40077         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
40078         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
40079         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
40080         return ret_conv;
40081 }
40082
40083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40084         if (!ptr_is_owned(this_ptr)) return;
40085         void* this_ptr_ptr = untag_ptr(this_ptr);
40086         CHECK_ACCESS(this_ptr_ptr);
40087         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
40088         FREE(untag_ptr(this_ptr));
40089         FeeEstimator_free(this_ptr_conv);
40090 }
40091
40092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40093         LDKMonitorUpdateId this_obj_conv;
40094         this_obj_conv.inner = untag_ptr(this_obj);
40095         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40097         MonitorUpdateId_free(this_obj_conv);
40098 }
40099
40100 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
40101         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
40102         int64_t ret_ref = 0;
40103         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40104         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40105         return ret_ref;
40106 }
40107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40108         LDKMonitorUpdateId arg_conv;
40109         arg_conv.inner = untag_ptr(arg);
40110         arg_conv.is_owned = ptr_is_owned(arg);
40111         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40112         arg_conv.is_owned = false;
40113         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
40114         return ret_conv;
40115 }
40116
40117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40118         LDKMonitorUpdateId orig_conv;
40119         orig_conv.inner = untag_ptr(orig);
40120         orig_conv.is_owned = ptr_is_owned(orig);
40121         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40122         orig_conv.is_owned = false;
40123         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
40124         int64_t ret_ref = 0;
40125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40127         return ret_ref;
40128 }
40129
40130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
40131         LDKMonitorUpdateId o_conv;
40132         o_conv.inner = untag_ptr(o);
40133         o_conv.is_owned = ptr_is_owned(o);
40134         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40135         o_conv.is_owned = false;
40136         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
40137         return ret_conv;
40138 }
40139
40140 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40141         LDKMonitorUpdateId a_conv;
40142         a_conv.inner = untag_ptr(a);
40143         a_conv.is_owned = ptr_is_owned(a);
40144         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40145         a_conv.is_owned = false;
40146         LDKMonitorUpdateId b_conv;
40147         b_conv.inner = untag_ptr(b);
40148         b_conv.is_owned = ptr_is_owned(b);
40149         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40150         b_conv.is_owned = false;
40151         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
40152         return ret_conv;
40153 }
40154
40155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40156         if (!ptr_is_owned(this_ptr)) return;
40157         void* this_ptr_ptr = untag_ptr(this_ptr);
40158         CHECK_ACCESS(this_ptr_ptr);
40159         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
40160         FREE(untag_ptr(this_ptr));
40161         Persist_free(this_ptr_conv);
40162 }
40163
40164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40165         LDKLockedChannelMonitor this_obj_conv;
40166         this_obj_conv.inner = untag_ptr(this_obj);
40167         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40169         LockedChannelMonitor_free(this_obj_conv);
40170 }
40171
40172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40173         LDKChainMonitor this_obj_conv;
40174         this_obj_conv.inner = untag_ptr(this_obj);
40175         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40177         ChainMonitor_free(this_obj_conv);
40178 }
40179
40180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv *env, jclass clz, int64_t chain_source, int64_t broadcaster, int64_t logger, int64_t feeest, int64_t persister) {
40181         void* chain_source_ptr = untag_ptr(chain_source);
40182         CHECK_ACCESS(chain_source_ptr);
40183         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
40184         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
40185         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
40186                 // Manually implement clone for Java trait instances
40187                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
40188                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40189                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
40190                 }
40191         }
40192         void* broadcaster_ptr = untag_ptr(broadcaster);
40193         CHECK_ACCESS(broadcaster_ptr);
40194         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
40195         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
40196                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40197                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
40198         }
40199         void* logger_ptr = untag_ptr(logger);
40200         CHECK_ACCESS(logger_ptr);
40201         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
40202         if (logger_conv.free == LDKLogger_JCalls_free) {
40203                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40204                 LDKLogger_JCalls_cloned(&logger_conv);
40205         }
40206         void* feeest_ptr = untag_ptr(feeest);
40207         CHECK_ACCESS(feeest_ptr);
40208         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
40209         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
40210                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40211                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
40212         }
40213         void* persister_ptr = untag_ptr(persister);
40214         CHECK_ACCESS(persister_ptr);
40215         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
40216         if (persister_conv.free == LDKPersist_JCalls_free) {
40217                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40218                 LDKPersist_JCalls_cloned(&persister_conv);
40219         }
40220         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
40221         int64_t ret_ref = 0;
40222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40224         return ret_ref;
40225 }
40226
40227 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray ignored_channels) {
40228         LDKChainMonitor this_arg_conv;
40229         this_arg_conv.inner = untag_ptr(this_arg);
40230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40232         this_arg_conv.is_owned = false;
40233         LDKCVec_ChannelDetailsZ ignored_channels_constr;
40234         ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
40235         if (ignored_channels_constr.datalen > 0)
40236                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
40237         else
40238                 ignored_channels_constr.data = NULL;
40239         int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
40240         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
40241                 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
40242                 LDKChannelDetails ignored_channels_conv_16_conv;
40243                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
40244                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
40245                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
40246                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
40247                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
40248         }
40249         (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
40250         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
40251         int64_tArray ret_arr = NULL;
40252         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40253         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40254         for (size_t j = 0; j < ret_var.datalen; j++) {
40255                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
40256                 *ret_conv_9_copy = ret_var.data[j];
40257                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
40258                 ret_arr_ptr[j] = ret_conv_9_ref;
40259         }
40260         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40261         FREE(ret_var.data);
40262         return ret_arr;
40263 }
40264
40265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
40266         LDKChainMonitor this_arg_conv;
40267         this_arg_conv.inner = untag_ptr(this_arg);
40268         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40270         this_arg_conv.is_owned = false;
40271         LDKOutPoint funding_txo_conv;
40272         funding_txo_conv.inner = untag_ptr(funding_txo);
40273         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
40274         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
40275         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
40276         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
40277         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
40278         return tag_ptr(ret_conv, true);
40279 }
40280
40281 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
40282         LDKChainMonitor this_arg_conv;
40283         this_arg_conv.inner = untag_ptr(this_arg);
40284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40286         this_arg_conv.is_owned = false;
40287         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
40288         int64_tArray ret_arr = NULL;
40289         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40290         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40291         for (size_t k = 0; k < ret_var.datalen; k++) {
40292                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
40293                 int64_t ret_conv_10_ref = 0;
40294                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
40295                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
40296                 ret_arr_ptr[k] = ret_conv_10_ref;
40297         }
40298         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40299         FREE(ret_var.data);
40300         return ret_arr;
40301 }
40302
40303 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1pending_1monitor_1updates(JNIEnv *env, jclass clz, int64_t this_arg) {
40304         LDKChainMonitor this_arg_conv;
40305         this_arg_conv.inner = untag_ptr(this_arg);
40306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40308         this_arg_conv.is_owned = false;
40309         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
40310         int64_tArray ret_arr = NULL;
40311         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40312         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40313         for (size_t p = 0; p < ret_var.datalen; p++) {
40314                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
40315                 *ret_conv_41_conv = ret_var.data[p];
40316                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
40317         }
40318         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40319         FREE(ret_var.data);
40320         return ret_arr;
40321 }
40322
40323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1channel_1monitor_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t completed_update_id) {
40324         LDKChainMonitor this_arg_conv;
40325         this_arg_conv.inner = untag_ptr(this_arg);
40326         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40328         this_arg_conv.is_owned = false;
40329         LDKOutPoint funding_txo_conv;
40330         funding_txo_conv.inner = untag_ptr(funding_txo);
40331         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
40332         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
40333         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
40334         LDKMonitorUpdateId completed_update_id_conv;
40335         completed_update_id_conv.inner = untag_ptr(completed_update_id);
40336         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
40337         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
40338         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
40339         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
40340         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
40341         return tag_ptr(ret_conv, true);
40342 }
40343
40344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1update_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
40345         LDKChainMonitor this_arg_conv;
40346         this_arg_conv.inner = untag_ptr(this_arg);
40347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40349         this_arg_conv.is_owned = false;
40350         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
40351         int64_t ret_ref = 0;
40352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40354         return ret_ref;
40355 }
40356
40357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1rebroadcast_1pending_1claims(JNIEnv *env, jclass clz, int64_t this_arg) {
40358         LDKChainMonitor this_arg_conv;
40359         this_arg_conv.inner = untag_ptr(this_arg);
40360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40362         this_arg_conv.is_owned = false;
40363         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
40364 }
40365
40366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
40367         LDKChainMonitor this_arg_conv;
40368         this_arg_conv.inner = untag_ptr(this_arg);
40369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40371         this_arg_conv.is_owned = false;
40372         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
40373         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
40374         return tag_ptr(ret_ret, true);
40375 }
40376
40377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
40378         LDKChainMonitor this_arg_conv;
40379         this_arg_conv.inner = untag_ptr(this_arg);
40380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40382         this_arg_conv.is_owned = false;
40383         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
40384         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
40385         return tag_ptr(ret_ret, true);
40386 }
40387
40388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
40389         LDKChainMonitor this_arg_conv;
40390         this_arg_conv.inner = untag_ptr(this_arg);
40391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40393         this_arg_conv.is_owned = false;
40394         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
40395         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
40396         return tag_ptr(ret_ret, true);
40397 }
40398
40399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
40400         LDKChainMonitor this_arg_conv;
40401         this_arg_conv.inner = untag_ptr(this_arg);
40402         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40404         this_arg_conv.is_owned = false;
40405         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
40406         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
40407         return tag_ptr(ret_ret, true);
40408 }
40409
40410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40411         LDKChannelMonitorUpdate this_obj_conv;
40412         this_obj_conv.inner = untag_ptr(this_obj);
40413         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40415         ChannelMonitorUpdate_free(this_obj_conv);
40416 }
40417
40418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
40419         LDKChannelMonitorUpdate this_ptr_conv;
40420         this_ptr_conv.inner = untag_ptr(this_ptr);
40421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40423         this_ptr_conv.is_owned = false;
40424         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
40425         return ret_conv;
40426 }
40427
40428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40429         LDKChannelMonitorUpdate this_ptr_conv;
40430         this_ptr_conv.inner = untag_ptr(this_ptr);
40431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40433         this_ptr_conv.is_owned = false;
40434         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
40435 }
40436
40437 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
40438         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
40439         int64_t ret_ref = 0;
40440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40442         return ret_ref;
40443 }
40444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40445         LDKChannelMonitorUpdate arg_conv;
40446         arg_conv.inner = untag_ptr(arg);
40447         arg_conv.is_owned = ptr_is_owned(arg);
40448         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40449         arg_conv.is_owned = false;
40450         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
40451         return ret_conv;
40452 }
40453
40454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40455         LDKChannelMonitorUpdate orig_conv;
40456         orig_conv.inner = untag_ptr(orig);
40457         orig_conv.is_owned = ptr_is_owned(orig);
40458         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40459         orig_conv.is_owned = false;
40460         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
40461         int64_t ret_ref = 0;
40462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40464         return ret_ref;
40465 }
40466
40467 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40468         LDKChannelMonitorUpdate a_conv;
40469         a_conv.inner = untag_ptr(a);
40470         a_conv.is_owned = ptr_is_owned(a);
40471         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40472         a_conv.is_owned = false;
40473         LDKChannelMonitorUpdate b_conv;
40474         b_conv.inner = untag_ptr(b);
40475         b_conv.is_owned = ptr_is_owned(b);
40476         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40477         b_conv.is_owned = false;
40478         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
40479         return ret_conv;
40480 }
40481
40482 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
40483         LDKChannelMonitorUpdate obj_conv;
40484         obj_conv.inner = untag_ptr(obj);
40485         obj_conv.is_owned = ptr_is_owned(obj);
40486         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40487         obj_conv.is_owned = false;
40488         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
40489         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40490         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40491         CVec_u8Z_free(ret_var);
40492         return ret_arr;
40493 }
40494
40495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40496         LDKu8slice ser_ref;
40497         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40498         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40499         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
40500         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
40501         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40502         return tag_ptr(ret_conv, true);
40503 }
40504
40505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40506         if (!ptr_is_owned(this_ptr)) return;
40507         void* this_ptr_ptr = untag_ptr(this_ptr);
40508         CHECK_ACCESS(this_ptr_ptr);
40509         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
40510         FREE(untag_ptr(this_ptr));
40511         MonitorEvent_free(this_ptr_conv);
40512 }
40513
40514 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
40515         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
40516         *ret_copy = MonitorEvent_clone(arg);
40517         int64_t ret_ref = tag_ptr(ret_copy, true);
40518         return ret_ref;
40519 }
40520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40521         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
40522         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
40523         return ret_conv;
40524 }
40525
40526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40527         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
40528         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
40529         *ret_copy = MonitorEvent_clone(orig_conv);
40530         int64_t ret_ref = tag_ptr(ret_copy, true);
40531         return ret_ref;
40532 }
40533
40534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
40535         LDKHTLCUpdate a_conv;
40536         a_conv.inner = untag_ptr(a);
40537         a_conv.is_owned = ptr_is_owned(a);
40538         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40539         a_conv = HTLCUpdate_clone(&a_conv);
40540         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
40541         *ret_copy = MonitorEvent_htlcevent(a_conv);
40542         int64_t ret_ref = tag_ptr(ret_copy, true);
40543         return ret_ref;
40544 }
40545
40546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1holder_1force_1closed(JNIEnv *env, jclass clz, int64_t a) {
40547         LDKOutPoint a_conv;
40548         a_conv.inner = untag_ptr(a);
40549         a_conv.is_owned = ptr_is_owned(a);
40550         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40551         a_conv = OutPoint_clone(&a_conv);
40552         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
40553         *ret_copy = MonitorEvent_holder_force_closed(a_conv);
40554         int64_t ret_ref = tag_ptr(ret_copy, true);
40555         return ret_ref;
40556 }
40557
40558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1completed(JNIEnv *env, jclass clz, int64_t funding_txo, int64_t monitor_update_id) {
40559         LDKOutPoint funding_txo_conv;
40560         funding_txo_conv.inner = untag_ptr(funding_txo);
40561         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
40562         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
40563         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
40564         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
40565         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
40566         int64_t ret_ref = tag_ptr(ret_copy, true);
40567         return ret_ref;
40568 }
40569
40570 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40571         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
40572         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
40573         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
40574         return ret_conv;
40575 }
40576
40577 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
40578         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
40579         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
40580         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40581         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40582         CVec_u8Z_free(ret_var);
40583         return ret_arr;
40584 }
40585
40586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40587         LDKu8slice ser_ref;
40588         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40589         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40590         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
40591         *ret_conv = MonitorEvent_read(ser_ref);
40592         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40593         return tag_ptr(ret_conv, true);
40594 }
40595
40596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40597         LDKHTLCUpdate this_obj_conv;
40598         this_obj_conv.inner = untag_ptr(this_obj);
40599         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40601         HTLCUpdate_free(this_obj_conv);
40602 }
40603
40604 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
40605         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
40606         int64_t ret_ref = 0;
40607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40609         return ret_ref;
40610 }
40611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40612         LDKHTLCUpdate arg_conv;
40613         arg_conv.inner = untag_ptr(arg);
40614         arg_conv.is_owned = ptr_is_owned(arg);
40615         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40616         arg_conv.is_owned = false;
40617         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
40618         return ret_conv;
40619 }
40620
40621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40622         LDKHTLCUpdate orig_conv;
40623         orig_conv.inner = untag_ptr(orig);
40624         orig_conv.is_owned = ptr_is_owned(orig);
40625         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40626         orig_conv.is_owned = false;
40627         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
40628         int64_t ret_ref = 0;
40629         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40630         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40631         return ret_ref;
40632 }
40633
40634 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40635         LDKHTLCUpdate a_conv;
40636         a_conv.inner = untag_ptr(a);
40637         a_conv.is_owned = ptr_is_owned(a);
40638         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40639         a_conv.is_owned = false;
40640         LDKHTLCUpdate b_conv;
40641         b_conv.inner = untag_ptr(b);
40642         b_conv.is_owned = ptr_is_owned(b);
40643         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40644         b_conv.is_owned = false;
40645         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
40646         return ret_conv;
40647 }
40648
40649 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
40650         LDKHTLCUpdate obj_conv;
40651         obj_conv.inner = untag_ptr(obj);
40652         obj_conv.is_owned = ptr_is_owned(obj);
40653         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40654         obj_conv.is_owned = false;
40655         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
40656         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40657         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40658         CVec_u8Z_free(ret_var);
40659         return ret_arr;
40660 }
40661
40662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40663         LDKu8slice ser_ref;
40664         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40665         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40666         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
40667         *ret_conv = HTLCUpdate_read(ser_ref);
40668         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40669         return tag_ptr(ret_conv, true);
40670 }
40671
40672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40673         if (!ptr_is_owned(this_ptr)) return;
40674         void* this_ptr_ptr = untag_ptr(this_ptr);
40675         CHECK_ACCESS(this_ptr_ptr);
40676         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
40677         FREE(untag_ptr(this_ptr));
40678         Balance_free(this_ptr_conv);
40679 }
40680
40681 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
40682         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
40683         *ret_copy = Balance_clone(arg);
40684         int64_t ret_ref = tag_ptr(ret_copy, true);
40685         return ret_ref;
40686 }
40687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40688         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
40689         int64_t ret_conv = Balance_clone_ptr(arg_conv);
40690         return ret_conv;
40691 }
40692
40693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40694         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
40695         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
40696         *ret_copy = Balance_clone(orig_conv);
40697         int64_t ret_ref = tag_ptr(ret_copy, true);
40698         return ret_ref;
40699 }
40700
40701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t amount_satoshis) {
40702         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
40703         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
40704         int64_t ret_ref = tag_ptr(ret_copy, true);
40705         return ret_ref;
40706 }
40707
40708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1awaiting_1confirmations(JNIEnv *env, jclass clz, int64_t amount_satoshis, int32_t confirmation_height) {
40709         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
40710         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
40711         int64_t ret_ref = tag_ptr(ret_copy, true);
40712         return ret_ref;
40713 }
40714
40715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1contentious_1claimable(JNIEnv *env, jclass clz, int64_t amount_satoshis, int32_t timeout_height, int8_tArray payment_hash, int8_tArray payment_preimage) {
40716         LDKThirtyTwoBytes payment_hash_ref;
40717         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40718         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
40719         LDKThirtyTwoBytes payment_preimage_ref;
40720         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
40721         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
40722         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
40723         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
40724         int64_t ret_ref = tag_ptr(ret_copy, true);
40725         return ret_ref;
40726 }
40727
40728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1maybe_1timeout_1claimable_1htlc(JNIEnv *env, jclass clz, int64_t amount_satoshis, int32_t claimable_height, int8_tArray payment_hash) {
40729         LDKThirtyTwoBytes payment_hash_ref;
40730         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40731         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
40732         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
40733         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
40734         int64_t ret_ref = tag_ptr(ret_copy, true);
40735         return ret_ref;
40736 }
40737
40738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1maybe_1preimage_1claimable_1htlc(JNIEnv *env, jclass clz, int64_t amount_satoshis, int32_t expiry_height, int8_tArray payment_hash) {
40739         LDKThirtyTwoBytes payment_hash_ref;
40740         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
40741         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
40742         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
40743         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
40744         int64_t ret_ref = tag_ptr(ret_copy, true);
40745         return ret_ref;
40746 }
40747
40748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1counterparty_1revoked_1output_1claimable(JNIEnv *env, jclass clz, int64_t amount_satoshis) {
40749         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
40750         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
40751         int64_t ret_ref = tag_ptr(ret_copy, true);
40752         return ret_ref;
40753 }
40754
40755 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40756         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
40757         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
40758         jboolean ret_conv = Balance_eq(a_conv, b_conv);
40759         return ret_conv;
40760 }
40761
40762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1amount_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
40763         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
40764         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
40765         return ret_conv;
40766 }
40767
40768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40769         LDKChannelMonitor this_obj_conv;
40770         this_obj_conv.inner = untag_ptr(this_obj);
40771         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40773         ChannelMonitor_free(this_obj_conv);
40774 }
40775
40776 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
40777         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
40778         int64_t ret_ref = 0;
40779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40781         return ret_ref;
40782 }
40783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40784         LDKChannelMonitor arg_conv;
40785         arg_conv.inner = untag_ptr(arg);
40786         arg_conv.is_owned = ptr_is_owned(arg);
40787         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40788         arg_conv.is_owned = false;
40789         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
40790         return ret_conv;
40791 }
40792
40793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40794         LDKChannelMonitor orig_conv;
40795         orig_conv.inner = untag_ptr(orig);
40796         orig_conv.is_owned = ptr_is_owned(orig);
40797         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40798         orig_conv.is_owned = false;
40799         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
40800         int64_t ret_ref = 0;
40801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40803         return ret_ref;
40804 }
40805
40806 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
40807         LDKChannelMonitor obj_conv;
40808         obj_conv.inner = untag_ptr(obj);
40809         obj_conv.is_owned = ptr_is_owned(obj);
40810         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40811         obj_conv.is_owned = false;
40812         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
40813         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40814         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40815         CVec_u8Z_free(ret_var);
40816         return ret_arr;
40817 }
40818
40819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t updates, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
40820         LDKChannelMonitor this_arg_conv;
40821         this_arg_conv.inner = untag_ptr(this_arg);
40822         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40824         this_arg_conv.is_owned = false;
40825         LDKChannelMonitorUpdate updates_conv;
40826         updates_conv.inner = untag_ptr(updates);
40827         updates_conv.is_owned = ptr_is_owned(updates);
40828         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
40829         updates_conv.is_owned = false;
40830         void* broadcaster_ptr = untag_ptr(broadcaster);
40831         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
40832         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
40833         void* fee_estimator_ptr = untag_ptr(fee_estimator);
40834         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
40835         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
40836         void* logger_ptr = untag_ptr(logger);
40837         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
40838         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
40839         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
40840         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
40841         return tag_ptr(ret_conv, true);
40842 }
40843
40844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
40845         LDKChannelMonitor this_arg_conv;
40846         this_arg_conv.inner = untag_ptr(this_arg);
40847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40849         this_arg_conv.is_owned = false;
40850         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
40851         return ret_conv;
40852 }
40853
40854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
40855         LDKChannelMonitor this_arg_conv;
40856         this_arg_conv.inner = untag_ptr(this_arg);
40857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40859         this_arg_conv.is_owned = false;
40860         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
40861         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
40862         return tag_ptr(ret_conv, true);
40863 }
40864
40865 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
40866         LDKChannelMonitor this_arg_conv;
40867         this_arg_conv.inner = untag_ptr(this_arg);
40868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40870         this_arg_conv.is_owned = false;
40871         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
40872         int64_tArray ret_arr = NULL;
40873         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40874         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40875         for (size_t a = 0; a < ret_var.datalen; a++) {
40876                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv_52_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
40877                 *ret_conv_52_conv = ret_var.data[a];
40878                 ret_arr_ptr[a] = tag_ptr(ret_conv_52_conv, true);
40879         }
40880         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40881         FREE(ret_var.data);
40882         return ret_arr;
40883 }
40884
40885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter, int64_t logger) {
40886         LDKChannelMonitor this_arg_conv;
40887         this_arg_conv.inner = untag_ptr(this_arg);
40888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40890         this_arg_conv.is_owned = false;
40891         void* filter_ptr = untag_ptr(filter);
40892         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
40893         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
40894         void* logger_ptr = untag_ptr(logger);
40895         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
40896         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
40897         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv, logger_conv);
40898 }
40899
40900 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
40901         LDKChannelMonitor this_arg_conv;
40902         this_arg_conv.inner = untag_ptr(this_arg);
40903         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40905         this_arg_conv.is_owned = false;
40906         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
40907         int64_tArray ret_arr = NULL;
40908         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40909         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40910         for (size_t o = 0; o < ret_var.datalen; o++) {
40911                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
40912                 *ret_conv_14_copy = ret_var.data[o];
40913                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
40914                 ret_arr_ptr[o] = ret_conv_14_ref;
40915         }
40916         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40917         FREE(ret_var.data);
40918         return ret_arr;
40919 }
40920
40921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
40922         LDKChannelMonitor this_arg_conv;
40923         this_arg_conv.inner = untag_ptr(this_arg);
40924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40926         this_arg_conv.is_owned = false;
40927         void* handler_ptr = untag_ptr(handler);
40928         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
40929         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
40930         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
40931 }
40932
40933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1initial_1counterparty_1commitment_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
40934         LDKChannelMonitor this_arg_conv;
40935         this_arg_conv.inner = untag_ptr(this_arg);
40936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40938         this_arg_conv.is_owned = false;
40939         LDKCommitmentTransaction ret_var = ChannelMonitor_initial_counterparty_commitment_tx(&this_arg_conv);
40940         int64_t ret_ref = 0;
40941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40943         return ret_ref;
40944 }
40945
40946 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1counterparty_1commitment_1txs_1from_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t update) {
40947         LDKChannelMonitor this_arg_conv;
40948         this_arg_conv.inner = untag_ptr(this_arg);
40949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40951         this_arg_conv.is_owned = false;
40952         LDKChannelMonitorUpdate update_conv;
40953         update_conv.inner = untag_ptr(update);
40954         update_conv.is_owned = ptr_is_owned(update);
40955         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
40956         update_conv.is_owned = false;
40957         LDKCVec_CommitmentTransactionZ ret_var = ChannelMonitor_counterparty_commitment_txs_from_update(&this_arg_conv, &update_conv);
40958         int64_tArray ret_arr = NULL;
40959         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
40960         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
40961         for (size_t x = 0; x < ret_var.datalen; x++) {
40962                 LDKCommitmentTransaction ret_conv_23_var = ret_var.data[x];
40963                 int64_t ret_conv_23_ref = 0;
40964                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_23_var);
40965                 ret_conv_23_ref = tag_ptr(ret_conv_23_var.inner, ret_conv_23_var.is_owned);
40966                 ret_arr_ptr[x] = ret_conv_23_ref;
40967         }
40968         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
40969         FREE(ret_var.data);
40970         return ret_arr;
40971 }
40972
40973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1sign_1to_1local_1justice_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input_idx, int64_t value, int64_t commitment_number) {
40974         LDKChannelMonitor this_arg_conv;
40975         this_arg_conv.inner = untag_ptr(this_arg);
40976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40978         this_arg_conv.is_owned = false;
40979         LDKTransaction justice_tx_ref;
40980         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
40981         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
40982         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
40983         justice_tx_ref.data_is_owned = true;
40984         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
40985         *ret_conv = ChannelMonitor_sign_to_local_justice_tx(&this_arg_conv, justice_tx_ref, input_idx, value, commitment_number);
40986         return tag_ptr(ret_conv, true);
40987 }
40988
40989 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
40990         LDKChannelMonitor this_arg_conv;
40991         this_arg_conv.inner = untag_ptr(this_arg);
40992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40994         this_arg_conv.is_owned = false;
40995         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40996         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form);
40997         return ret_arr;
40998 }
40999
41000 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t logger) {
41001         LDKChannelMonitor this_arg_conv;
41002         this_arg_conv.inner = untag_ptr(this_arg);
41003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41005         this_arg_conv.is_owned = false;
41006         void* logger_ptr = untag_ptr(logger);
41007         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
41008         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
41009         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
41010         jobjectArray ret_arr = NULL;
41011         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
41012         ;
41013         for (size_t i = 0; i < ret_var.datalen; i++) {
41014                 LDKTransaction ret_conv_8_var = ret_var.data[i];
41015                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
41016                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
41017                 Transaction_free(ret_conv_8_var);
41018                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
41019         }
41020         
41021         FREE(ret_var.data);
41022         return ret_arr;
41023 }
41024
41025 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
41026         LDKChannelMonitor this_arg_conv;
41027         this_arg_conv.inner = untag_ptr(this_arg);
41028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41030         this_arg_conv.is_owned = false;
41031         uint8_t header_arr[80];
41032         CHECK((*env)->GetArrayLength(env, header) == 80);
41033         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
41034         uint8_t (*header_ref)[80] = &header_arr;
41035         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
41036         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
41037         if (txdata_constr.datalen > 0)
41038                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
41039         else
41040                 txdata_constr.data = NULL;
41041         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
41042         for (size_t c = 0; c < txdata_constr.datalen; c++) {
41043                 int64_t txdata_conv_28 = txdata_vals[c];
41044                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
41045                 CHECK_ACCESS(txdata_conv_28_ptr);
41046                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
41047                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
41048                 txdata_constr.data[c] = txdata_conv_28_conv;
41049         }
41050         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
41051         void* broadcaster_ptr = untag_ptr(broadcaster);
41052         CHECK_ACCESS(broadcaster_ptr);
41053         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
41054         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
41055                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41056                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
41057         }
41058         void* fee_estimator_ptr = untag_ptr(fee_estimator);
41059         CHECK_ACCESS(fee_estimator_ptr);
41060         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
41061         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
41062                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41063                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
41064         }
41065         void* logger_ptr = untag_ptr(logger);
41066         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
41067         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
41068         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
41069         int64_tArray ret_arr = NULL;
41070         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
41071         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
41072         for (size_t x = 0; x < ret_var.datalen; x++) {
41073                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
41074                 *ret_conv_49_conv = ret_var.data[x];
41075                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
41076         }
41077         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
41078         FREE(ret_var.data);
41079         return ret_arr;
41080 }
41081
41082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
41083         LDKChannelMonitor this_arg_conv;
41084         this_arg_conv.inner = untag_ptr(this_arg);
41085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41087         this_arg_conv.is_owned = false;
41088         uint8_t header_arr[80];
41089         CHECK((*env)->GetArrayLength(env, header) == 80);
41090         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
41091         uint8_t (*header_ref)[80] = &header_arr;
41092         void* broadcaster_ptr = untag_ptr(broadcaster);
41093         CHECK_ACCESS(broadcaster_ptr);
41094         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
41095         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
41096                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41097                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
41098         }
41099         void* fee_estimator_ptr = untag_ptr(fee_estimator);
41100         CHECK_ACCESS(fee_estimator_ptr);
41101         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
41102         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
41103                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41104                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
41105         }
41106         void* logger_ptr = untag_ptr(logger);
41107         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
41108         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
41109         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
41110 }
41111
41112 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1transactions_1confirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
41113         LDKChannelMonitor this_arg_conv;
41114         this_arg_conv.inner = untag_ptr(this_arg);
41115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41117         this_arg_conv.is_owned = false;
41118         uint8_t header_arr[80];
41119         CHECK((*env)->GetArrayLength(env, header) == 80);
41120         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
41121         uint8_t (*header_ref)[80] = &header_arr;
41122         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
41123         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
41124         if (txdata_constr.datalen > 0)
41125                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
41126         else
41127                 txdata_constr.data = NULL;
41128         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
41129         for (size_t c = 0; c < txdata_constr.datalen; c++) {
41130                 int64_t txdata_conv_28 = txdata_vals[c];
41131                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
41132                 CHECK_ACCESS(txdata_conv_28_ptr);
41133                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
41134                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
41135                 txdata_constr.data[c] = txdata_conv_28_conv;
41136         }
41137         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
41138         void* broadcaster_ptr = untag_ptr(broadcaster);
41139         CHECK_ACCESS(broadcaster_ptr);
41140         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
41141         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
41142                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41143                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
41144         }
41145         void* fee_estimator_ptr = untag_ptr(fee_estimator);
41146         CHECK_ACCESS(fee_estimator_ptr);
41147         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
41148         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
41149                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41150                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
41151         }
41152         void* logger_ptr = untag_ptr(logger);
41153         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
41154         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
41155         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_transactions_confirmed(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
41156         int64_tArray ret_arr = NULL;
41157         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
41158         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
41159         for (size_t x = 0; x < ret_var.datalen; x++) {
41160                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
41161                 *ret_conv_49_conv = ret_var.data[x];
41162                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
41163         }
41164         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
41165         FREE(ret_var.data);
41166         return ret_arr;
41167 }
41168
41169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
41170         LDKChannelMonitor this_arg_conv;
41171         this_arg_conv.inner = untag_ptr(this_arg);
41172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41174         this_arg_conv.is_owned = false;
41175         uint8_t txid_arr[32];
41176         CHECK((*env)->GetArrayLength(env, txid) == 32);
41177         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
41178         uint8_t (*txid_ref)[32] = &txid_arr;
41179         void* broadcaster_ptr = untag_ptr(broadcaster);
41180         CHECK_ACCESS(broadcaster_ptr);
41181         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
41182         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
41183                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41184                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
41185         }
41186         void* fee_estimator_ptr = untag_ptr(fee_estimator);
41187         CHECK_ACCESS(fee_estimator_ptr);
41188         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
41189         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
41190                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41191                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
41192         }
41193         void* logger_ptr = untag_ptr(logger);
41194         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
41195         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
41196         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
41197 }
41198
41199 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1best_1block_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
41200         LDKChannelMonitor this_arg_conv;
41201         this_arg_conv.inner = untag_ptr(this_arg);
41202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41204         this_arg_conv.is_owned = false;
41205         uint8_t header_arr[80];
41206         CHECK((*env)->GetArrayLength(env, header) == 80);
41207         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
41208         uint8_t (*header_ref)[80] = &header_arr;
41209         void* broadcaster_ptr = untag_ptr(broadcaster);
41210         CHECK_ACCESS(broadcaster_ptr);
41211         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
41212         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
41213                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41214                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
41215         }
41216         void* fee_estimator_ptr = untag_ptr(fee_estimator);
41217         CHECK_ACCESS(fee_estimator_ptr);
41218         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
41219         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
41220                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41221                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
41222         }
41223         void* logger_ptr = untag_ptr(logger);
41224         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
41225         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
41226         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
41227         int64_tArray ret_arr = NULL;
41228         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
41229         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
41230         for (size_t x = 0; x < ret_var.datalen; x++) {
41231                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
41232                 *ret_conv_49_conv = ret_var.data[x];
41233                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
41234         }
41235         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
41236         FREE(ret_var.data);
41237         return ret_arr;
41238 }
41239
41240 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
41241         LDKChannelMonitor this_arg_conv;
41242         this_arg_conv.inner = untag_ptr(this_arg);
41243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41245         this_arg_conv.is_owned = false;
41246         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
41247         int64_tArray ret_arr = NULL;
41248         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
41249         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
41250         for (size_t c = 0; c < ret_var.datalen; c++) {
41251                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
41252                 *ret_conv_54_conv = ret_var.data[c];
41253                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
41254         }
41255         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
41256         FREE(ret_var.data);
41257         return ret_arr;
41258 }
41259
41260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
41261         LDKChannelMonitor this_arg_conv;
41262         this_arg_conv.inner = untag_ptr(this_arg);
41263         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41265         this_arg_conv.is_owned = false;
41266         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
41267         int64_t ret_ref = 0;
41268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41270         return ret_ref;
41271 }
41272
41273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1rebroadcast_1pending_1claims(JNIEnv *env, jclass clz, int64_t this_arg, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
41274         LDKChannelMonitor this_arg_conv;
41275         this_arg_conv.inner = untag_ptr(this_arg);
41276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41278         this_arg_conv.is_owned = false;
41279         void* broadcaster_ptr = untag_ptr(broadcaster);
41280         CHECK_ACCESS(broadcaster_ptr);
41281         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
41282         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
41283                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41284                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
41285         }
41286         void* fee_estimator_ptr = untag_ptr(fee_estimator);
41287         CHECK_ACCESS(fee_estimator_ptr);
41288         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
41289         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
41290                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41291                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
41292         }
41293         void* logger_ptr = untag_ptr(logger);
41294         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
41295         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
41296         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
41297 }
41298
41299 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx, int32_t confirmation_height) {
41300         LDKChannelMonitor this_arg_conv;
41301         this_arg_conv.inner = untag_ptr(this_arg);
41302         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41304         this_arg_conv.is_owned = false;
41305         LDKTransaction tx_ref;
41306         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
41307         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
41308         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
41309         tx_ref.data_is_owned = true;
41310         LDKCVec_SpendableOutputDescriptorZ ret_var = ChannelMonitor_get_spendable_outputs(&this_arg_conv, tx_ref, confirmation_height);
41311         int64_tArray ret_arr = NULL;
41312         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
41313         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
41314         for (size_t b = 0; b < ret_var.datalen; b++) {
41315                 LDKSpendableOutputDescriptor *ret_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
41316                 *ret_conv_27_copy = ret_var.data[b];
41317                 int64_t ret_conv_27_ref = tag_ptr(ret_conv_27_copy, true);
41318                 ret_arr_ptr[b] = ret_conv_27_ref;
41319         }
41320         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
41321         FREE(ret_var.data);
41322         return ret_arr;
41323 }
41324
41325 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
41326         LDKChannelMonitor this_arg_conv;
41327         this_arg_conv.inner = untag_ptr(this_arg);
41328         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41330         this_arg_conv.is_owned = false;
41331         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
41332         int64_tArray ret_arr = NULL;
41333         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
41334         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
41335         for (size_t j = 0; j < ret_var.datalen; j++) {
41336                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
41337                 *ret_conv_9_copy = ret_var.data[j];
41338                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
41339                 ret_arr_ptr[j] = ret_conv_9_ref;
41340         }
41341         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
41342         FREE(ret_var.data);
41343         return ret_arr;
41344 }
41345
41346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg_a, int64_t arg_b) {
41347         LDKu8slice ser_ref;
41348         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41349         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41350         void* arg_a_ptr = untag_ptr(arg_a);
41351         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
41352         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
41353         void* arg_b_ptr = untag_ptr(arg_b);
41354         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
41355         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
41356         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
41357         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
41358         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41359         return tag_ptr(ret_conv, true);
41360 }
41361
41362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41363         LDKOutPoint this_obj_conv;
41364         this_obj_conv.inner = untag_ptr(this_obj);
41365         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41367         OutPoint_free(this_obj_conv);
41368 }
41369
41370 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
41371         LDKOutPoint this_ptr_conv;
41372         this_ptr_conv.inner = untag_ptr(this_ptr);
41373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41375         this_ptr_conv.is_owned = false;
41376         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
41377         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
41378         return ret_arr;
41379 }
41380
41381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41382         LDKOutPoint this_ptr_conv;
41383         this_ptr_conv.inner = untag_ptr(this_ptr);
41384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41386         this_ptr_conv.is_owned = false;
41387         LDKThirtyTwoBytes val_ref;
41388         CHECK((*env)->GetArrayLength(env, val) == 32);
41389         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
41390         OutPoint_set_txid(&this_ptr_conv, val_ref);
41391 }
41392
41393 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
41394         LDKOutPoint this_ptr_conv;
41395         this_ptr_conv.inner = untag_ptr(this_ptr);
41396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41398         this_ptr_conv.is_owned = false;
41399         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
41400         return ret_conv;
41401 }
41402
41403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
41404         LDKOutPoint this_ptr_conv;
41405         this_ptr_conv.inner = untag_ptr(this_ptr);
41406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41408         this_ptr_conv.is_owned = false;
41409         OutPoint_set_index(&this_ptr_conv, val);
41410 }
41411
41412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
41413         LDKThirtyTwoBytes txid_arg_ref;
41414         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
41415         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
41416         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
41417         int64_t ret_ref = 0;
41418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41420         return ret_ref;
41421 }
41422
41423 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
41424         LDKOutPoint ret_var = OutPoint_clone(arg);
41425         int64_t ret_ref = 0;
41426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41428         return ret_ref;
41429 }
41430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41431         LDKOutPoint arg_conv;
41432         arg_conv.inner = untag_ptr(arg);
41433         arg_conv.is_owned = ptr_is_owned(arg);
41434         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41435         arg_conv.is_owned = false;
41436         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
41437         return ret_conv;
41438 }
41439
41440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41441         LDKOutPoint orig_conv;
41442         orig_conv.inner = untag_ptr(orig);
41443         orig_conv.is_owned = ptr_is_owned(orig);
41444         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41445         orig_conv.is_owned = false;
41446         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
41447         int64_t ret_ref = 0;
41448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41450         return ret_ref;
41451 }
41452
41453 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41454         LDKOutPoint a_conv;
41455         a_conv.inner = untag_ptr(a);
41456         a_conv.is_owned = ptr_is_owned(a);
41457         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41458         a_conv.is_owned = false;
41459         LDKOutPoint b_conv;
41460         b_conv.inner = untag_ptr(b);
41461         b_conv.is_owned = ptr_is_owned(b);
41462         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41463         b_conv.is_owned = false;
41464         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
41465         return ret_conv;
41466 }
41467
41468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
41469         LDKOutPoint o_conv;
41470         o_conv.inner = untag_ptr(o);
41471         o_conv.is_owned = ptr_is_owned(o);
41472         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41473         o_conv.is_owned = false;
41474         int64_t ret_conv = OutPoint_hash(&o_conv);
41475         return ret_conv;
41476 }
41477
41478 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
41479         LDKOutPoint this_arg_conv;
41480         this_arg_conv.inner = untag_ptr(this_arg);
41481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41483         this_arg_conv.is_owned = false;
41484         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
41485         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
41486         return ret_arr;
41487 }
41488
41489 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
41490         LDKOutPoint obj_conv;
41491         obj_conv.inner = untag_ptr(obj);
41492         obj_conv.is_owned = ptr_is_owned(obj);
41493         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41494         obj_conv.is_owned = false;
41495         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
41496         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41497         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41498         CVec_u8Z_free(ret_var);
41499         return ret_arr;
41500 }
41501
41502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41503         LDKu8slice ser_ref;
41504         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41505         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41506         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
41507         *ret_conv = OutPoint_read(ser_ref);
41508         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41509         return tag_ptr(ret_conv, true);
41510 }
41511
41512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41513         LDKInboundHTLCErr this_obj_conv;
41514         this_obj_conv.inner = untag_ptr(this_obj);
41515         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41517         InboundHTLCErr_free(this_obj_conv);
41518 }
41519
41520 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1get_1err_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
41521         LDKInboundHTLCErr this_ptr_conv;
41522         this_ptr_conv.inner = untag_ptr(this_ptr);
41523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41525         this_ptr_conv.is_owned = false;
41526         int16_t ret_conv = InboundHTLCErr_get_err_code(&this_ptr_conv);
41527         return ret_conv;
41528 }
41529
41530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1set_1err_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
41531         LDKInboundHTLCErr this_ptr_conv;
41532         this_ptr_conv.inner = untag_ptr(this_ptr);
41533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41535         this_ptr_conv.is_owned = false;
41536         InboundHTLCErr_set_err_code(&this_ptr_conv, val);
41537 }
41538
41539 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1get_1err_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
41540         LDKInboundHTLCErr this_ptr_conv;
41541         this_ptr_conv.inner = untag_ptr(this_ptr);
41542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41544         this_ptr_conv.is_owned = false;
41545         LDKCVec_u8Z ret_var = InboundHTLCErr_get_err_data(&this_ptr_conv);
41546         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41547         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41548         CVec_u8Z_free(ret_var);
41549         return ret_arr;
41550 }
41551
41552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1set_1err_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41553         LDKInboundHTLCErr this_ptr_conv;
41554         this_ptr_conv.inner = untag_ptr(this_ptr);
41555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41557         this_ptr_conv.is_owned = false;
41558         LDKCVec_u8Z val_ref;
41559         val_ref.datalen = (*env)->GetArrayLength(env, val);
41560         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
41561         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
41562         InboundHTLCErr_set_err_data(&this_ptr_conv, val_ref);
41563 }
41564
41565 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1get_1msg(JNIEnv *env, jclass clz, int64_t this_ptr) {
41566         LDKInboundHTLCErr this_ptr_conv;
41567         this_ptr_conv.inner = untag_ptr(this_ptr);
41568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41570         this_ptr_conv.is_owned = false;
41571         LDKStr ret_str = InboundHTLCErr_get_msg(&this_ptr_conv);
41572         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
41573         Str_free(ret_str);
41574         return ret_conv;
41575 }
41576
41577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1set_1msg(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
41578         LDKInboundHTLCErr this_ptr_conv;
41579         this_ptr_conv.inner = untag_ptr(this_ptr);
41580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41582         this_ptr_conv.is_owned = false;
41583         LDKStr val_conv = java_to_owned_str(env, val);
41584         InboundHTLCErr_set_msg(&this_ptr_conv, val_conv);
41585 }
41586
41587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1new(JNIEnv *env, jclass clz, int16_t err_code_arg, int8_tArray err_data_arg, jstring msg_arg) {
41588         LDKCVec_u8Z err_data_arg_ref;
41589         err_data_arg_ref.datalen = (*env)->GetArrayLength(env, err_data_arg);
41590         err_data_arg_ref.data = MALLOC(err_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
41591         (*env)->GetByteArrayRegion(env, err_data_arg, 0, err_data_arg_ref.datalen, err_data_arg_ref.data);
41592         LDKStr msg_arg_conv = java_to_owned_str(env, msg_arg);
41593         LDKInboundHTLCErr ret_var = InboundHTLCErr_new(err_code_arg, err_data_arg_ref, msg_arg_conv);
41594         int64_t ret_ref = 0;
41595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41597         return ret_ref;
41598 }
41599
41600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_peel_1payment_1onion(JNIEnv *env, jclass clz, int64_t msg, int64_t node_signer, int64_t logger, int32_t cur_height, jboolean accept_mpp_keysend, jboolean allow_skimmed_fees) {
41601         LDKUpdateAddHTLC msg_conv;
41602         msg_conv.inner = untag_ptr(msg);
41603         msg_conv.is_owned = ptr_is_owned(msg);
41604         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41605         msg_conv.is_owned = false;
41606         void* node_signer_ptr = untag_ptr(node_signer);
41607         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
41608         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
41609         void* logger_ptr = untag_ptr(logger);
41610         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
41611         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
41612         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
41613         *ret_conv = peel_payment_onion(&msg_conv, node_signer_conv, logger_conv, cur_height, accept_mpp_keysend, allow_skimmed_fees);
41614         return tag_ptr(ret_conv, true);
41615 }
41616
41617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41618         if (!ptr_is_owned(this_ptr)) return;
41619         void* this_ptr_ptr = untag_ptr(this_ptr);
41620         CHECK_ACCESS(this_ptr_ptr);
41621         LDKPendingHTLCRouting this_ptr_conv = *(LDKPendingHTLCRouting*)(this_ptr_ptr);
41622         FREE(untag_ptr(this_ptr));
41623         PendingHTLCRouting_free(this_ptr_conv);
41624 }
41625
41626 static inline uint64_t PendingHTLCRouting_clone_ptr(LDKPendingHTLCRouting *NONNULL_PTR arg) {
41627         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
41628         *ret_copy = PendingHTLCRouting_clone(arg);
41629         int64_t ret_ref = tag_ptr(ret_copy, true);
41630         return ret_ref;
41631 }
41632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41633         LDKPendingHTLCRouting* arg_conv = (LDKPendingHTLCRouting*)untag_ptr(arg);
41634         int64_t ret_conv = PendingHTLCRouting_clone_ptr(arg_conv);
41635         return ret_conv;
41636 }
41637
41638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41639         LDKPendingHTLCRouting* orig_conv = (LDKPendingHTLCRouting*)untag_ptr(orig);
41640         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
41641         *ret_copy = PendingHTLCRouting_clone(orig_conv);
41642         int64_t ret_ref = tag_ptr(ret_copy, true);
41643         return ret_ref;
41644 }
41645
41646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1forward(JNIEnv *env, jclass clz, int64_t onion_packet, int64_t short_channel_id, int64_t blinded) {
41647         LDKOnionPacket onion_packet_conv;
41648         onion_packet_conv.inner = untag_ptr(onion_packet);
41649         onion_packet_conv.is_owned = ptr_is_owned(onion_packet);
41650         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_conv);
41651         onion_packet_conv = OnionPacket_clone(&onion_packet_conv);
41652         LDKBlindedForward blinded_conv;
41653         blinded_conv.inner = untag_ptr(blinded);
41654         blinded_conv.is_owned = ptr_is_owned(blinded);
41655         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_conv);
41656         blinded_conv = BlindedForward_clone(&blinded_conv);
41657         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
41658         *ret_copy = PendingHTLCRouting_forward(onion_packet_conv, short_channel_id, blinded_conv);
41659         int64_t ret_ref = tag_ptr(ret_copy, true);
41660         return ret_ref;
41661 }
41662
41663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1receive(JNIEnv *env, jclass clz, int64_t payment_data, int64_t payment_metadata, int32_t incoming_cltv_expiry, int8_tArray phantom_shared_secret, int64_tArray custom_tlvs, jboolean requires_blinded_error) {
41664         LDKFinalOnionHopData payment_data_conv;
41665         payment_data_conv.inner = untag_ptr(payment_data);
41666         payment_data_conv.is_owned = ptr_is_owned(payment_data);
41667         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
41668         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
41669         void* payment_metadata_ptr = untag_ptr(payment_metadata);
41670         CHECK_ACCESS(payment_metadata_ptr);
41671         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
41672         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
41673         LDKThirtyTwoBytes phantom_shared_secret_ref;
41674         CHECK((*env)->GetArrayLength(env, phantom_shared_secret) == 32);
41675         (*env)->GetByteArrayRegion(env, phantom_shared_secret, 0, 32, phantom_shared_secret_ref.data);
41676         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
41677         custom_tlvs_constr.datalen = (*env)->GetArrayLength(env, custom_tlvs);
41678         if (custom_tlvs_constr.datalen > 0)
41679                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
41680         else
41681                 custom_tlvs_constr.data = NULL;
41682         int64_t* custom_tlvs_vals = (*env)->GetLongArrayElements (env, custom_tlvs, NULL);
41683         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
41684                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
41685                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
41686                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
41687                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
41688                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
41689                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
41690         }
41691         (*env)->ReleaseLongArrayElements(env, custom_tlvs, custom_tlvs_vals, 0);
41692         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
41693         *ret_copy = PendingHTLCRouting_receive(payment_data_conv, payment_metadata_conv, incoming_cltv_expiry, phantom_shared_secret_ref, custom_tlvs_constr, requires_blinded_error);
41694         int64_t ret_ref = tag_ptr(ret_copy, true);
41695         return ret_ref;
41696 }
41697
41698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1receive_1keysend(JNIEnv *env, jclass clz, int64_t payment_data, int8_tArray payment_preimage, int64_t payment_metadata, int32_t incoming_cltv_expiry, int64_tArray custom_tlvs) {
41699         LDKFinalOnionHopData payment_data_conv;
41700         payment_data_conv.inner = untag_ptr(payment_data);
41701         payment_data_conv.is_owned = ptr_is_owned(payment_data);
41702         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
41703         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
41704         LDKThirtyTwoBytes payment_preimage_ref;
41705         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
41706         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
41707         void* payment_metadata_ptr = untag_ptr(payment_metadata);
41708         CHECK_ACCESS(payment_metadata_ptr);
41709         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
41710         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
41711         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
41712         custom_tlvs_constr.datalen = (*env)->GetArrayLength(env, custom_tlvs);
41713         if (custom_tlvs_constr.datalen > 0)
41714                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
41715         else
41716                 custom_tlvs_constr.data = NULL;
41717         int64_t* custom_tlvs_vals = (*env)->GetLongArrayElements (env, custom_tlvs, NULL);
41718         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
41719                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
41720                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
41721                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
41722                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
41723                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
41724                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
41725         }
41726         (*env)->ReleaseLongArrayElements(env, custom_tlvs, custom_tlvs_vals, 0);
41727         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
41728         *ret_copy = PendingHTLCRouting_receive_keysend(payment_data_conv, payment_preimage_ref, payment_metadata_conv, incoming_cltv_expiry, custom_tlvs_constr);
41729         int64_t ret_ref = tag_ptr(ret_copy, true);
41730         return ret_ref;
41731 }
41732
41733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedForward_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41734         LDKBlindedForward this_obj_conv;
41735         this_obj_conv.inner = untag_ptr(this_obj);
41736         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41738         BlindedForward_free(this_obj_conv);
41739 }
41740
41741 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedForward_1get_1inbound_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
41742         LDKBlindedForward this_ptr_conv;
41743         this_ptr_conv.inner = untag_ptr(this_ptr);
41744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41746         this_ptr_conv.is_owned = false;
41747         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41748         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedForward_get_inbound_blinding_point(&this_ptr_conv).compressed_form);
41749         return ret_arr;
41750 }
41751
41752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedForward_1set_1inbound_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41753         LDKBlindedForward this_ptr_conv;
41754         this_ptr_conv.inner = untag_ptr(this_ptr);
41755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41757         this_ptr_conv.is_owned = false;
41758         LDKPublicKey val_ref;
41759         CHECK((*env)->GetArrayLength(env, val) == 33);
41760         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41761         BlindedForward_set_inbound_blinding_point(&this_ptr_conv, val_ref);
41762 }
41763
41764 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_BlindedForward_1get_1failure(JNIEnv *env, jclass clz, int64_t this_ptr) {
41765         LDKBlindedForward this_ptr_conv;
41766         this_ptr_conv.inner = untag_ptr(this_ptr);
41767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41769         this_ptr_conv.is_owned = false;
41770         jclass ret_conv = LDKBlindedFailure_to_java(env, BlindedForward_get_failure(&this_ptr_conv));
41771         return ret_conv;
41772 }
41773
41774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedForward_1set_1failure(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
41775         LDKBlindedForward this_ptr_conv;
41776         this_ptr_conv.inner = untag_ptr(this_ptr);
41777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41779         this_ptr_conv.is_owned = false;
41780         LDKBlindedFailure val_conv = LDKBlindedFailure_from_java(env, val);
41781         BlindedForward_set_failure(&this_ptr_conv, val_conv);
41782 }
41783
41784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1new(JNIEnv *env, jclass clz, int8_tArray inbound_blinding_point_arg, jclass failure_arg) {
41785         LDKPublicKey inbound_blinding_point_arg_ref;
41786         CHECK((*env)->GetArrayLength(env, inbound_blinding_point_arg) == 33);
41787         (*env)->GetByteArrayRegion(env, inbound_blinding_point_arg, 0, 33, inbound_blinding_point_arg_ref.compressed_form);
41788         LDKBlindedFailure failure_arg_conv = LDKBlindedFailure_from_java(env, failure_arg);
41789         LDKBlindedForward ret_var = BlindedForward_new(inbound_blinding_point_arg_ref, failure_arg_conv);
41790         int64_t ret_ref = 0;
41791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41793         return ret_ref;
41794 }
41795
41796 static inline uint64_t BlindedForward_clone_ptr(LDKBlindedForward *NONNULL_PTR arg) {
41797         LDKBlindedForward ret_var = BlindedForward_clone(arg);
41798         int64_t ret_ref = 0;
41799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41801         return ret_ref;
41802 }
41803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41804         LDKBlindedForward arg_conv;
41805         arg_conv.inner = untag_ptr(arg);
41806         arg_conv.is_owned = ptr_is_owned(arg);
41807         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41808         arg_conv.is_owned = false;
41809         int64_t ret_conv = BlindedForward_clone_ptr(&arg_conv);
41810         return ret_conv;
41811 }
41812
41813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41814         LDKBlindedForward orig_conv;
41815         orig_conv.inner = untag_ptr(orig);
41816         orig_conv.is_owned = ptr_is_owned(orig);
41817         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41818         orig_conv.is_owned = false;
41819         LDKBlindedForward ret_var = BlindedForward_clone(&orig_conv);
41820         int64_t ret_ref = 0;
41821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41823         return ret_ref;
41824 }
41825
41826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1hash(JNIEnv *env, jclass clz, int64_t o) {
41827         LDKBlindedForward o_conv;
41828         o_conv.inner = untag_ptr(o);
41829         o_conv.is_owned = ptr_is_owned(o);
41830         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41831         o_conv.is_owned = false;
41832         int64_t ret_conv = BlindedForward_hash(&o_conv);
41833         return ret_conv;
41834 }
41835
41836 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedForward_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41837         LDKBlindedForward a_conv;
41838         a_conv.inner = untag_ptr(a);
41839         a_conv.is_owned = ptr_is_owned(a);
41840         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41841         a_conv.is_owned = false;
41842         LDKBlindedForward b_conv;
41843         b_conv.inner = untag_ptr(b);
41844         b_conv.is_owned = ptr_is_owned(b);
41845         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41846         b_conv.is_owned = false;
41847         jboolean ret_conv = BlindedForward_eq(&a_conv, &b_conv);
41848         return ret_conv;
41849 }
41850
41851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41852         LDKPendingHTLCInfo this_obj_conv;
41853         this_obj_conv.inner = untag_ptr(this_obj);
41854         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41856         PendingHTLCInfo_free(this_obj_conv);
41857 }
41858
41859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1routing(JNIEnv *env, jclass clz, int64_t this_ptr) {
41860         LDKPendingHTLCInfo this_ptr_conv;
41861         this_ptr_conv.inner = untag_ptr(this_ptr);
41862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41864         this_ptr_conv.is_owned = false;
41865         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
41866         *ret_copy = PendingHTLCInfo_get_routing(&this_ptr_conv);
41867         int64_t ret_ref = tag_ptr(ret_copy, true);
41868         return ret_ref;
41869 }
41870
41871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1routing(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41872         LDKPendingHTLCInfo this_ptr_conv;
41873         this_ptr_conv.inner = untag_ptr(this_ptr);
41874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41876         this_ptr_conv.is_owned = false;
41877         void* val_ptr = untag_ptr(val);
41878         CHECK_ACCESS(val_ptr);
41879         LDKPendingHTLCRouting val_conv = *(LDKPendingHTLCRouting*)(val_ptr);
41880         val_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(val));
41881         PendingHTLCInfo_set_routing(&this_ptr_conv, val_conv);
41882 }
41883
41884 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1incoming_1shared_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
41885         LDKPendingHTLCInfo this_ptr_conv;
41886         this_ptr_conv.inner = untag_ptr(this_ptr);
41887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41889         this_ptr_conv.is_owned = false;
41890         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
41891         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *PendingHTLCInfo_get_incoming_shared_secret(&this_ptr_conv));
41892         return ret_arr;
41893 }
41894
41895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1incoming_1shared_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41896         LDKPendingHTLCInfo this_ptr_conv;
41897         this_ptr_conv.inner = untag_ptr(this_ptr);
41898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41900         this_ptr_conv.is_owned = false;
41901         LDKThirtyTwoBytes val_ref;
41902         CHECK((*env)->GetArrayLength(env, val) == 32);
41903         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
41904         PendingHTLCInfo_set_incoming_shared_secret(&this_ptr_conv, val_ref);
41905 }
41906
41907 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
41908         LDKPendingHTLCInfo this_ptr_conv;
41909         this_ptr_conv.inner = untag_ptr(this_ptr);
41910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41912         this_ptr_conv.is_owned = false;
41913         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
41914         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *PendingHTLCInfo_get_payment_hash(&this_ptr_conv));
41915         return ret_arr;
41916 }
41917
41918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41919         LDKPendingHTLCInfo this_ptr_conv;
41920         this_ptr_conv.inner = untag_ptr(this_ptr);
41921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41923         this_ptr_conv.is_owned = false;
41924         LDKThirtyTwoBytes val_ref;
41925         CHECK((*env)->GetArrayLength(env, val) == 32);
41926         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
41927         PendingHTLCInfo_set_payment_hash(&this_ptr_conv, val_ref);
41928 }
41929
41930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1incoming_1amt_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41931         LDKPendingHTLCInfo this_ptr_conv;
41932         this_ptr_conv.inner = untag_ptr(this_ptr);
41933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41935         this_ptr_conv.is_owned = false;
41936         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41937         *ret_copy = PendingHTLCInfo_get_incoming_amt_msat(&this_ptr_conv);
41938         int64_t ret_ref = tag_ptr(ret_copy, true);
41939         return ret_ref;
41940 }
41941
41942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1incoming_1amt_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41943         LDKPendingHTLCInfo this_ptr_conv;
41944         this_ptr_conv.inner = untag_ptr(this_ptr);
41945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41947         this_ptr_conv.is_owned = false;
41948         void* val_ptr = untag_ptr(val);
41949         CHECK_ACCESS(val_ptr);
41950         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41951         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41952         PendingHTLCInfo_set_incoming_amt_msat(&this_ptr_conv, val_conv);
41953 }
41954
41955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1outgoing_1amt_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41956         LDKPendingHTLCInfo this_ptr_conv;
41957         this_ptr_conv.inner = untag_ptr(this_ptr);
41958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41960         this_ptr_conv.is_owned = false;
41961         int64_t ret_conv = PendingHTLCInfo_get_outgoing_amt_msat(&this_ptr_conv);
41962         return ret_conv;
41963 }
41964
41965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1outgoing_1amt_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41966         LDKPendingHTLCInfo this_ptr_conv;
41967         this_ptr_conv.inner = untag_ptr(this_ptr);
41968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41970         this_ptr_conv.is_owned = false;
41971         PendingHTLCInfo_set_outgoing_amt_msat(&this_ptr_conv, val);
41972 }
41973
41974 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1outgoing_1cltv_1value(JNIEnv *env, jclass clz, int64_t this_ptr) {
41975         LDKPendingHTLCInfo this_ptr_conv;
41976         this_ptr_conv.inner = untag_ptr(this_ptr);
41977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41979         this_ptr_conv.is_owned = false;
41980         int32_t ret_conv = PendingHTLCInfo_get_outgoing_cltv_value(&this_ptr_conv);
41981         return ret_conv;
41982 }
41983
41984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1outgoing_1cltv_1value(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
41985         LDKPendingHTLCInfo this_ptr_conv;
41986         this_ptr_conv.inner = untag_ptr(this_ptr);
41987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41989         this_ptr_conv.is_owned = false;
41990         PendingHTLCInfo_set_outgoing_cltv_value(&this_ptr_conv, val);
41991 }
41992
41993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41994         LDKPendingHTLCInfo this_ptr_conv;
41995         this_ptr_conv.inner = untag_ptr(this_ptr);
41996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41998         this_ptr_conv.is_owned = false;
41999         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42000         *ret_copy = PendingHTLCInfo_get_skimmed_fee_msat(&this_ptr_conv);
42001         int64_t ret_ref = tag_ptr(ret_copy, true);
42002         return ret_ref;
42003 }
42004
42005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42006         LDKPendingHTLCInfo this_ptr_conv;
42007         this_ptr_conv.inner = untag_ptr(this_ptr);
42008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42010         this_ptr_conv.is_owned = false;
42011         void* val_ptr = untag_ptr(val);
42012         CHECK_ACCESS(val_ptr);
42013         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42014         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42015         PendingHTLCInfo_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
42016 }
42017
42018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1new(JNIEnv *env, jclass clz, int64_t routing_arg, int8_tArray incoming_shared_secret_arg, int8_tArray payment_hash_arg, int64_t incoming_amt_msat_arg, int64_t outgoing_amt_msat_arg, int32_t outgoing_cltv_value_arg, int64_t skimmed_fee_msat_arg) {
42019         void* routing_arg_ptr = untag_ptr(routing_arg);
42020         CHECK_ACCESS(routing_arg_ptr);
42021         LDKPendingHTLCRouting routing_arg_conv = *(LDKPendingHTLCRouting*)(routing_arg_ptr);
42022         routing_arg_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(routing_arg));
42023         LDKThirtyTwoBytes incoming_shared_secret_arg_ref;
42024         CHECK((*env)->GetArrayLength(env, incoming_shared_secret_arg) == 32);
42025         (*env)->GetByteArrayRegion(env, incoming_shared_secret_arg, 0, 32, incoming_shared_secret_arg_ref.data);
42026         LDKThirtyTwoBytes payment_hash_arg_ref;
42027         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
42028         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
42029         void* incoming_amt_msat_arg_ptr = untag_ptr(incoming_amt_msat_arg);
42030         CHECK_ACCESS(incoming_amt_msat_arg_ptr);
42031         LDKCOption_u64Z incoming_amt_msat_arg_conv = *(LDKCOption_u64Z*)(incoming_amt_msat_arg_ptr);
42032         incoming_amt_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(incoming_amt_msat_arg));
42033         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
42034         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
42035         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
42036         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
42037         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_new(routing_arg_conv, incoming_shared_secret_arg_ref, payment_hash_arg_ref, incoming_amt_msat_arg_conv, outgoing_amt_msat_arg, outgoing_cltv_value_arg, skimmed_fee_msat_arg_conv);
42038         int64_t ret_ref = 0;
42039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42041         return ret_ref;
42042 }
42043
42044 static inline uint64_t PendingHTLCInfo_clone_ptr(LDKPendingHTLCInfo *NONNULL_PTR arg) {
42045         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(arg);
42046         int64_t ret_ref = 0;
42047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42049         return ret_ref;
42050 }
42051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42052         LDKPendingHTLCInfo arg_conv;
42053         arg_conv.inner = untag_ptr(arg);
42054         arg_conv.is_owned = ptr_is_owned(arg);
42055         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42056         arg_conv.is_owned = false;
42057         int64_t ret_conv = PendingHTLCInfo_clone_ptr(&arg_conv);
42058         return ret_conv;
42059 }
42060
42061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42062         LDKPendingHTLCInfo orig_conv;
42063         orig_conv.inner = untag_ptr(orig);
42064         orig_conv.is_owned = ptr_is_owned(orig);
42065         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42066         orig_conv.is_owned = false;
42067         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(&orig_conv);
42068         int64_t ret_ref = 0;
42069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42071         return ret_ref;
42072 }
42073
42074 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42075         LDKBlindedFailure* orig_conv = (LDKBlindedFailure*)untag_ptr(orig);
42076         jclass ret_conv = LDKBlindedFailure_to_java(env, BlindedFailure_clone(orig_conv));
42077         return ret_conv;
42078 }
42079
42080 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1from_1introduction_1node(JNIEnv *env, jclass clz) {
42081         jclass ret_conv = LDKBlindedFailure_to_java(env, BlindedFailure_from_introduction_node());
42082         return ret_conv;
42083 }
42084
42085 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1from_1blinded_1node(JNIEnv *env, jclass clz) {
42086         jclass ret_conv = LDKBlindedFailure_to_java(env, BlindedFailure_from_blinded_node());
42087         return ret_conv;
42088 }
42089
42090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1hash(JNIEnv *env, jclass clz, int64_t o) {
42091         LDKBlindedFailure* o_conv = (LDKBlindedFailure*)untag_ptr(o);
42092         int64_t ret_conv = BlindedFailure_hash(o_conv);
42093         return ret_conv;
42094 }
42095
42096 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42097         LDKBlindedFailure* a_conv = (LDKBlindedFailure*)untag_ptr(a);
42098         LDKBlindedFailure* b_conv = (LDKBlindedFailure*)untag_ptr(b);
42099         jboolean ret_conv = BlindedFailure_eq(a_conv, b_conv);
42100         return ret_conv;
42101 }
42102
42103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FailureCode_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42104         if (!ptr_is_owned(this_ptr)) return;
42105         void* this_ptr_ptr = untag_ptr(this_ptr);
42106         CHECK_ACCESS(this_ptr_ptr);
42107         LDKFailureCode this_ptr_conv = *(LDKFailureCode*)(this_ptr_ptr);
42108         FREE(untag_ptr(this_ptr));
42109         FailureCode_free(this_ptr_conv);
42110 }
42111
42112 static inline uint64_t FailureCode_clone_ptr(LDKFailureCode *NONNULL_PTR arg) {
42113         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
42114         *ret_copy = FailureCode_clone(arg);
42115         int64_t ret_ref = tag_ptr(ret_copy, true);
42116         return ret_ref;
42117 }
42118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42119         LDKFailureCode* arg_conv = (LDKFailureCode*)untag_ptr(arg);
42120         int64_t ret_conv = FailureCode_clone_ptr(arg_conv);
42121         return ret_conv;
42122 }
42123
42124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42125         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
42126         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
42127         *ret_copy = FailureCode_clone(orig_conv);
42128         int64_t ret_ref = tag_ptr(ret_copy, true);
42129         return ret_ref;
42130 }
42131
42132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1temporary_1node_1failure(JNIEnv *env, jclass clz) {
42133         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
42134         *ret_copy = FailureCode_temporary_node_failure();
42135         int64_t ret_ref = tag_ptr(ret_copy, true);
42136         return ret_ref;
42137 }
42138
42139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1required_1node_1feature_1missing(JNIEnv *env, jclass clz) {
42140         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
42141         *ret_copy = FailureCode_required_node_feature_missing();
42142         int64_t ret_ref = tag_ptr(ret_copy, true);
42143         return ret_ref;
42144 }
42145
42146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1incorrect_1or_1unknown_1payment_1details(JNIEnv *env, jclass clz) {
42147         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
42148         *ret_copy = FailureCode_incorrect_or_unknown_payment_details();
42149         int64_t ret_ref = tag_ptr(ret_copy, true);
42150         return ret_ref;
42151 }
42152
42153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1invalid_1onion_1payload(JNIEnv *env, jclass clz, int64_t a) {
42154         void* a_ptr = untag_ptr(a);
42155         CHECK_ACCESS(a_ptr);
42156         LDKCOption_C2Tuple_u64u16ZZ a_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(a_ptr);
42157         a_conv = COption_C2Tuple_u64u16ZZ_clone((LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(a));
42158         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
42159         *ret_copy = FailureCode_invalid_onion_payload(a_conv);
42160         int64_t ret_ref = tag_ptr(ret_copy, true);
42161         return ret_ref;
42162 }
42163
42164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42165         LDKChannelManager this_obj_conv;
42166         this_obj_conv.inner = untag_ptr(this_obj);
42167         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42169         ChannelManager_free(this_obj_conv);
42170 }
42171
42172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42173         LDKChainParameters this_obj_conv;
42174         this_obj_conv.inner = untag_ptr(this_obj);
42175         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42177         ChainParameters_free(this_obj_conv);
42178 }
42179
42180 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
42181         LDKChainParameters this_ptr_conv;
42182         this_ptr_conv.inner = untag_ptr(this_ptr);
42183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42185         this_ptr_conv.is_owned = false;
42186         jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
42187         return ret_conv;
42188 }
42189
42190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
42191         LDKChainParameters this_ptr_conv;
42192         this_ptr_conv.inner = untag_ptr(this_ptr);
42193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42195         this_ptr_conv.is_owned = false;
42196         LDKNetwork val_conv = LDKNetwork_from_java(env, val);
42197         ChainParameters_set_network(&this_ptr_conv, val_conv);
42198 }
42199
42200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
42201         LDKChainParameters this_ptr_conv;
42202         this_ptr_conv.inner = untag_ptr(this_ptr);
42203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42205         this_ptr_conv.is_owned = false;
42206         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
42207         int64_t ret_ref = 0;
42208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42210         return ret_ref;
42211 }
42212
42213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42214         LDKChainParameters this_ptr_conv;
42215         this_ptr_conv.inner = untag_ptr(this_ptr);
42216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42218         this_ptr_conv.is_owned = false;
42219         LDKBestBlock val_conv;
42220         val_conv.inner = untag_ptr(val);
42221         val_conv.is_owned = ptr_is_owned(val);
42222         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42223         val_conv = BestBlock_clone(&val_conv);
42224         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
42225 }
42226
42227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
42228         LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
42229         LDKBestBlock best_block_arg_conv;
42230         best_block_arg_conv.inner = untag_ptr(best_block_arg);
42231         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
42232         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
42233         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
42234         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
42235         int64_t ret_ref = 0;
42236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42238         return ret_ref;
42239 }
42240
42241 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
42242         LDKChainParameters ret_var = ChainParameters_clone(arg);
42243         int64_t ret_ref = 0;
42244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42246         return ret_ref;
42247 }
42248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42249         LDKChainParameters arg_conv;
42250         arg_conv.inner = untag_ptr(arg);
42251         arg_conv.is_owned = ptr_is_owned(arg);
42252         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42253         arg_conv.is_owned = false;
42254         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
42255         return ret_conv;
42256 }
42257
42258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42259         LDKChainParameters orig_conv;
42260         orig_conv.inner = untag_ptr(orig);
42261         orig_conv.is_owned = ptr_is_owned(orig);
42262         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42263         orig_conv.is_owned = false;
42264         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
42265         int64_t ret_ref = 0;
42266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42268         return ret_ref;
42269 }
42270
42271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42272         LDKCounterpartyForwardingInfo this_obj_conv;
42273         this_obj_conv.inner = untag_ptr(this_obj);
42274         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42276         CounterpartyForwardingInfo_free(this_obj_conv);
42277 }
42278
42279 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42280         LDKCounterpartyForwardingInfo this_ptr_conv;
42281         this_ptr_conv.inner = untag_ptr(this_ptr);
42282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42284         this_ptr_conv.is_owned = false;
42285         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
42286         return ret_conv;
42287 }
42288
42289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42290         LDKCounterpartyForwardingInfo this_ptr_conv;
42291         this_ptr_conv.inner = untag_ptr(this_ptr);
42292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42294         this_ptr_conv.is_owned = false;
42295         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
42296 }
42297
42298 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
42299         LDKCounterpartyForwardingInfo this_ptr_conv;
42300         this_ptr_conv.inner = untag_ptr(this_ptr);
42301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42303         this_ptr_conv.is_owned = false;
42304         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
42305         return ret_conv;
42306 }
42307
42308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42309         LDKCounterpartyForwardingInfo this_ptr_conv;
42310         this_ptr_conv.inner = untag_ptr(this_ptr);
42311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42313         this_ptr_conv.is_owned = false;
42314         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
42315 }
42316
42317 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
42318         LDKCounterpartyForwardingInfo this_ptr_conv;
42319         this_ptr_conv.inner = untag_ptr(this_ptr);
42320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42322         this_ptr_conv.is_owned = false;
42323         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
42324         return ret_conv;
42325 }
42326
42327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42328         LDKCounterpartyForwardingInfo this_ptr_conv;
42329         this_ptr_conv.inner = untag_ptr(this_ptr);
42330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42332         this_ptr_conv.is_owned = false;
42333         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
42334 }
42335
42336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1new(JNIEnv *env, jclass clz, int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg) {
42337         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
42338         int64_t ret_ref = 0;
42339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42341         return ret_ref;
42342 }
42343
42344 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
42345         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
42346         int64_t ret_ref = 0;
42347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42349         return ret_ref;
42350 }
42351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42352         LDKCounterpartyForwardingInfo arg_conv;
42353         arg_conv.inner = untag_ptr(arg);
42354         arg_conv.is_owned = ptr_is_owned(arg);
42355         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42356         arg_conv.is_owned = false;
42357         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
42358         return ret_conv;
42359 }
42360
42361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42362         LDKCounterpartyForwardingInfo orig_conv;
42363         orig_conv.inner = untag_ptr(orig);
42364         orig_conv.is_owned = ptr_is_owned(orig);
42365         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42366         orig_conv.is_owned = false;
42367         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
42368         int64_t ret_ref = 0;
42369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42371         return ret_ref;
42372 }
42373
42374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42375         LDKChannelCounterparty this_obj_conv;
42376         this_obj_conv.inner = untag_ptr(this_obj);
42377         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42379         ChannelCounterparty_free(this_obj_conv);
42380 }
42381
42382 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42383         LDKChannelCounterparty this_ptr_conv;
42384         this_ptr_conv.inner = untag_ptr(this_ptr);
42385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42387         this_ptr_conv.is_owned = false;
42388         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42389         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
42390         return ret_arr;
42391 }
42392
42393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42394         LDKChannelCounterparty this_ptr_conv;
42395         this_ptr_conv.inner = untag_ptr(this_ptr);
42396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42398         this_ptr_conv.is_owned = false;
42399         LDKPublicKey val_ref;
42400         CHECK((*env)->GetArrayLength(env, val) == 33);
42401         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42402         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
42403 }
42404
42405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
42406         LDKChannelCounterparty this_ptr_conv;
42407         this_ptr_conv.inner = untag_ptr(this_ptr);
42408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42410         this_ptr_conv.is_owned = false;
42411         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
42412         int64_t ret_ref = 0;
42413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42415         return ret_ref;
42416 }
42417
42418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42419         LDKChannelCounterparty this_ptr_conv;
42420         this_ptr_conv.inner = untag_ptr(this_ptr);
42421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42423         this_ptr_conv.is_owned = false;
42424         LDKInitFeatures val_conv;
42425         val_conv.inner = untag_ptr(val);
42426         val_conv.is_owned = ptr_is_owned(val);
42427         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42428         val_conv = InitFeatures_clone(&val_conv);
42429         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
42430 }
42431
42432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
42433         LDKChannelCounterparty this_ptr_conv;
42434         this_ptr_conv.inner = untag_ptr(this_ptr);
42435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42437         this_ptr_conv.is_owned = false;
42438         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
42439         return ret_conv;
42440 }
42441
42442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42443         LDKChannelCounterparty this_ptr_conv;
42444         this_ptr_conv.inner = untag_ptr(this_ptr);
42445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42447         this_ptr_conv.is_owned = false;
42448         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
42449 }
42450
42451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
42452         LDKChannelCounterparty this_ptr_conv;
42453         this_ptr_conv.inner = untag_ptr(this_ptr);
42454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42456         this_ptr_conv.is_owned = false;
42457         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
42458         int64_t ret_ref = 0;
42459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42461         return ret_ref;
42462 }
42463
42464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42465         LDKChannelCounterparty this_ptr_conv;
42466         this_ptr_conv.inner = untag_ptr(this_ptr);
42467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42469         this_ptr_conv.is_owned = false;
42470         LDKCounterpartyForwardingInfo val_conv;
42471         val_conv.inner = untag_ptr(val);
42472         val_conv.is_owned = ptr_is_owned(val);
42473         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42474         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
42475         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
42476 }
42477
42478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42479         LDKChannelCounterparty this_ptr_conv;
42480         this_ptr_conv.inner = untag_ptr(this_ptr);
42481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42483         this_ptr_conv.is_owned = false;
42484         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42485         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
42486         int64_t ret_ref = tag_ptr(ret_copy, true);
42487         return ret_ref;
42488 }
42489
42490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42491         LDKChannelCounterparty this_ptr_conv;
42492         this_ptr_conv.inner = untag_ptr(this_ptr);
42493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42495         this_ptr_conv.is_owned = false;
42496         void* val_ptr = untag_ptr(val);
42497         CHECK_ACCESS(val_ptr);
42498         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42499         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42500         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
42501 }
42502
42503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42504         LDKChannelCounterparty this_ptr_conv;
42505         this_ptr_conv.inner = untag_ptr(this_ptr);
42506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42508         this_ptr_conv.is_owned = false;
42509         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42510         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
42511         int64_t ret_ref = tag_ptr(ret_copy, true);
42512         return ret_ref;
42513 }
42514
42515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42516         LDKChannelCounterparty this_ptr_conv;
42517         this_ptr_conv.inner = untag_ptr(this_ptr);
42518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42520         this_ptr_conv.is_owned = false;
42521         void* val_ptr = untag_ptr(val);
42522         CHECK_ACCESS(val_ptr);
42523         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42524         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42525         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
42526 }
42527
42528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1new(JNIEnv *env, jclass clz, int8_tArray node_id_arg, int64_t features_arg, int64_t unspendable_punishment_reserve_arg, int64_t forwarding_info_arg, int64_t outbound_htlc_minimum_msat_arg, int64_t outbound_htlc_maximum_msat_arg) {
42529         LDKPublicKey node_id_arg_ref;
42530         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
42531         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
42532         LDKInitFeatures features_arg_conv;
42533         features_arg_conv.inner = untag_ptr(features_arg);
42534         features_arg_conv.is_owned = ptr_is_owned(features_arg);
42535         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
42536         features_arg_conv = InitFeatures_clone(&features_arg_conv);
42537         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
42538         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
42539         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
42540         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
42541         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
42542         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
42543         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
42544         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
42545         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
42546         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
42547         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
42548         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
42549         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
42550         LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv, outbound_htlc_minimum_msat_arg_conv, outbound_htlc_maximum_msat_arg_conv);
42551         int64_t ret_ref = 0;
42552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42554         return ret_ref;
42555 }
42556
42557 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
42558         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
42559         int64_t ret_ref = 0;
42560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42562         return ret_ref;
42563 }
42564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42565         LDKChannelCounterparty arg_conv;
42566         arg_conv.inner = untag_ptr(arg);
42567         arg_conv.is_owned = ptr_is_owned(arg);
42568         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42569         arg_conv.is_owned = false;
42570         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
42571         return ret_conv;
42572 }
42573
42574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42575         LDKChannelCounterparty orig_conv;
42576         orig_conv.inner = untag_ptr(orig);
42577         orig_conv.is_owned = ptr_is_owned(orig);
42578         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42579         orig_conv.is_owned = false;
42580         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
42581         int64_t ret_ref = 0;
42582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42584         return ret_ref;
42585 }
42586
42587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42588         LDKChannelDetails this_obj_conv;
42589         this_obj_conv.inner = untag_ptr(this_obj);
42590         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42592         ChannelDetails_free(this_obj_conv);
42593 }
42594
42595 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42596         LDKChannelDetails this_ptr_conv;
42597         this_ptr_conv.inner = untag_ptr(this_ptr);
42598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42600         this_ptr_conv.is_owned = false;
42601         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42602         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
42603         return ret_arr;
42604 }
42605
42606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42607         LDKChannelDetails this_ptr_conv;
42608         this_ptr_conv.inner = untag_ptr(this_ptr);
42609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42611         this_ptr_conv.is_owned = false;
42612         LDKThirtyTwoBytes val_ref;
42613         CHECK((*env)->GetArrayLength(env, val) == 32);
42614         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42615         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
42616 }
42617
42618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
42619         LDKChannelDetails this_ptr_conv;
42620         this_ptr_conv.inner = untag_ptr(this_ptr);
42621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42623         this_ptr_conv.is_owned = false;
42624         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
42625         int64_t ret_ref = 0;
42626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42628         return ret_ref;
42629 }
42630
42631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42632         LDKChannelDetails this_ptr_conv;
42633         this_ptr_conv.inner = untag_ptr(this_ptr);
42634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42636         this_ptr_conv.is_owned = false;
42637         LDKChannelCounterparty val_conv;
42638         val_conv.inner = untag_ptr(val);
42639         val_conv.is_owned = ptr_is_owned(val);
42640         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42641         val_conv = ChannelCounterparty_clone(&val_conv);
42642         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
42643 }
42644
42645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
42646         LDKChannelDetails this_ptr_conv;
42647         this_ptr_conv.inner = untag_ptr(this_ptr);
42648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42650         this_ptr_conv.is_owned = false;
42651         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
42652         int64_t ret_ref = 0;
42653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42655         return ret_ref;
42656 }
42657
42658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42659         LDKChannelDetails this_ptr_conv;
42660         this_ptr_conv.inner = untag_ptr(this_ptr);
42661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42663         this_ptr_conv.is_owned = false;
42664         LDKOutPoint val_conv;
42665         val_conv.inner = untag_ptr(val);
42666         val_conv.is_owned = ptr_is_owned(val);
42667         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42668         val_conv = OutPoint_clone(&val_conv);
42669         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
42670 }
42671
42672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
42673         LDKChannelDetails this_ptr_conv;
42674         this_ptr_conv.inner = untag_ptr(this_ptr);
42675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42677         this_ptr_conv.is_owned = false;
42678         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
42679         int64_t ret_ref = 0;
42680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42682         return ret_ref;
42683 }
42684
42685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42686         LDKChannelDetails this_ptr_conv;
42687         this_ptr_conv.inner = untag_ptr(this_ptr);
42688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42690         this_ptr_conv.is_owned = false;
42691         LDKChannelTypeFeatures val_conv;
42692         val_conv.inner = untag_ptr(val);
42693         val_conv.is_owned = ptr_is_owned(val);
42694         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42695         val_conv = ChannelTypeFeatures_clone(&val_conv);
42696         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
42697 }
42698
42699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42700         LDKChannelDetails this_ptr_conv;
42701         this_ptr_conv.inner = untag_ptr(this_ptr);
42702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42704         this_ptr_conv.is_owned = false;
42705         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42706         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
42707         int64_t ret_ref = tag_ptr(ret_copy, true);
42708         return ret_ref;
42709 }
42710
42711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42712         LDKChannelDetails this_ptr_conv;
42713         this_ptr_conv.inner = untag_ptr(this_ptr);
42714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42716         this_ptr_conv.is_owned = false;
42717         void* val_ptr = untag_ptr(val);
42718         CHECK_ACCESS(val_ptr);
42719         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42720         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42721         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
42722 }
42723
42724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
42725         LDKChannelDetails this_ptr_conv;
42726         this_ptr_conv.inner = untag_ptr(this_ptr);
42727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42729         this_ptr_conv.is_owned = false;
42730         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42731         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
42732         int64_t ret_ref = tag_ptr(ret_copy, true);
42733         return ret_ref;
42734 }
42735
42736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42737         LDKChannelDetails this_ptr_conv;
42738         this_ptr_conv.inner = untag_ptr(this_ptr);
42739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42741         this_ptr_conv.is_owned = false;
42742         void* val_ptr = untag_ptr(val);
42743         CHECK_ACCESS(val_ptr);
42744         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42745         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42746         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
42747 }
42748
42749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
42750         LDKChannelDetails this_ptr_conv;
42751         this_ptr_conv.inner = untag_ptr(this_ptr);
42752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42754         this_ptr_conv.is_owned = false;
42755         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42756         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
42757         int64_t ret_ref = tag_ptr(ret_copy, true);
42758         return ret_ref;
42759 }
42760
42761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42762         LDKChannelDetails this_ptr_conv;
42763         this_ptr_conv.inner = untag_ptr(this_ptr);
42764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42766         this_ptr_conv.is_owned = false;
42767         void* val_ptr = untag_ptr(val);
42768         CHECK_ACCESS(val_ptr);
42769         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42770         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42771         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
42772 }
42773
42774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42775         LDKChannelDetails this_ptr_conv;
42776         this_ptr_conv.inner = untag_ptr(this_ptr);
42777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42779         this_ptr_conv.is_owned = false;
42780         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
42781         return ret_conv;
42782 }
42783
42784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42785         LDKChannelDetails this_ptr_conv;
42786         this_ptr_conv.inner = untag_ptr(this_ptr);
42787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42789         this_ptr_conv.is_owned = false;
42790         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
42791 }
42792
42793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
42794         LDKChannelDetails this_ptr_conv;
42795         this_ptr_conv.inner = untag_ptr(this_ptr);
42796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42798         this_ptr_conv.is_owned = false;
42799         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42800         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
42801         int64_t ret_ref = tag_ptr(ret_copy, true);
42802         return ret_ref;
42803 }
42804
42805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42806         LDKChannelDetails this_ptr_conv;
42807         this_ptr_conv.inner = untag_ptr(this_ptr);
42808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42810         this_ptr_conv.is_owned = false;
42811         void* val_ptr = untag_ptr(val);
42812         CHECK_ACCESS(val_ptr);
42813         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42814         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42815         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
42816 }
42817
42818 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42819         LDKChannelDetails this_ptr_conv;
42820         this_ptr_conv.inner = untag_ptr(this_ptr);
42821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42823         this_ptr_conv.is_owned = false;
42824         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
42825         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes);
42826         return ret_arr;
42827 }
42828
42829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42830         LDKChannelDetails this_ptr_conv;
42831         this_ptr_conv.inner = untag_ptr(this_ptr);
42832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42834         this_ptr_conv.is_owned = false;
42835         LDKU128 val_ref;
42836         CHECK((*env)->GetArrayLength(env, val) == 16);
42837         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
42838         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
42839 }
42840
42841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
42842         LDKChannelDetails this_ptr_conv;
42843         this_ptr_conv.inner = untag_ptr(this_ptr);
42844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42846         this_ptr_conv.is_owned = false;
42847         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
42848         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
42849         int64_t ret_ref = tag_ptr(ret_copy, true);
42850         return ret_ref;
42851 }
42852
42853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42854         LDKChannelDetails this_ptr_conv;
42855         this_ptr_conv.inner = untag_ptr(this_ptr);
42856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42858         this_ptr_conv.is_owned = false;
42859         void* val_ptr = untag_ptr(val);
42860         CHECK_ACCESS(val_ptr);
42861         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
42862         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
42863         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
42864 }
42865
42866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42867         LDKChannelDetails this_ptr_conv;
42868         this_ptr_conv.inner = untag_ptr(this_ptr);
42869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42871         this_ptr_conv.is_owned = false;
42872         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
42873         return ret_conv;
42874 }
42875
42876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42877         LDKChannelDetails this_ptr_conv;
42878         this_ptr_conv.inner = untag_ptr(this_ptr);
42879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42881         this_ptr_conv.is_owned = false;
42882         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
42883 }
42884
42885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42886         LDKChannelDetails this_ptr_conv;
42887         this_ptr_conv.inner = untag_ptr(this_ptr);
42888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42890         this_ptr_conv.is_owned = false;
42891         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
42892         return ret_conv;
42893 }
42894
42895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42896         LDKChannelDetails this_ptr_conv;
42897         this_ptr_conv.inner = untag_ptr(this_ptr);
42898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42900         this_ptr_conv.is_owned = false;
42901         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
42902 }
42903
42904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42905         LDKChannelDetails this_ptr_conv;
42906         this_ptr_conv.inner = untag_ptr(this_ptr);
42907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42909         this_ptr_conv.is_owned = false;
42910         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
42911         return ret_conv;
42912 }
42913
42914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42915         LDKChannelDetails this_ptr_conv;
42916         this_ptr_conv.inner = untag_ptr(this_ptr);
42917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42919         this_ptr_conv.is_owned = false;
42920         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
42921 }
42922
42923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42924         LDKChannelDetails this_ptr_conv;
42925         this_ptr_conv.inner = untag_ptr(this_ptr);
42926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42928         this_ptr_conv.is_owned = false;
42929         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
42930         return ret_conv;
42931 }
42932
42933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1next_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42934         LDKChannelDetails this_ptr_conv;
42935         this_ptr_conv.inner = untag_ptr(this_ptr);
42936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42938         this_ptr_conv.is_owned = false;
42939         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
42940 }
42941
42942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42943         LDKChannelDetails this_ptr_conv;
42944         this_ptr_conv.inner = untag_ptr(this_ptr);
42945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42947         this_ptr_conv.is_owned = false;
42948         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
42949         return ret_conv;
42950 }
42951
42952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42953         LDKChannelDetails this_ptr_conv;
42954         this_ptr_conv.inner = untag_ptr(this_ptr);
42955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42957         this_ptr_conv.is_owned = false;
42958         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
42959 }
42960
42961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
42962         LDKChannelDetails this_ptr_conv;
42963         this_ptr_conv.inner = untag_ptr(this_ptr);
42964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42966         this_ptr_conv.is_owned = false;
42967         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
42968         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
42969         int64_t ret_ref = tag_ptr(ret_copy, true);
42970         return ret_ref;
42971 }
42972
42973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42974         LDKChannelDetails this_ptr_conv;
42975         this_ptr_conv.inner = untag_ptr(this_ptr);
42976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42978         this_ptr_conv.is_owned = false;
42979         void* val_ptr = untag_ptr(val);
42980         CHECK_ACCESS(val_ptr);
42981         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
42982         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
42983         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
42984 }
42985
42986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr) {
42987         LDKChannelDetails this_ptr_conv;
42988         this_ptr_conv.inner = untag_ptr(this_ptr);
42989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42991         this_ptr_conv.is_owned = false;
42992         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
42993         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
42994         int64_t ret_ref = tag_ptr(ret_copy, true);
42995         return ret_ref;
42996 }
42997
42998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42999         LDKChannelDetails this_ptr_conv;
43000         this_ptr_conv.inner = untag_ptr(this_ptr);
43001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43003         this_ptr_conv.is_owned = false;
43004         void* val_ptr = untag_ptr(val);
43005         CHECK_ACCESS(val_ptr);
43006         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
43007         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
43008         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
43009 }
43010
43011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
43012         LDKChannelDetails this_ptr_conv;
43013         this_ptr_conv.inner = untag_ptr(this_ptr);
43014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43016         this_ptr_conv.is_owned = false;
43017         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
43018         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
43019         int64_t ret_ref = tag_ptr(ret_copy, true);
43020         return ret_ref;
43021 }
43022
43023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43024         LDKChannelDetails this_ptr_conv;
43025         this_ptr_conv.inner = untag_ptr(this_ptr);
43026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43028         this_ptr_conv.is_owned = false;
43029         void* val_ptr = untag_ptr(val);
43030         CHECK_ACCESS(val_ptr);
43031         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
43032         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
43033         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
43034 }
43035
43036 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
43037         LDKChannelDetails this_ptr_conv;
43038         this_ptr_conv.inner = untag_ptr(this_ptr);
43039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43041         this_ptr_conv.is_owned = false;
43042         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
43043         return ret_conv;
43044 }
43045
43046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43047         LDKChannelDetails this_ptr_conv;
43048         this_ptr_conv.inner = untag_ptr(this_ptr);
43049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43051         this_ptr_conv.is_owned = false;
43052         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
43053 }
43054
43055 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr) {
43056         LDKChannelDetails this_ptr_conv;
43057         this_ptr_conv.inner = untag_ptr(this_ptr);
43058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43060         this_ptr_conv.is_owned = false;
43061         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
43062         return ret_conv;
43063 }
43064
43065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43066         LDKChannelDetails this_ptr_conv;
43067         this_ptr_conv.inner = untag_ptr(this_ptr);
43068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43070         this_ptr_conv.is_owned = false;
43071         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
43072 }
43073
43074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1shutdown_1state(JNIEnv *env, jclass clz, int64_t this_ptr) {
43075         LDKChannelDetails this_ptr_conv;
43076         this_ptr_conv.inner = untag_ptr(this_ptr);
43077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43079         this_ptr_conv.is_owned = false;
43080         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
43081         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
43082         int64_t ret_ref = tag_ptr(ret_copy, true);
43083         return ret_ref;
43084 }
43085
43086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1shutdown_1state(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43087         LDKChannelDetails this_ptr_conv;
43088         this_ptr_conv.inner = untag_ptr(this_ptr);
43089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43091         this_ptr_conv.is_owned = false;
43092         void* val_ptr = untag_ptr(val);
43093         CHECK_ACCESS(val_ptr);
43094         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
43095         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
43096         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
43097 }
43098
43099 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
43100         LDKChannelDetails this_ptr_conv;
43101         this_ptr_conv.inner = untag_ptr(this_ptr);
43102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43104         this_ptr_conv.is_owned = false;
43105         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
43106         return ret_conv;
43107 }
43108
43109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43110         LDKChannelDetails this_ptr_conv;
43111         this_ptr_conv.inner = untag_ptr(this_ptr);
43112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43114         this_ptr_conv.is_owned = false;
43115         ChannelDetails_set_is_usable(&this_ptr_conv, val);
43116 }
43117
43118 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
43119         LDKChannelDetails this_ptr_conv;
43120         this_ptr_conv.inner = untag_ptr(this_ptr);
43121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43123         this_ptr_conv.is_owned = false;
43124         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
43125         return ret_conv;
43126 }
43127
43128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43129         LDKChannelDetails this_ptr_conv;
43130         this_ptr_conv.inner = untag_ptr(this_ptr);
43131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43133         this_ptr_conv.is_owned = false;
43134         ChannelDetails_set_is_public(&this_ptr_conv, val);
43135 }
43136
43137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43138         LDKChannelDetails this_ptr_conv;
43139         this_ptr_conv.inner = untag_ptr(this_ptr);
43140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43142         this_ptr_conv.is_owned = false;
43143         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43144         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
43145         int64_t ret_ref = tag_ptr(ret_copy, true);
43146         return ret_ref;
43147 }
43148
43149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43150         LDKChannelDetails this_ptr_conv;
43151         this_ptr_conv.inner = untag_ptr(this_ptr);
43152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43154         this_ptr_conv.is_owned = false;
43155         void* val_ptr = untag_ptr(val);
43156         CHECK_ACCESS(val_ptr);
43157         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
43158         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
43159         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
43160 }
43161
43162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43163         LDKChannelDetails this_ptr_conv;
43164         this_ptr_conv.inner = untag_ptr(this_ptr);
43165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43167         this_ptr_conv.is_owned = false;
43168         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43169         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
43170         int64_t ret_ref = tag_ptr(ret_copy, true);
43171         return ret_ref;
43172 }
43173
43174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43175         LDKChannelDetails this_ptr_conv;
43176         this_ptr_conv.inner = untag_ptr(this_ptr);
43177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43179         this_ptr_conv.is_owned = false;
43180         void* val_ptr = untag_ptr(val);
43181         CHECK_ACCESS(val_ptr);
43182         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
43183         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
43184         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
43185 }
43186
43187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
43188         LDKChannelDetails this_ptr_conv;
43189         this_ptr_conv.inner = untag_ptr(this_ptr);
43190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43192         this_ptr_conv.is_owned = false;
43193         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
43194         int64_t ret_ref = 0;
43195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43197         return ret_ref;
43198 }
43199
43200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43201         LDKChannelDetails this_ptr_conv;
43202         this_ptr_conv.inner = untag_ptr(this_ptr);
43203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43205         this_ptr_conv.is_owned = false;
43206         LDKChannelConfig val_conv;
43207         val_conv.inner = untag_ptr(val);
43208         val_conv.is_owned = ptr_is_owned(val);
43209         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43210         val_conv = ChannelConfig_clone(&val_conv);
43211         ChannelDetails_set_config(&this_ptr_conv, val_conv);
43212 }
43213
43214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t channel_type_arg, int64_t short_channel_id_arg, int64_t outbound_scid_alias_arg, int64_t inbound_scid_alias_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int8_tArray user_channel_id_arg, int64_t feerate_sat_per_1000_weight_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t next_outbound_htlc_limit_msat_arg, int64_t next_outbound_htlc_minimum_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t confirmations_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_channel_ready_arg, int64_t channel_shutdown_state_arg, jboolean is_usable_arg, jboolean is_public_arg, int64_t inbound_htlc_minimum_msat_arg, int64_t inbound_htlc_maximum_msat_arg, int64_t config_arg) {
43215         LDKThirtyTwoBytes channel_id_arg_ref;
43216         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
43217         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
43218         LDKChannelCounterparty counterparty_arg_conv;
43219         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
43220         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
43221         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
43222         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
43223         LDKOutPoint funding_txo_arg_conv;
43224         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
43225         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
43226         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
43227         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
43228         LDKChannelTypeFeatures channel_type_arg_conv;
43229         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
43230         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
43231         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
43232         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
43233         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
43234         CHECK_ACCESS(short_channel_id_arg_ptr);
43235         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
43236         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
43237         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
43238         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
43239         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
43240         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
43241         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
43242         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
43243         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
43244         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
43245         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
43246         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
43247         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
43248         LDKU128 user_channel_id_arg_ref;
43249         CHECK((*env)->GetArrayLength(env, user_channel_id_arg) == 16);
43250         (*env)->GetByteArrayRegion(env, user_channel_id_arg, 0, 16, user_channel_id_arg_ref.le_bytes);
43251         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
43252         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
43253         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
43254         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
43255         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
43256         CHECK_ACCESS(confirmations_required_arg_ptr);
43257         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
43258         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
43259         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
43260         CHECK_ACCESS(confirmations_arg_ptr);
43261         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
43262         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
43263         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
43264         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
43265         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
43266         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
43267         void* channel_shutdown_state_arg_ptr = untag_ptr(channel_shutdown_state_arg);
43268         CHECK_ACCESS(channel_shutdown_state_arg_ptr);
43269         LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg_conv = *(LDKCOption_ChannelShutdownStateZ*)(channel_shutdown_state_arg_ptr);
43270         channel_shutdown_state_arg_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(channel_shutdown_state_arg));
43271         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
43272         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
43273         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
43274         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
43275         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
43276         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
43277         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
43278         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
43279         LDKChannelConfig config_arg_conv;
43280         config_arg_conv.inner = untag_ptr(config_arg);
43281         config_arg_conv.is_owned = ptr_is_owned(config_arg);
43282         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
43283         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
43284         LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, channel_type_arg_conv, short_channel_id_arg_conv, outbound_scid_alias_arg_conv, inbound_scid_alias_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg_ref, feerate_sat_per_1000_weight_arg_conv, balance_msat_arg, outbound_capacity_msat_arg, next_outbound_htlc_limit_msat_arg, next_outbound_htlc_minimum_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, confirmations_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_channel_ready_arg, channel_shutdown_state_arg_conv, is_usable_arg, is_public_arg, inbound_htlc_minimum_msat_arg_conv, inbound_htlc_maximum_msat_arg_conv, config_arg_conv);
43285         int64_t ret_ref = 0;
43286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43288         return ret_ref;
43289 }
43290
43291 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
43292         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
43293         int64_t ret_ref = 0;
43294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43296         return ret_ref;
43297 }
43298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43299         LDKChannelDetails arg_conv;
43300         arg_conv.inner = untag_ptr(arg);
43301         arg_conv.is_owned = ptr_is_owned(arg);
43302         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43303         arg_conv.is_owned = false;
43304         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
43305         return ret_conv;
43306 }
43307
43308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43309         LDKChannelDetails orig_conv;
43310         orig_conv.inner = untag_ptr(orig);
43311         orig_conv.is_owned = ptr_is_owned(orig);
43312         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43313         orig_conv.is_owned = false;
43314         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
43315         int64_t ret_ref = 0;
43316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43318         return ret_ref;
43319 }
43320
43321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
43322         LDKChannelDetails this_arg_conv;
43323         this_arg_conv.inner = untag_ptr(this_arg);
43324         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43326         this_arg_conv.is_owned = false;
43327         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43328         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
43329         int64_t ret_ref = tag_ptr(ret_copy, true);
43330         return ret_ref;
43331 }
43332
43333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
43334         LDKChannelDetails this_arg_conv;
43335         this_arg_conv.inner = untag_ptr(this_arg);
43336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43338         this_arg_conv.is_owned = false;
43339         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43340         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
43341         int64_t ret_ref = tag_ptr(ret_copy, true);
43342         return ret_ref;
43343 }
43344
43345 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43346         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
43347         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_clone(orig_conv));
43348         return ret_conv;
43349 }
43350
43351 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1not_1shutting_1down(JNIEnv *env, jclass clz) {
43352         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_not_shutting_down());
43353         return ret_conv;
43354 }
43355
43356 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1shutdown_1initiated(JNIEnv *env, jclass clz) {
43357         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_shutdown_initiated());
43358         return ret_conv;
43359 }
43360
43361 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1resolving_1htlcs(JNIEnv *env, jclass clz) {
43362         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_resolving_htlcs());
43363         return ret_conv;
43364 }
43365
43366 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1negotiating_1closing_1fee(JNIEnv *env, jclass clz) {
43367         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_negotiating_closing_fee());
43368         return ret_conv;
43369 }
43370
43371 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1shutdown_1complete(JNIEnv *env, jclass clz) {
43372         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_shutdown_complete());
43373         return ret_conv;
43374 }
43375
43376 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43377         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
43378         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
43379         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
43380         return ret_conv;
43381 }
43382
43383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43384         if (!ptr_is_owned(this_ptr)) return;
43385         void* this_ptr_ptr = untag_ptr(this_ptr);
43386         CHECK_ACCESS(this_ptr_ptr);
43387         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
43388         FREE(untag_ptr(this_ptr));
43389         RecentPaymentDetails_free(this_ptr_conv);
43390 }
43391
43392 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
43393         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
43394         *ret_copy = RecentPaymentDetails_clone(arg);
43395         int64_t ret_ref = tag_ptr(ret_copy, true);
43396         return ret_ref;
43397 }
43398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43399         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
43400         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
43401         return ret_conv;
43402 }
43403
43404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43405         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
43406         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
43407         *ret_copy = RecentPaymentDetails_clone(orig_conv);
43408         int64_t ret_ref = tag_ptr(ret_copy, true);
43409         return ret_ref;
43410 }
43411
43412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1awaiting_1invoice(JNIEnv *env, jclass clz, int8_tArray payment_id) {
43413         LDKThirtyTwoBytes payment_id_ref;
43414         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
43415         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
43416         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
43417         *ret_copy = RecentPaymentDetails_awaiting_invoice(payment_id_ref);
43418         int64_t ret_ref = tag_ptr(ret_copy, true);
43419         return ret_ref;
43420 }
43421
43422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1pending(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_t total_msat) {
43423         LDKThirtyTwoBytes payment_id_ref;
43424         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
43425         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
43426         LDKThirtyTwoBytes payment_hash_ref;
43427         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
43428         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
43429         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
43430         *ret_copy = RecentPaymentDetails_pending(payment_id_ref, payment_hash_ref, total_msat);
43431         int64_t ret_ref = tag_ptr(ret_copy, true);
43432         return ret_ref;
43433 }
43434
43435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1fulfilled(JNIEnv *env, jclass clz, int8_tArray payment_id, int64_t payment_hash) {
43436         LDKThirtyTwoBytes payment_id_ref;
43437         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
43438         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
43439         void* payment_hash_ptr = untag_ptr(payment_hash);
43440         CHECK_ACCESS(payment_hash_ptr);
43441         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
43442         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
43443         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
43444         *ret_copy = RecentPaymentDetails_fulfilled(payment_id_ref, payment_hash_conv);
43445         int64_t ret_ref = tag_ptr(ret_copy, true);
43446         return ret_ref;
43447 }
43448
43449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1abandoned(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
43450         LDKThirtyTwoBytes payment_id_ref;
43451         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
43452         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
43453         LDKThirtyTwoBytes payment_hash_ref;
43454         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
43455         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
43456         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
43457         *ret_copy = RecentPaymentDetails_abandoned(payment_id_ref, payment_hash_ref);
43458         int64_t ret_ref = tag_ptr(ret_copy, true);
43459         return ret_ref;
43460 }
43461
43462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43463         LDKPhantomRouteHints this_obj_conv;
43464         this_obj_conv.inner = untag_ptr(this_obj);
43465         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43467         PhantomRouteHints_free(this_obj_conv);
43468 }
43469
43470 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
43471         LDKPhantomRouteHints this_ptr_conv;
43472         this_ptr_conv.inner = untag_ptr(this_ptr);
43473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43475         this_ptr_conv.is_owned = false;
43476         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
43477         int64_tArray ret_arr = NULL;
43478         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
43479         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
43480         for (size_t q = 0; q < ret_var.datalen; q++) {
43481                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
43482                 int64_t ret_conv_16_ref = 0;
43483                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
43484                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
43485                 ret_arr_ptr[q] = ret_conv_16_ref;
43486         }
43487         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
43488         FREE(ret_var.data);
43489         return ret_arr;
43490 }
43491
43492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
43493         LDKPhantomRouteHints this_ptr_conv;
43494         this_ptr_conv.inner = untag_ptr(this_ptr);
43495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43497         this_ptr_conv.is_owned = false;
43498         LDKCVec_ChannelDetailsZ val_constr;
43499         val_constr.datalen = (*env)->GetArrayLength(env, val);
43500         if (val_constr.datalen > 0)
43501                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
43502         else
43503                 val_constr.data = NULL;
43504         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
43505         for (size_t q = 0; q < val_constr.datalen; q++) {
43506                 int64_t val_conv_16 = val_vals[q];
43507                 LDKChannelDetails val_conv_16_conv;
43508                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
43509                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
43510                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
43511                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
43512                 val_constr.data[q] = val_conv_16_conv;
43513         }
43514         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
43515         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
43516 }
43517
43518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
43519         LDKPhantomRouteHints this_ptr_conv;
43520         this_ptr_conv.inner = untag_ptr(this_ptr);
43521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43523         this_ptr_conv.is_owned = false;
43524         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
43525         return ret_conv;
43526 }
43527
43528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43529         LDKPhantomRouteHints this_ptr_conv;
43530         this_ptr_conv.inner = untag_ptr(this_ptr);
43531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43533         this_ptr_conv.is_owned = false;
43534         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
43535 }
43536
43537 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43538         LDKPhantomRouteHints this_ptr_conv;
43539         this_ptr_conv.inner = untag_ptr(this_ptr);
43540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43542         this_ptr_conv.is_owned = false;
43543         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43544         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
43545         return ret_arr;
43546 }
43547
43548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43549         LDKPhantomRouteHints this_ptr_conv;
43550         this_ptr_conv.inner = untag_ptr(this_ptr);
43551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43553         this_ptr_conv.is_owned = false;
43554         LDKPublicKey val_ref;
43555         CHECK((*env)->GetArrayLength(env, val) == 33);
43556         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43557         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
43558 }
43559
43560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t phantom_scid_arg, int8_tArray real_node_pubkey_arg) {
43561         LDKCVec_ChannelDetailsZ channels_arg_constr;
43562         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
43563         if (channels_arg_constr.datalen > 0)
43564                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
43565         else
43566                 channels_arg_constr.data = NULL;
43567         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
43568         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
43569                 int64_t channels_arg_conv_16 = channels_arg_vals[q];
43570                 LDKChannelDetails channels_arg_conv_16_conv;
43571                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
43572                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
43573                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
43574                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
43575                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
43576         }
43577         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
43578         LDKPublicKey real_node_pubkey_arg_ref;
43579         CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
43580         (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
43581         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
43582         int64_t ret_ref = 0;
43583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43585         return ret_ref;
43586 }
43587
43588 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
43589         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
43590         int64_t ret_ref = 0;
43591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43593         return ret_ref;
43594 }
43595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43596         LDKPhantomRouteHints arg_conv;
43597         arg_conv.inner = untag_ptr(arg);
43598         arg_conv.is_owned = ptr_is_owned(arg);
43599         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43600         arg_conv.is_owned = false;
43601         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
43602         return ret_conv;
43603 }
43604
43605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43606         LDKPhantomRouteHints orig_conv;
43607         orig_conv.inner = untag_ptr(orig);
43608         orig_conv.is_owned = ptr_is_owned(orig);
43609         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43610         orig_conv.is_owned = false;
43611         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
43612         int64_t ret_ref = 0;
43613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43615         return ret_ref;
43616 }
43617
43618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv *env, jclass clz, int64_t fee_est, int64_t chain_monitor, int64_t tx_broadcaster, int64_t router, int64_t logger, int64_t entropy_source, int64_t node_signer, int64_t signer_provider, int64_t config, int64_t params, int32_t current_timestamp) {
43619         void* fee_est_ptr = untag_ptr(fee_est);
43620         CHECK_ACCESS(fee_est_ptr);
43621         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
43622         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
43623                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43624                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
43625         }
43626         void* chain_monitor_ptr = untag_ptr(chain_monitor);
43627         CHECK_ACCESS(chain_monitor_ptr);
43628         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
43629         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
43630                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43631                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
43632         }
43633         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
43634         CHECK_ACCESS(tx_broadcaster_ptr);
43635         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
43636         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
43637                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43638                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
43639         }
43640         void* router_ptr = untag_ptr(router);
43641         CHECK_ACCESS(router_ptr);
43642         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
43643         if (router_conv.free == LDKRouter_JCalls_free) {
43644                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43645                 LDKRouter_JCalls_cloned(&router_conv);
43646         }
43647         void* logger_ptr = untag_ptr(logger);
43648         CHECK_ACCESS(logger_ptr);
43649         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43650         if (logger_conv.free == LDKLogger_JCalls_free) {
43651                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43652                 LDKLogger_JCalls_cloned(&logger_conv);
43653         }
43654         void* entropy_source_ptr = untag_ptr(entropy_source);
43655         CHECK_ACCESS(entropy_source_ptr);
43656         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
43657         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
43658                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43659                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
43660         }
43661         void* node_signer_ptr = untag_ptr(node_signer);
43662         CHECK_ACCESS(node_signer_ptr);
43663         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
43664         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
43665                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43666                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
43667         }
43668         void* signer_provider_ptr = untag_ptr(signer_provider);
43669         CHECK_ACCESS(signer_provider_ptr);
43670         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
43671         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
43672                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43673                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
43674         }
43675         LDKUserConfig config_conv;
43676         config_conv.inner = untag_ptr(config);
43677         config_conv.is_owned = ptr_is_owned(config);
43678         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
43679         config_conv = UserConfig_clone(&config_conv);
43680         LDKChainParameters params_conv;
43681         params_conv.inner = untag_ptr(params);
43682         params_conv.is_owned = ptr_is_owned(params);
43683         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
43684         params_conv = ChainParameters_clone(&params_conv);
43685         LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, router_conv, logger_conv, entropy_source_conv, node_signer_conv, signer_provider_conv, config_conv, params_conv, current_timestamp);
43686         int64_t ret_ref = 0;
43687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43689         return ret_ref;
43690 }
43691
43692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
43693         LDKChannelManager this_arg_conv;
43694         this_arg_conv.inner = untag_ptr(this_arg);
43695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43697         this_arg_conv.is_owned = false;
43698         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
43699         int64_t ret_ref = 0;
43700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43702         return ret_ref;
43703 }
43704
43705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int8_tArray user_channel_id, int64_t temporary_channel_id, int64_t override_config) {
43706         LDKChannelManager this_arg_conv;
43707         this_arg_conv.inner = untag_ptr(this_arg);
43708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43710         this_arg_conv.is_owned = false;
43711         LDKPublicKey their_network_key_ref;
43712         CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
43713         (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
43714         LDKU128 user_channel_id_ref;
43715         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
43716         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
43717         void* temporary_channel_id_ptr = untag_ptr(temporary_channel_id);
43718         CHECK_ACCESS(temporary_channel_id_ptr);
43719         LDKCOption_ThirtyTwoBytesZ temporary_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(temporary_channel_id_ptr);
43720         temporary_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(temporary_channel_id));
43721         LDKUserConfig override_config_conv;
43722         override_config_conv.inner = untag_ptr(override_config);
43723         override_config_conv.is_owned = ptr_is_owned(override_config);
43724         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
43725         override_config_conv = UserConfig_clone(&override_config_conv);
43726         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
43727         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, temporary_channel_id_conv, override_config_conv);
43728         return tag_ptr(ret_conv, true);
43729 }
43730
43731 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
43732         LDKChannelManager this_arg_conv;
43733         this_arg_conv.inner = untag_ptr(this_arg);
43734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43736         this_arg_conv.is_owned = false;
43737         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
43738         int64_tArray ret_arr = NULL;
43739         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
43740         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
43741         for (size_t q = 0; q < ret_var.datalen; q++) {
43742                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
43743                 int64_t ret_conv_16_ref = 0;
43744                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
43745                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
43746                 ret_arr_ptr[q] = ret_conv_16_ref;
43747         }
43748         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
43749         FREE(ret_var.data);
43750         return ret_arr;
43751 }
43752
43753 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
43754         LDKChannelManager this_arg_conv;
43755         this_arg_conv.inner = untag_ptr(this_arg);
43756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43758         this_arg_conv.is_owned = false;
43759         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
43760         int64_tArray ret_arr = NULL;
43761         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
43762         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
43763         for (size_t q = 0; q < ret_var.datalen; q++) {
43764                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
43765                 int64_t ret_conv_16_ref = 0;
43766                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
43767                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
43768                 ret_arr_ptr[q] = ret_conv_16_ref;
43769         }
43770         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
43771         FREE(ret_var.data);
43772         return ret_arr;
43773 }
43774
43775 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels_1with_1counterparty(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray counterparty_node_id) {
43776         LDKChannelManager this_arg_conv;
43777         this_arg_conv.inner = untag_ptr(this_arg);
43778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43780         this_arg_conv.is_owned = false;
43781         LDKPublicKey counterparty_node_id_ref;
43782         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
43783         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
43784         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
43785         int64_tArray ret_arr = NULL;
43786         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
43787         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
43788         for (size_t q = 0; q < ret_var.datalen; q++) {
43789                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
43790                 int64_t ret_conv_16_ref = 0;
43791                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
43792                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
43793                 ret_arr_ptr[q] = ret_conv_16_ref;
43794         }
43795         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
43796         FREE(ret_var.data);
43797         return ret_arr;
43798 }
43799
43800 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1recent_1payments(JNIEnv *env, jclass clz, int64_t this_arg) {
43801         LDKChannelManager this_arg_conv;
43802         this_arg_conv.inner = untag_ptr(this_arg);
43803         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43805         this_arg_conv.is_owned = false;
43806         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
43807         int64_tArray ret_arr = NULL;
43808         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
43809         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
43810         for (size_t w = 0; w < ret_var.datalen; w++) {
43811                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
43812                 *ret_conv_22_copy = ret_var.data[w];
43813                 int64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
43814                 ret_arr_ptr[w] = ret_conv_22_ref;
43815         }
43816         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
43817         FREE(ret_var.data);
43818         return ret_arr;
43819 }
43820
43821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
43822         LDKChannelManager this_arg_conv;
43823         this_arg_conv.inner = untag_ptr(this_arg);
43824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43826         this_arg_conv.is_owned = false;
43827         uint8_t channel_id_arr[32];
43828         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
43829         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
43830         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
43831         LDKPublicKey counterparty_node_id_ref;
43832         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
43833         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
43834         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
43835         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
43836         return tag_ptr(ret_conv, true);
43837 }
43838
43839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel_1with_1feerate_1and_1script(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id, int64_t target_feerate_sats_per_1000_weight, int64_t shutdown_script) {
43840         LDKChannelManager this_arg_conv;
43841         this_arg_conv.inner = untag_ptr(this_arg);
43842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43844         this_arg_conv.is_owned = false;
43845         uint8_t channel_id_arr[32];
43846         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
43847         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
43848         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
43849         LDKPublicKey counterparty_node_id_ref;
43850         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
43851         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
43852         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
43853         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
43854         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
43855         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
43856         LDKShutdownScript shutdown_script_conv;
43857         shutdown_script_conv.inner = untag_ptr(shutdown_script);
43858         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
43859         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
43860         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
43861         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
43862         *ret_conv = ChannelManager_close_channel_with_feerate_and_script(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight_conv, shutdown_script_conv);
43863         return tag_ptr(ret_conv, true);
43864 }
43865
43866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
43867         LDKChannelManager this_arg_conv;
43868         this_arg_conv.inner = untag_ptr(this_arg);
43869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43871         this_arg_conv.is_owned = false;
43872         uint8_t channel_id_arr[32];
43873         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
43874         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
43875         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
43876         LDKPublicKey counterparty_node_id_ref;
43877         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
43878         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
43879         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
43880         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
43881         return tag_ptr(ret_conv, true);
43882 }
43883
43884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
43885         LDKChannelManager this_arg_conv;
43886         this_arg_conv.inner = untag_ptr(this_arg);
43887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43889         this_arg_conv.is_owned = false;
43890         uint8_t channel_id_arr[32];
43891         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
43892         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
43893         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
43894         LDKPublicKey counterparty_node_id_ref;
43895         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
43896         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
43897         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
43898         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
43899         return tag_ptr(ret_conv, true);
43900 }
43901
43902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
43903         LDKChannelManager this_arg_conv;
43904         this_arg_conv.inner = untag_ptr(this_arg);
43905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43907         this_arg_conv.is_owned = false;
43908         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
43909 }
43910
43911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
43912         LDKChannelManager this_arg_conv;
43913         this_arg_conv.inner = untag_ptr(this_arg);
43914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43916         this_arg_conv.is_owned = false;
43917         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
43918 }
43919
43920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment_1with_1route(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_hash, int64_t recipient_onion, int8_tArray payment_id) {
43921         LDKChannelManager this_arg_conv;
43922         this_arg_conv.inner = untag_ptr(this_arg);
43923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43925         this_arg_conv.is_owned = false;
43926         LDKRoute route_conv;
43927         route_conv.inner = untag_ptr(route);
43928         route_conv.is_owned = ptr_is_owned(route);
43929         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
43930         route_conv.is_owned = false;
43931         LDKThirtyTwoBytes payment_hash_ref;
43932         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
43933         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
43934         LDKRecipientOnionFields recipient_onion_conv;
43935         recipient_onion_conv.inner = untag_ptr(recipient_onion);
43936         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
43937         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
43938         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
43939         LDKThirtyTwoBytes payment_id_ref;
43940         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
43941         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
43942         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
43943         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
43944         return tag_ptr(ret_conv, true);
43945 }
43946
43947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t recipient_onion, int8_tArray payment_id, int64_t route_params, int64_t retry_strategy) {
43948         LDKChannelManager this_arg_conv;
43949         this_arg_conv.inner = untag_ptr(this_arg);
43950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43952         this_arg_conv.is_owned = false;
43953         LDKThirtyTwoBytes payment_hash_ref;
43954         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
43955         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
43956         LDKRecipientOnionFields recipient_onion_conv;
43957         recipient_onion_conv.inner = untag_ptr(recipient_onion);
43958         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
43959         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
43960         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
43961         LDKThirtyTwoBytes payment_id_ref;
43962         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
43963         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
43964         LDKRouteParameters route_params_conv;
43965         route_params_conv.inner = untag_ptr(route_params);
43966         route_params_conv.is_owned = ptr_is_owned(route_params);
43967         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
43968         route_params_conv = RouteParameters_clone(&route_params_conv);
43969         void* retry_strategy_ptr = untag_ptr(retry_strategy);
43970         CHECK_ACCESS(retry_strategy_ptr);
43971         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
43972         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
43973         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
43974         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
43975         return tag_ptr(ret_conv, true);
43976 }
43977
43978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
43979         LDKChannelManager this_arg_conv;
43980         this_arg_conv.inner = untag_ptr(this_arg);
43981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43983         this_arg_conv.is_owned = false;
43984         LDKThirtyTwoBytes payment_id_ref;
43985         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
43986         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
43987         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
43988 }
43989
43990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int64_t payment_preimage, int64_t recipient_onion, int8_tArray payment_id) {
43991         LDKChannelManager this_arg_conv;
43992         this_arg_conv.inner = untag_ptr(this_arg);
43993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43995         this_arg_conv.is_owned = false;
43996         LDKRoute route_conv;
43997         route_conv.inner = untag_ptr(route);
43998         route_conv.is_owned = ptr_is_owned(route);
43999         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
44000         route_conv.is_owned = false;
44001         void* payment_preimage_ptr = untag_ptr(payment_preimage);
44002         CHECK_ACCESS(payment_preimage_ptr);
44003         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
44004         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
44005         LDKRecipientOnionFields recipient_onion_conv;
44006         recipient_onion_conv.inner = untag_ptr(recipient_onion);
44007         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
44008         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
44009         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
44010         LDKThirtyTwoBytes payment_id_ref;
44011         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
44012         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
44013         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
44014         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
44015         return tag_ptr(ret_conv, true);
44016 }
44017
44018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment_1with_1retry(JNIEnv *env, jclass clz, int64_t this_arg, int64_t payment_preimage, int64_t recipient_onion, int8_tArray payment_id, int64_t route_params, int64_t retry_strategy) {
44019         LDKChannelManager this_arg_conv;
44020         this_arg_conv.inner = untag_ptr(this_arg);
44021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44023         this_arg_conv.is_owned = false;
44024         void* payment_preimage_ptr = untag_ptr(payment_preimage);
44025         CHECK_ACCESS(payment_preimage_ptr);
44026         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
44027         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
44028         LDKRecipientOnionFields recipient_onion_conv;
44029         recipient_onion_conv.inner = untag_ptr(recipient_onion);
44030         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
44031         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
44032         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
44033         LDKThirtyTwoBytes payment_id_ref;
44034         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
44035         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
44036         LDKRouteParameters route_params_conv;
44037         route_params_conv.inner = untag_ptr(route_params);
44038         route_params_conv.is_owned = ptr_is_owned(route_params);
44039         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
44040         route_params_conv = RouteParameters_clone(&route_params_conv);
44041         void* retry_strategy_ptr = untag_ptr(retry_strategy);
44042         CHECK_ACCESS(retry_strategy_ptr);
44043         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
44044         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
44045         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
44046         *ret_conv = ChannelManager_send_spontaneous_payment_with_retry(&this_arg_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
44047         return tag_ptr(ret_conv, true);
44048 }
44049
44050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1probe(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
44051         LDKChannelManager this_arg_conv;
44052         this_arg_conv.inner = untag_ptr(this_arg);
44053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44055         this_arg_conv.is_owned = false;
44056         LDKPath path_conv;
44057         path_conv.inner = untag_ptr(path);
44058         path_conv.is_owned = ptr_is_owned(path);
44059         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
44060         path_conv = Path_clone(&path_conv);
44061         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
44062         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
44063         return tag_ptr(ret_conv, true);
44064 }
44065
44066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1preflight_1probes(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray node_id, int64_t amount_msat, int32_t final_cltv_expiry_delta, int64_t liquidity_limit_multiplier) {
44067         LDKChannelManager this_arg_conv;
44068         this_arg_conv.inner = untag_ptr(this_arg);
44069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44071         this_arg_conv.is_owned = false;
44072         LDKPublicKey node_id_ref;
44073         CHECK((*env)->GetArrayLength(env, node_id) == 33);
44074         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
44075         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
44076         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
44077         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
44078         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
44079         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
44080         *ret_conv = ChannelManager_send_spontaneous_preflight_probes(&this_arg_conv, node_id_ref, amount_msat, final_cltv_expiry_delta, liquidity_limit_multiplier_conv);
44081         return tag_ptr(ret_conv, true);
44082 }
44083
44084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1preflight_1probes(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route_params, int64_t liquidity_limit_multiplier) {
44085         LDKChannelManager this_arg_conv;
44086         this_arg_conv.inner = untag_ptr(this_arg);
44087         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44089         this_arg_conv.is_owned = false;
44090         LDKRouteParameters route_params_conv;
44091         route_params_conv.inner = untag_ptr(route_params);
44092         route_params_conv.is_owned = ptr_is_owned(route_params);
44093         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
44094         route_params_conv = RouteParameters_clone(&route_params_conv);
44095         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
44096         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
44097         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
44098         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
44099         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
44100         *ret_conv = ChannelManager_send_preflight_probes(&this_arg_conv, route_params_conv, liquidity_limit_multiplier_conv);
44101         return tag_ptr(ret_conv, true);
44102 }
44103
44104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1transaction_1generated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray funding_transaction) {
44105         LDKChannelManager this_arg_conv;
44106         this_arg_conv.inner = untag_ptr(this_arg);
44107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44109         this_arg_conv.is_owned = false;
44110         uint8_t temporary_channel_id_arr[32];
44111         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
44112         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
44113         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
44114         LDKPublicKey counterparty_node_id_ref;
44115         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
44116         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
44117         LDKTransaction funding_transaction_ref;
44118         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
44119         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
44120         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
44121         funding_transaction_ref.data_is_owned = true;
44122         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
44123         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
44124         return tag_ptr(ret_conv, true);
44125 }
44126
44127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1batch_1funding_1transaction_1generated(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray temporary_channels, int8_tArray funding_transaction) {
44128         LDKChannelManager this_arg_conv;
44129         this_arg_conv.inner = untag_ptr(this_arg);
44130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44132         this_arg_conv.is_owned = false;
44133         LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ temporary_channels_constr;
44134         temporary_channels_constr.datalen = (*env)->GetArrayLength(env, temporary_channels);
44135         if (temporary_channels_constr.datalen > 0)
44136                 temporary_channels_constr.data = MALLOC(temporary_channels_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ), "LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ Elements");
44137         else
44138                 temporary_channels_constr.data = NULL;
44139         int64_t* temporary_channels_vals = (*env)->GetLongArrayElements (env, temporary_channels, NULL);
44140         for (size_t j = 0; j < temporary_channels_constr.datalen; j++) {
44141                 int64_t temporary_channels_conv_35 = temporary_channels_vals[j];
44142                 void* temporary_channels_conv_35_ptr = untag_ptr(temporary_channels_conv_35);
44143                 CHECK_ACCESS(temporary_channels_conv_35_ptr);
44144                 LDKC2Tuple_ThirtyTwoBytesPublicKeyZ temporary_channels_conv_35_conv = *(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)(temporary_channels_conv_35_ptr);
44145                 temporary_channels_conv_35_conv = C2Tuple_ThirtyTwoBytesPublicKeyZ_clone((LDKC2Tuple_ThirtyTwoBytesPublicKeyZ*)untag_ptr(temporary_channels_conv_35));
44146                 temporary_channels_constr.data[j] = temporary_channels_conv_35_conv;
44147         }
44148         (*env)->ReleaseLongArrayElements(env, temporary_channels, temporary_channels_vals, 0);
44149         LDKTransaction funding_transaction_ref;
44150         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
44151         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
44152         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
44153         funding_transaction_ref.data_is_owned = true;
44154         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
44155         *ret_conv = ChannelManager_batch_funding_transaction_generated(&this_arg_conv, temporary_channels_constr, funding_transaction_ref);
44156         return tag_ptr(ret_conv, true);
44157 }
44158
44159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1update_1partial_1channel_1config(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray counterparty_node_id, jobjectArray channel_ids, int64_t config_update) {
44160         LDKChannelManager this_arg_conv;
44161         this_arg_conv.inner = untag_ptr(this_arg);
44162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44164         this_arg_conv.is_owned = false;
44165         LDKPublicKey counterparty_node_id_ref;
44166         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
44167         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
44168         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
44169         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
44170         if (channel_ids_constr.datalen > 0)
44171                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
44172         else
44173                 channel_ids_constr.data = NULL;
44174         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
44175                 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
44176                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
44177                 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
44178                 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
44179                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
44180         }
44181         LDKChannelConfigUpdate config_update_conv;
44182         config_update_conv.inner = untag_ptr(config_update);
44183         config_update_conv.is_owned = ptr_is_owned(config_update);
44184         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
44185         config_update_conv.is_owned = false;
44186         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
44187         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
44188         return tag_ptr(ret_conv, true);
44189 }
44190
44191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1update_1channel_1config(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray counterparty_node_id, jobjectArray channel_ids, int64_t config) {
44192         LDKChannelManager this_arg_conv;
44193         this_arg_conv.inner = untag_ptr(this_arg);
44194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44196         this_arg_conv.is_owned = false;
44197         LDKPublicKey counterparty_node_id_ref;
44198         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
44199         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
44200         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
44201         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
44202         if (channel_ids_constr.datalen > 0)
44203                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
44204         else
44205                 channel_ids_constr.data = NULL;
44206         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
44207                 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
44208                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
44209                 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
44210                 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
44211                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
44212         }
44213         LDKChannelConfig config_conv;
44214         config_conv.inner = untag_ptr(config);
44215         config_conv.is_owned = ptr_is_owned(config);
44216         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
44217         config_conv.is_owned = false;
44218         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
44219         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
44220         return tag_ptr(ret_conv, true);
44221 }
44222
44223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1forward_1intercepted_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray intercept_id, int8_tArray next_hop_channel_id, int8_tArray next_node_id, int64_t amt_to_forward_msat) {
44224         LDKChannelManager this_arg_conv;
44225         this_arg_conv.inner = untag_ptr(this_arg);
44226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44228         this_arg_conv.is_owned = false;
44229         LDKThirtyTwoBytes intercept_id_ref;
44230         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
44231         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
44232         uint8_t next_hop_channel_id_arr[32];
44233         CHECK((*env)->GetArrayLength(env, next_hop_channel_id) == 32);
44234         (*env)->GetByteArrayRegion(env, next_hop_channel_id, 0, 32, next_hop_channel_id_arr);
44235         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
44236         LDKPublicKey next_node_id_ref;
44237         CHECK((*env)->GetArrayLength(env, next_node_id) == 33);
44238         (*env)->GetByteArrayRegion(env, next_node_id, 0, 33, next_node_id_ref.compressed_form);
44239         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
44240         *ret_conv = ChannelManager_forward_intercepted_htlc(&this_arg_conv, intercept_id_ref, next_hop_channel_id_ref, next_node_id_ref, amt_to_forward_msat);
44241         return tag_ptr(ret_conv, true);
44242 }
44243
44244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1intercepted_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray intercept_id) {
44245         LDKChannelManager this_arg_conv;
44246         this_arg_conv.inner = untag_ptr(this_arg);
44247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44249         this_arg_conv.is_owned = false;
44250         LDKThirtyTwoBytes intercept_id_ref;
44251         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
44252         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
44253         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
44254         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
44255         return tag_ptr(ret_conv, true);
44256 }
44257
44258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
44259         LDKChannelManager this_arg_conv;
44260         this_arg_conv.inner = untag_ptr(this_arg);
44261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44263         this_arg_conv.is_owned = false;
44264         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
44265 }
44266
44267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
44268         LDKChannelManager this_arg_conv;
44269         this_arg_conv.inner = untag_ptr(this_arg);
44270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44272         this_arg_conv.is_owned = false;
44273         ChannelManager_timer_tick_occurred(&this_arg_conv);
44274 }
44275
44276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
44277         LDKChannelManager this_arg_conv;
44278         this_arg_conv.inner = untag_ptr(this_arg);
44279         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44281         this_arg_conv.is_owned = false;
44282         uint8_t payment_hash_arr[32];
44283         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
44284         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
44285         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
44286         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
44287 }
44288
44289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards_1with_1reason(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t failure_code) {
44290         LDKChannelManager this_arg_conv;
44291         this_arg_conv.inner = untag_ptr(this_arg);
44292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44294         this_arg_conv.is_owned = false;
44295         uint8_t payment_hash_arr[32];
44296         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
44297         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
44298         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
44299         void* failure_code_ptr = untag_ptr(failure_code);
44300         CHECK_ACCESS(failure_code_ptr);
44301         LDKFailureCode failure_code_conv = *(LDKFailureCode*)(failure_code_ptr);
44302         failure_code_conv = FailureCode_clone((LDKFailureCode*)untag_ptr(failure_code));
44303         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
44304 }
44305
44306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
44307         LDKChannelManager this_arg_conv;
44308         this_arg_conv.inner = untag_ptr(this_arg);
44309         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44311         this_arg_conv.is_owned = false;
44312         LDKThirtyTwoBytes payment_preimage_ref;
44313         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
44314         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
44315         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
44316 }
44317
44318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds_1with_1known_1custom_1tlvs(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
44319         LDKChannelManager this_arg_conv;
44320         this_arg_conv.inner = untag_ptr(this_arg);
44321         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44323         this_arg_conv.is_owned = false;
44324         LDKThirtyTwoBytes payment_preimage_ref;
44325         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
44326         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
44327         ChannelManager_claim_funds_with_known_custom_tlvs(&this_arg_conv, payment_preimage_ref);
44328 }
44329
44330 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
44331         LDKChannelManager this_arg_conv;
44332         this_arg_conv.inner = untag_ptr(this_arg);
44333         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44335         this_arg_conv.is_owned = false;
44336         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44337         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
44338         return ret_arr;
44339 }
44340
44341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
44342         LDKChannelManager this_arg_conv;
44343         this_arg_conv.inner = untag_ptr(this_arg);
44344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44346         this_arg_conv.is_owned = false;
44347         uint8_t temporary_channel_id_arr[32];
44348         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
44349         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
44350         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
44351         LDKPublicKey counterparty_node_id_ref;
44352         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
44353         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
44354         LDKU128 user_channel_id_ref;
44355         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
44356         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
44357         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
44358         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
44359         return tag_ptr(ret_conv, true);
44360 }
44361
44362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel_1from_1trusted_1peer_10conf(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
44363         LDKChannelManager this_arg_conv;
44364         this_arg_conv.inner = untag_ptr(this_arg);
44365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44367         this_arg_conv.is_owned = false;
44368         uint8_t temporary_channel_id_arr[32];
44369         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
44370         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
44371         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
44372         LDKPublicKey counterparty_node_id_ref;
44373         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
44374         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
44375         LDKU128 user_channel_id_ref;
44376         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
44377         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
44378         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
44379         *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
44380         return tag_ptr(ret_conv, true);
44381 }
44382
44383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1pay_1for_1offer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t offer, int64_t quantity, int64_t amount_msats, int64_t payer_note, int8_tArray payment_id, int64_t retry_strategy, int64_t max_total_routing_fee_msat) {
44384         LDKChannelManager this_arg_conv;
44385         this_arg_conv.inner = untag_ptr(this_arg);
44386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44388         this_arg_conv.is_owned = false;
44389         LDKOffer offer_conv;
44390         offer_conv.inner = untag_ptr(offer);
44391         offer_conv.is_owned = ptr_is_owned(offer);
44392         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_conv);
44393         offer_conv.is_owned = false;
44394         void* quantity_ptr = untag_ptr(quantity);
44395         CHECK_ACCESS(quantity_ptr);
44396         LDKCOption_u64Z quantity_conv = *(LDKCOption_u64Z*)(quantity_ptr);
44397         quantity_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity));
44398         void* amount_msats_ptr = untag_ptr(amount_msats);
44399         CHECK_ACCESS(amount_msats_ptr);
44400         LDKCOption_u64Z amount_msats_conv = *(LDKCOption_u64Z*)(amount_msats_ptr);
44401         amount_msats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amount_msats));
44402         void* payer_note_ptr = untag_ptr(payer_note);
44403         CHECK_ACCESS(payer_note_ptr);
44404         LDKCOption_StrZ payer_note_conv = *(LDKCOption_StrZ*)(payer_note_ptr);
44405         payer_note_conv = COption_StrZ_clone((LDKCOption_StrZ*)untag_ptr(payer_note));
44406         LDKThirtyTwoBytes payment_id_ref;
44407         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
44408         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
44409         void* retry_strategy_ptr = untag_ptr(retry_strategy);
44410         CHECK_ACCESS(retry_strategy_ptr);
44411         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
44412         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
44413         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
44414         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
44415         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
44416         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
44417         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
44418         *ret_conv = ChannelManager_pay_for_offer(&this_arg_conv, &offer_conv, quantity_conv, amount_msats_conv, payer_note_conv, payment_id_ref, retry_strategy_conv, max_total_routing_fee_msat_conv);
44419         return tag_ptr(ret_conv, true);
44420 }
44421
44422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1request_1refund_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t refund) {
44423         LDKChannelManager this_arg_conv;
44424         this_arg_conv.inner = untag_ptr(this_arg);
44425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44427         this_arg_conv.is_owned = false;
44428         LDKRefund refund_conv;
44429         refund_conv.inner = untag_ptr(refund);
44430         refund_conv.is_owned = ptr_is_owned(refund);
44431         CHECK_INNER_FIELD_ACCESS_OR_NULL(refund_conv);
44432         refund_conv.is_owned = false;
44433         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
44434         *ret_conv = ChannelManager_request_refund_payment(&this_arg_conv, &refund_conv);
44435         return tag_ptr(ret_conv, true);
44436 }
44437
44438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) {
44439         LDKChannelManager this_arg_conv;
44440         this_arg_conv.inner = untag_ptr(this_arg);
44441         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44443         this_arg_conv.is_owned = false;
44444         void* min_value_msat_ptr = untag_ptr(min_value_msat);
44445         CHECK_ACCESS(min_value_msat_ptr);
44446         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
44447         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
44448         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
44449         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
44450         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
44451         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
44452         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
44453         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
44454         return tag_ptr(ret_conv, true);
44455 }
44456
44457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry) {
44458         LDKChannelManager this_arg_conv;
44459         this_arg_conv.inner = untag_ptr(this_arg);
44460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44462         this_arg_conv.is_owned = false;
44463         LDKThirtyTwoBytes payment_hash_ref;
44464         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
44465         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
44466         void* min_value_msat_ptr = untag_ptr(min_value_msat);
44467         CHECK_ACCESS(min_value_msat_ptr);
44468         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
44469         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
44470         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
44471         CHECK_ACCESS(min_final_cltv_expiry_ptr);
44472         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
44473         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
44474         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
44475         *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_conv);
44476         return tag_ptr(ret_conv, true);
44477 }
44478
44479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
44480         LDKChannelManager this_arg_conv;
44481         this_arg_conv.inner = untag_ptr(this_arg);
44482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44484         this_arg_conv.is_owned = false;
44485         LDKThirtyTwoBytes payment_hash_ref;
44486         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
44487         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
44488         LDKThirtyTwoBytes payment_secret_ref;
44489         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
44490         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
44491         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
44492         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
44493         return tag_ptr(ret_conv, true);
44494 }
44495
44496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
44497         LDKChannelManager this_arg_conv;
44498         this_arg_conv.inner = untag_ptr(this_arg);
44499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44501         this_arg_conv.is_owned = false;
44502         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
44503         return ret_conv;
44504 }
44505
44506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
44507         LDKChannelManager this_arg_conv;
44508         this_arg_conv.inner = untag_ptr(this_arg);
44509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44511         this_arg_conv.is_owned = false;
44512         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
44513         int64_t ret_ref = 0;
44514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44516         return ret_ref;
44517 }
44518
44519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1intercept_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
44520         LDKChannelManager this_arg_conv;
44521         this_arg_conv.inner = untag_ptr(this_arg);
44522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44524         this_arg_conv.is_owned = false;
44525         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
44526         return ret_conv;
44527 }
44528
44529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1compute_1inflight_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg) {
44530         LDKChannelManager this_arg_conv;
44531         this_arg_conv.inner = untag_ptr(this_arg);
44532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44534         this_arg_conv.is_owned = false;
44535         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
44536         int64_t ret_ref = 0;
44537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44539         return ret_ref;
44540 }
44541
44542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
44543         LDKChannelManager this_arg_conv;
44544         this_arg_conv.inner = untag_ptr(this_arg);
44545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44547         this_arg_conv.is_owned = false;
44548         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
44549         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
44550         return tag_ptr(ret_ret, true);
44551 }
44552
44553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
44554         LDKChannelManager this_arg_conv;
44555         this_arg_conv.inner = untag_ptr(this_arg);
44556         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44558         this_arg_conv.is_owned = false;
44559         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
44560         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
44561         return tag_ptr(ret_ret, true);
44562 }
44563
44564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
44565         LDKChannelManager this_arg_conv;
44566         this_arg_conv.inner = untag_ptr(this_arg);
44567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44569         this_arg_conv.is_owned = false;
44570         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
44571         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
44572         return tag_ptr(ret_ret, true);
44573 }
44574
44575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
44576         LDKChannelManager this_arg_conv;
44577         this_arg_conv.inner = untag_ptr(this_arg);
44578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44580         this_arg_conv.is_owned = false;
44581         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
44582         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
44583         return tag_ptr(ret_ret, true);
44584 }
44585
44586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1event_1or_1persistence_1needed_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
44587         LDKChannelManager this_arg_conv;
44588         this_arg_conv.inner = untag_ptr(this_arg);
44589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44591         this_arg_conv.is_owned = false;
44592         LDKFuture ret_var = ChannelManager_get_event_or_persistence_needed_future(&this_arg_conv);
44593         int64_t ret_ref = 0;
44594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44596         return ret_ref;
44597 }
44598
44599 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1and_1clear_1needs_1persistence(JNIEnv *env, jclass clz, int64_t this_arg) {
44600         LDKChannelManager this_arg_conv;
44601         this_arg_conv.inner = untag_ptr(this_arg);
44602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44604         this_arg_conv.is_owned = false;
44605         jboolean ret_conv = ChannelManager_get_and_clear_needs_persistence(&this_arg_conv);
44606         return ret_conv;
44607 }
44608
44609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
44610         LDKChannelManager this_arg_conv;
44611         this_arg_conv.inner = untag_ptr(this_arg);
44612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44614         this_arg_conv.is_owned = false;
44615         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
44616         int64_t ret_ref = 0;
44617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44619         return ret_ref;
44620 }
44621
44622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
44623         LDKChannelManager this_arg_conv;
44624         this_arg_conv.inner = untag_ptr(this_arg);
44625         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44627         this_arg_conv.is_owned = false;
44628         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
44629         int64_t ret_ref = 0;
44630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44632         return ret_ref;
44633 }
44634
44635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
44636         LDKChannelManager this_arg_conv;
44637         this_arg_conv.inner = untag_ptr(this_arg);
44638         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44640         this_arg_conv.is_owned = false;
44641         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
44642         int64_t ret_ref = 0;
44643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44645         return ret_ref;
44646 }
44647
44648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
44649         LDKChannelManager this_arg_conv;
44650         this_arg_conv.inner = untag_ptr(this_arg);
44651         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44653         this_arg_conv.is_owned = false;
44654         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
44655         int64_t ret_ref = 0;
44656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44658         return ret_ref;
44659 }
44660
44661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
44662         LDKChannelManager this_arg_conv;
44663         this_arg_conv.inner = untag_ptr(this_arg);
44664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44666         this_arg_conv.is_owned = false;
44667         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
44668         int64_t ret_ref = 0;
44669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44671         return ret_ref;
44672 }
44673
44674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
44675         LDKChannelManager this_arg_conv;
44676         this_arg_conv.inner = untag_ptr(this_arg);
44677         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44679         this_arg_conv.is_owned = false;
44680         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
44681         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
44682         return tag_ptr(ret_ret, true);
44683 }
44684
44685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1OffersMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
44686         LDKChannelManager this_arg_conv;
44687         this_arg_conv.inner = untag_ptr(this_arg);
44688         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44690         this_arg_conv.is_owned = false;
44691         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
44692         *ret_ret = ChannelManager_as_OffersMessageHandler(&this_arg_conv);
44693         return tag_ptr(ret_ret, true);
44694 }
44695
44696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_provided_1init_1features(JNIEnv *env, jclass clz, int64_t config) {
44697         LDKUserConfig config_conv;
44698         config_conv.inner = untag_ptr(config);
44699         config_conv.is_owned = ptr_is_owned(config);
44700         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
44701         config_conv.is_owned = false;
44702         LDKInitFeatures ret_var = provided_init_features(&config_conv);
44703         int64_t ret_ref = 0;
44704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44706         return ret_ref;
44707 }
44708
44709 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
44710         LDKCounterpartyForwardingInfo obj_conv;
44711         obj_conv.inner = untag_ptr(obj);
44712         obj_conv.is_owned = ptr_is_owned(obj);
44713         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44714         obj_conv.is_owned = false;
44715         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
44716         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44717         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44718         CVec_u8Z_free(ret_var);
44719         return ret_arr;
44720 }
44721
44722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44723         LDKu8slice ser_ref;
44724         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44725         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44726         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
44727         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
44728         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44729         return tag_ptr(ret_conv, true);
44730 }
44731
44732 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
44733         LDKChannelCounterparty obj_conv;
44734         obj_conv.inner = untag_ptr(obj);
44735         obj_conv.is_owned = ptr_is_owned(obj);
44736         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44737         obj_conv.is_owned = false;
44738         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
44739         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44740         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44741         CVec_u8Z_free(ret_var);
44742         return ret_arr;
44743 }
44744
44745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44746         LDKu8slice ser_ref;
44747         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44748         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44749         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
44750         *ret_conv = ChannelCounterparty_read(ser_ref);
44751         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44752         return tag_ptr(ret_conv, true);
44753 }
44754
44755 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
44756         LDKChannelDetails obj_conv;
44757         obj_conv.inner = untag_ptr(obj);
44758         obj_conv.is_owned = ptr_is_owned(obj);
44759         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44760         obj_conv.is_owned = false;
44761         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
44762         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44763         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44764         CVec_u8Z_free(ret_var);
44765         return ret_arr;
44766 }
44767
44768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44769         LDKu8slice ser_ref;
44770         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44771         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44772         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
44773         *ret_conv = ChannelDetails_read(ser_ref);
44774         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44775         return tag_ptr(ret_conv, true);
44776 }
44777
44778 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
44779         LDKPhantomRouteHints obj_conv;
44780         obj_conv.inner = untag_ptr(obj);
44781         obj_conv.is_owned = ptr_is_owned(obj);
44782         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44783         obj_conv.is_owned = false;
44784         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
44785         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44786         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44787         CVec_u8Z_free(ret_var);
44788         return ret_arr;
44789 }
44790
44791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44792         LDKu8slice ser_ref;
44793         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44794         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44795         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
44796         *ret_conv = PhantomRouteHints_read(ser_ref);
44797         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44798         return tag_ptr(ret_conv, true);
44799 }
44800
44801 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedForward_1write(JNIEnv *env, jclass clz, int64_t obj) {
44802         LDKBlindedForward obj_conv;
44803         obj_conv.inner = untag_ptr(obj);
44804         obj_conv.is_owned = ptr_is_owned(obj);
44805         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44806         obj_conv.is_owned = false;
44807         LDKCVec_u8Z ret_var = BlindedForward_write(&obj_conv);
44808         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44809         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44810         CVec_u8Z_free(ret_var);
44811         return ret_arr;
44812 }
44813
44814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44815         LDKu8slice ser_ref;
44816         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44817         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44818         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
44819         *ret_conv = BlindedForward_read(ser_ref);
44820         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44821         return tag_ptr(ret_conv, true);
44822 }
44823
44824 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1write(JNIEnv *env, jclass clz, int64_t obj) {
44825         LDKPendingHTLCRouting* obj_conv = (LDKPendingHTLCRouting*)untag_ptr(obj);
44826         LDKCVec_u8Z ret_var = PendingHTLCRouting_write(obj_conv);
44827         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44828         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44829         CVec_u8Z_free(ret_var);
44830         return ret_arr;
44831 }
44832
44833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44834         LDKu8slice ser_ref;
44835         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44836         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44837         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
44838         *ret_conv = PendingHTLCRouting_read(ser_ref);
44839         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44840         return tag_ptr(ret_conv, true);
44841 }
44842
44843 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
44844         LDKPendingHTLCInfo obj_conv;
44845         obj_conv.inner = untag_ptr(obj);
44846         obj_conv.is_owned = ptr_is_owned(obj);
44847         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44848         obj_conv.is_owned = false;
44849         LDKCVec_u8Z ret_var = PendingHTLCInfo_write(&obj_conv);
44850         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44851         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44852         CVec_u8Z_free(ret_var);
44853         return ret_arr;
44854 }
44855
44856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44857         LDKu8slice ser_ref;
44858         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44859         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44860         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
44861         *ret_conv = PendingHTLCInfo_read(ser_ref);
44862         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44863         return tag_ptr(ret_conv, true);
44864 }
44865
44866 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1write(JNIEnv *env, jclass clz, int64_t obj) {
44867         LDKBlindedFailure* obj_conv = (LDKBlindedFailure*)untag_ptr(obj);
44868         LDKCVec_u8Z ret_var = BlindedFailure_write(obj_conv);
44869         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44870         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44871         CVec_u8Z_free(ret_var);
44872         return ret_arr;
44873 }
44874
44875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44876         LDKu8slice ser_ref;
44877         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44878         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44879         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
44880         *ret_conv = BlindedFailure_read(ser_ref);
44881         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44882         return tag_ptr(ret_conv, true);
44883 }
44884
44885 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
44886         LDKChannelManager obj_conv;
44887         obj_conv.inner = untag_ptr(obj);
44888         obj_conv.is_owned = ptr_is_owned(obj);
44889         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44890         obj_conv.is_owned = false;
44891         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
44892         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44893         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44894         CVec_u8Z_free(ret_var);
44895         return ret_arr;
44896 }
44897
44898 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1write(JNIEnv *env, jclass clz, int64_t obj) {
44899         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
44900         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
44901         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44902         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44903         CVec_u8Z_free(ret_var);
44904         return ret_arr;
44905 }
44906
44907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44908         LDKu8slice ser_ref;
44909         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44910         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44911         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
44912         *ret_conv = ChannelShutdownState_read(ser_ref);
44913         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44914         return tag_ptr(ret_conv, true);
44915 }
44916
44917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44918         LDKChannelManagerReadArgs this_obj_conv;
44919         this_obj_conv.inner = untag_ptr(this_obj);
44920         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44922         ChannelManagerReadArgs_free(this_obj_conv);
44923 }
44924
44925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr) {
44926         LDKChannelManagerReadArgs this_ptr_conv;
44927         this_ptr_conv.inner = untag_ptr(this_ptr);
44928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44930         this_ptr_conv.is_owned = false;
44931         // WARNING: This object doesn't live past this scope, needs clone!
44932         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
44933         return ret_ret;
44934 }
44935
44936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44937         LDKChannelManagerReadArgs this_ptr_conv;
44938         this_ptr_conv.inner = untag_ptr(this_ptr);
44939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44941         this_ptr_conv.is_owned = false;
44942         void* val_ptr = untag_ptr(val);
44943         CHECK_ACCESS(val_ptr);
44944         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
44945         if (val_conv.free == LDKEntropySource_JCalls_free) {
44946                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44947                 LDKEntropySource_JCalls_cloned(&val_conv);
44948         }
44949         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
44950 }
44951
44952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr) {
44953         LDKChannelManagerReadArgs this_ptr_conv;
44954         this_ptr_conv.inner = untag_ptr(this_ptr);
44955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44957         this_ptr_conv.is_owned = false;
44958         // WARNING: This object doesn't live past this scope, needs clone!
44959         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
44960         return ret_ret;
44961 }
44962
44963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44964         LDKChannelManagerReadArgs this_ptr_conv;
44965         this_ptr_conv.inner = untag_ptr(this_ptr);
44966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44968         this_ptr_conv.is_owned = false;
44969         void* val_ptr = untag_ptr(val);
44970         CHECK_ACCESS(val_ptr);
44971         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
44972         if (val_conv.free == LDKNodeSigner_JCalls_free) {
44973                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44974                 LDKNodeSigner_JCalls_cloned(&val_conv);
44975         }
44976         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
44977 }
44978
44979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr) {
44980         LDKChannelManagerReadArgs this_ptr_conv;
44981         this_ptr_conv.inner = untag_ptr(this_ptr);
44982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44984         this_ptr_conv.is_owned = false;
44985         // WARNING: This object doesn't live past this scope, needs clone!
44986         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
44987         return ret_ret;
44988 }
44989
44990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44991         LDKChannelManagerReadArgs this_ptr_conv;
44992         this_ptr_conv.inner = untag_ptr(this_ptr);
44993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44995         this_ptr_conv.is_owned = false;
44996         void* val_ptr = untag_ptr(val);
44997         CHECK_ACCESS(val_ptr);
44998         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
44999         if (val_conv.free == LDKSignerProvider_JCalls_free) {
45000                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45001                 LDKSignerProvider_JCalls_cloned(&val_conv);
45002         }
45003         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
45004 }
45005
45006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
45007         LDKChannelManagerReadArgs this_ptr_conv;
45008         this_ptr_conv.inner = untag_ptr(this_ptr);
45009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45011         this_ptr_conv.is_owned = false;
45012         // WARNING: This object doesn't live past this scope, needs clone!
45013         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
45014         return ret_ret;
45015 }
45016
45017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45018         LDKChannelManagerReadArgs this_ptr_conv;
45019         this_ptr_conv.inner = untag_ptr(this_ptr);
45020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45022         this_ptr_conv.is_owned = false;
45023         void* val_ptr = untag_ptr(val);
45024         CHECK_ACCESS(val_ptr);
45025         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
45026         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
45027                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45028                 LDKFeeEstimator_JCalls_cloned(&val_conv);
45029         }
45030         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
45031 }
45032
45033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
45034         LDKChannelManagerReadArgs this_ptr_conv;
45035         this_ptr_conv.inner = untag_ptr(this_ptr);
45036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45038         this_ptr_conv.is_owned = false;
45039         // WARNING: This object doesn't live past this scope, needs clone!
45040         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
45041         return ret_ret;
45042 }
45043
45044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45045         LDKChannelManagerReadArgs this_ptr_conv;
45046         this_ptr_conv.inner = untag_ptr(this_ptr);
45047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45049         this_ptr_conv.is_owned = false;
45050         void* val_ptr = untag_ptr(val);
45051         CHECK_ACCESS(val_ptr);
45052         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
45053         if (val_conv.free == LDKWatch_JCalls_free) {
45054                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45055                 LDKWatch_JCalls_cloned(&val_conv);
45056         }
45057         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
45058 }
45059
45060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
45061         LDKChannelManagerReadArgs this_ptr_conv;
45062         this_ptr_conv.inner = untag_ptr(this_ptr);
45063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45065         this_ptr_conv.is_owned = false;
45066         // WARNING: This object doesn't live past this scope, needs clone!
45067         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
45068         return ret_ret;
45069 }
45070
45071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45072         LDKChannelManagerReadArgs this_ptr_conv;
45073         this_ptr_conv.inner = untag_ptr(this_ptr);
45074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45076         this_ptr_conv.is_owned = false;
45077         void* val_ptr = untag_ptr(val);
45078         CHECK_ACCESS(val_ptr);
45079         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
45080         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
45081                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45082                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
45083         }
45084         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
45085 }
45086
45087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1router(JNIEnv *env, jclass clz, int64_t this_ptr) {
45088         LDKChannelManagerReadArgs this_ptr_conv;
45089         this_ptr_conv.inner = untag_ptr(this_ptr);
45090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45092         this_ptr_conv.is_owned = false;
45093         // WARNING: This object doesn't live past this scope, needs clone!
45094         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
45095         return ret_ret;
45096 }
45097
45098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1router(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45099         LDKChannelManagerReadArgs this_ptr_conv;
45100         this_ptr_conv.inner = untag_ptr(this_ptr);
45101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45103         this_ptr_conv.is_owned = false;
45104         void* val_ptr = untag_ptr(val);
45105         CHECK_ACCESS(val_ptr);
45106         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
45107         if (val_conv.free == LDKRouter_JCalls_free) {
45108                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45109                 LDKRouter_JCalls_cloned(&val_conv);
45110         }
45111         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
45112 }
45113
45114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
45115         LDKChannelManagerReadArgs this_ptr_conv;
45116         this_ptr_conv.inner = untag_ptr(this_ptr);
45117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45119         this_ptr_conv.is_owned = false;
45120         // WARNING: This object doesn't live past this scope, needs clone!
45121         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
45122         return ret_ret;
45123 }
45124
45125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45126         LDKChannelManagerReadArgs this_ptr_conv;
45127         this_ptr_conv.inner = untag_ptr(this_ptr);
45128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45130         this_ptr_conv.is_owned = false;
45131         void* val_ptr = untag_ptr(val);
45132         CHECK_ACCESS(val_ptr);
45133         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
45134         if (val_conv.free == LDKLogger_JCalls_free) {
45135                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45136                 LDKLogger_JCalls_cloned(&val_conv);
45137         }
45138         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
45139 }
45140
45141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
45142         LDKChannelManagerReadArgs this_ptr_conv;
45143         this_ptr_conv.inner = untag_ptr(this_ptr);
45144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45146         this_ptr_conv.is_owned = false;
45147         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
45148         int64_t ret_ref = 0;
45149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45151         return ret_ref;
45152 }
45153
45154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45155         LDKChannelManagerReadArgs this_ptr_conv;
45156         this_ptr_conv.inner = untag_ptr(this_ptr);
45157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45159         this_ptr_conv.is_owned = false;
45160         LDKUserConfig val_conv;
45161         val_conv.inner = untag_ptr(val);
45162         val_conv.is_owned = ptr_is_owned(val);
45163         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45164         val_conv = UserConfig_clone(&val_conv);
45165         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
45166 }
45167
45168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t signer_provider, int64_t fee_estimator, int64_t chain_monitor, int64_t tx_broadcaster, int64_t router, int64_t logger, int64_t default_config, int64_tArray channel_monitors) {
45169         void* entropy_source_ptr = untag_ptr(entropy_source);
45170         CHECK_ACCESS(entropy_source_ptr);
45171         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
45172         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
45173                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45174                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
45175         }
45176         void* node_signer_ptr = untag_ptr(node_signer);
45177         CHECK_ACCESS(node_signer_ptr);
45178         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
45179         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
45180                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45181                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
45182         }
45183         void* signer_provider_ptr = untag_ptr(signer_provider);
45184         CHECK_ACCESS(signer_provider_ptr);
45185         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
45186         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
45187                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45188                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
45189         }
45190         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45191         CHECK_ACCESS(fee_estimator_ptr);
45192         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
45193         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
45194                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45195                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
45196         }
45197         void* chain_monitor_ptr = untag_ptr(chain_monitor);
45198         CHECK_ACCESS(chain_monitor_ptr);
45199         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
45200         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
45201                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45202                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
45203         }
45204         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
45205         CHECK_ACCESS(tx_broadcaster_ptr);
45206         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
45207         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
45208                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45209                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
45210         }
45211         void* router_ptr = untag_ptr(router);
45212         CHECK_ACCESS(router_ptr);
45213         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
45214         if (router_conv.free == LDKRouter_JCalls_free) {
45215                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45216                 LDKRouter_JCalls_cloned(&router_conv);
45217         }
45218         void* logger_ptr = untag_ptr(logger);
45219         CHECK_ACCESS(logger_ptr);
45220         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45221         if (logger_conv.free == LDKLogger_JCalls_free) {
45222                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45223                 LDKLogger_JCalls_cloned(&logger_conv);
45224         }
45225         LDKUserConfig default_config_conv;
45226         default_config_conv.inner = untag_ptr(default_config);
45227         default_config_conv.is_owned = ptr_is_owned(default_config);
45228         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
45229         default_config_conv = UserConfig_clone(&default_config_conv);
45230         LDKCVec_ChannelMonitorZ channel_monitors_constr;
45231         channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
45232         if (channel_monitors_constr.datalen > 0)
45233                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
45234         else
45235                 channel_monitors_constr.data = NULL;
45236         int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
45237         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
45238                 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
45239                 LDKChannelMonitor channel_monitors_conv_16_conv;
45240                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
45241                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
45242                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
45243                 channel_monitors_conv_16_conv.is_owned = false;
45244                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
45245         }
45246         (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
45247         LDKChannelManagerReadArgs ret_var = ChannelManagerReadArgs_new(entropy_source_conv, node_signer_conv, signer_provider_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, router_conv, logger_conv, default_config_conv, channel_monitors_constr);
45248         int64_t ret_ref = 0;
45249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45251         return ret_ref;
45252 }
45253
45254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
45255         LDKu8slice ser_ref;
45256         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45257         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45258         LDKChannelManagerReadArgs arg_conv;
45259         arg_conv.inner = untag_ptr(arg);
45260         arg_conv.is_owned = ptr_is_owned(arg);
45261         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45262         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
45263         
45264         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
45265         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser_ref, arg_conv);
45266         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45267         return tag_ptr(ret_conv, true);
45268 }
45269
45270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45271         LDKDelayedPaymentBasepoint this_obj_conv;
45272         this_obj_conv.inner = untag_ptr(this_obj);
45273         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45275         DelayedPaymentBasepoint_free(this_obj_conv);
45276 }
45277
45278 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
45279         LDKDelayedPaymentBasepoint this_ptr_conv;
45280         this_ptr_conv.inner = untag_ptr(this_ptr);
45281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45283         this_ptr_conv.is_owned = false;
45284         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45285         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentBasepoint_get_a(&this_ptr_conv).compressed_form);
45286         return ret_arr;
45287 }
45288
45289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45290         LDKDelayedPaymentBasepoint this_ptr_conv;
45291         this_ptr_conv.inner = untag_ptr(this_ptr);
45292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45294         this_ptr_conv.is_owned = false;
45295         LDKPublicKey val_ref;
45296         CHECK((*env)->GetArrayLength(env, val) == 33);
45297         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
45298         DelayedPaymentBasepoint_set_a(&this_ptr_conv, val_ref);
45299 }
45300
45301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
45302         LDKPublicKey a_arg_ref;
45303         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
45304         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
45305         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_new(a_arg_ref);
45306         int64_t ret_ref = 0;
45307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45309         return ret_ref;
45310 }
45311
45312 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45313         LDKDelayedPaymentBasepoint a_conv;
45314         a_conv.inner = untag_ptr(a);
45315         a_conv.is_owned = ptr_is_owned(a);
45316         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45317         a_conv.is_owned = false;
45318         LDKDelayedPaymentBasepoint b_conv;
45319         b_conv.inner = untag_ptr(b);
45320         b_conv.is_owned = ptr_is_owned(b);
45321         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45322         b_conv.is_owned = false;
45323         jboolean ret_conv = DelayedPaymentBasepoint_eq(&a_conv, &b_conv);
45324         return ret_conv;
45325 }
45326
45327 static inline uint64_t DelayedPaymentBasepoint_clone_ptr(LDKDelayedPaymentBasepoint *NONNULL_PTR arg) {
45328         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(arg);
45329         int64_t ret_ref = 0;
45330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45332         return ret_ref;
45333 }
45334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45335         LDKDelayedPaymentBasepoint arg_conv;
45336         arg_conv.inner = untag_ptr(arg);
45337         arg_conv.is_owned = ptr_is_owned(arg);
45338         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45339         arg_conv.is_owned = false;
45340         int64_t ret_conv = DelayedPaymentBasepoint_clone_ptr(&arg_conv);
45341         return ret_conv;
45342 }
45343
45344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45345         LDKDelayedPaymentBasepoint orig_conv;
45346         orig_conv.inner = untag_ptr(orig);
45347         orig_conv.is_owned = ptr_is_owned(orig);
45348         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45349         orig_conv.is_owned = false;
45350         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(&orig_conv);
45351         int64_t ret_ref = 0;
45352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45354         return ret_ref;
45355 }
45356
45357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
45358         LDKDelayedPaymentBasepoint o_conv;
45359         o_conv.inner = untag_ptr(o);
45360         o_conv.is_owned = ptr_is_owned(o);
45361         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45362         o_conv.is_owned = false;
45363         int64_t ret_conv = DelayedPaymentBasepoint_hash(&o_conv);
45364         return ret_conv;
45365 }
45366
45367 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
45368         LDKDelayedPaymentBasepoint this_arg_conv;
45369         this_arg_conv.inner = untag_ptr(this_arg);
45370         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45372         this_arg_conv.is_owned = false;
45373         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45374         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentBasepoint_to_public_key(&this_arg_conv).compressed_form);
45375         return ret_arr;
45376 }
45377
45378 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
45379         LDKDelayedPaymentBasepoint obj_conv;
45380         obj_conv.inner = untag_ptr(obj);
45381         obj_conv.is_owned = ptr_is_owned(obj);
45382         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45383         obj_conv.is_owned = false;
45384         LDKCVec_u8Z ret_var = DelayedPaymentBasepoint_write(&obj_conv);
45385         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45386         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45387         CVec_u8Z_free(ret_var);
45388         return ret_arr;
45389 }
45390
45391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45392         LDKu8slice ser_ref;
45393         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45394         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45395         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
45396         *ret_conv = DelayedPaymentBasepoint_read(ser_ref);
45397         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45398         return tag_ptr(ret_conv, true);
45399 }
45400
45401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45402         LDKDelayedPaymentKey this_obj_conv;
45403         this_obj_conv.inner = untag_ptr(this_obj);
45404         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45406         DelayedPaymentKey_free(this_obj_conv);
45407 }
45408
45409 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
45410         LDKDelayedPaymentKey this_ptr_conv;
45411         this_ptr_conv.inner = untag_ptr(this_ptr);
45412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45414         this_ptr_conv.is_owned = false;
45415         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45416         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentKey_get_a(&this_ptr_conv).compressed_form);
45417         return ret_arr;
45418 }
45419
45420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45421         LDKDelayedPaymentKey this_ptr_conv;
45422         this_ptr_conv.inner = untag_ptr(this_ptr);
45423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45425         this_ptr_conv.is_owned = false;
45426         LDKPublicKey val_ref;
45427         CHECK((*env)->GetArrayLength(env, val) == 33);
45428         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
45429         DelayedPaymentKey_set_a(&this_ptr_conv, val_ref);
45430 }
45431
45432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
45433         LDKPublicKey a_arg_ref;
45434         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
45435         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
45436         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_new(a_arg_ref);
45437         int64_t ret_ref = 0;
45438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45440         return ret_ref;
45441 }
45442
45443 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45444         LDKDelayedPaymentKey a_conv;
45445         a_conv.inner = untag_ptr(a);
45446         a_conv.is_owned = ptr_is_owned(a);
45447         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45448         a_conv.is_owned = false;
45449         LDKDelayedPaymentKey b_conv;
45450         b_conv.inner = untag_ptr(b);
45451         b_conv.is_owned = ptr_is_owned(b);
45452         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45453         b_conv.is_owned = false;
45454         jboolean ret_conv = DelayedPaymentKey_eq(&a_conv, &b_conv);
45455         return ret_conv;
45456 }
45457
45458 static inline uint64_t DelayedPaymentKey_clone_ptr(LDKDelayedPaymentKey *NONNULL_PTR arg) {
45459         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(arg);
45460         int64_t ret_ref = 0;
45461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45463         return ret_ref;
45464 }
45465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45466         LDKDelayedPaymentKey arg_conv;
45467         arg_conv.inner = untag_ptr(arg);
45468         arg_conv.is_owned = ptr_is_owned(arg);
45469         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45470         arg_conv.is_owned = false;
45471         int64_t ret_conv = DelayedPaymentKey_clone_ptr(&arg_conv);
45472         return ret_conv;
45473 }
45474
45475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45476         LDKDelayedPaymentKey orig_conv;
45477         orig_conv.inner = untag_ptr(orig);
45478         orig_conv.is_owned = ptr_is_owned(orig);
45479         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45480         orig_conv.is_owned = false;
45481         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(&orig_conv);
45482         int64_t ret_ref = 0;
45483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45485         return ret_ref;
45486 }
45487
45488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1from_1basepoint(JNIEnv *env, jclass clz, int64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
45489         LDKDelayedPaymentBasepoint countersignatory_basepoint_conv;
45490         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
45491         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
45492         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
45493         countersignatory_basepoint_conv.is_owned = false;
45494         LDKPublicKey per_commitment_point_ref;
45495         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
45496         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
45497         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
45498         int64_t ret_ref = 0;
45499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45501         return ret_ref;
45502 }
45503
45504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1from_1secret_1key(JNIEnv *env, jclass clz, int8_tArray sk) {
45505         uint8_t sk_arr[32];
45506         CHECK((*env)->GetArrayLength(env, sk) == 32);
45507         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
45508         uint8_t (*sk_ref)[32] = &sk_arr;
45509         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_secret_key(sk_ref);
45510         int64_t ret_ref = 0;
45511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45513         return ret_ref;
45514 }
45515
45516 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
45517         LDKDelayedPaymentKey this_arg_conv;
45518         this_arg_conv.inner = untag_ptr(this_arg);
45519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45521         this_arg_conv.is_owned = false;
45522         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45523         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentKey_to_public_key(&this_arg_conv).compressed_form);
45524         return ret_arr;
45525 }
45526
45527 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1write(JNIEnv *env, jclass clz, int64_t obj) {
45528         LDKDelayedPaymentKey obj_conv;
45529         obj_conv.inner = untag_ptr(obj);
45530         obj_conv.is_owned = ptr_is_owned(obj);
45531         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45532         obj_conv.is_owned = false;
45533         LDKCVec_u8Z ret_var = DelayedPaymentKey_write(&obj_conv);
45534         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45535         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45536         CVec_u8Z_free(ret_var);
45537         return ret_arr;
45538 }
45539
45540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45541         LDKu8slice ser_ref;
45542         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45543         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45544         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
45545         *ret_conv = DelayedPaymentKey_read(ser_ref);
45546         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45547         return tag_ptr(ret_conv, true);
45548 }
45549
45550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45551         LDKHtlcBasepoint this_obj_conv;
45552         this_obj_conv.inner = untag_ptr(this_obj);
45553         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45555         HtlcBasepoint_free(this_obj_conv);
45556 }
45557
45558 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
45559         LDKHtlcBasepoint this_ptr_conv;
45560         this_ptr_conv.inner = untag_ptr(this_ptr);
45561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45563         this_ptr_conv.is_owned = false;
45564         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45565         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HtlcBasepoint_get_a(&this_ptr_conv).compressed_form);
45566         return ret_arr;
45567 }
45568
45569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45570         LDKHtlcBasepoint this_ptr_conv;
45571         this_ptr_conv.inner = untag_ptr(this_ptr);
45572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45574         this_ptr_conv.is_owned = false;
45575         LDKPublicKey val_ref;
45576         CHECK((*env)->GetArrayLength(env, val) == 33);
45577         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
45578         HtlcBasepoint_set_a(&this_ptr_conv, val_ref);
45579 }
45580
45581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
45582         LDKPublicKey a_arg_ref;
45583         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
45584         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
45585         LDKHtlcBasepoint ret_var = HtlcBasepoint_new(a_arg_ref);
45586         int64_t ret_ref = 0;
45587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45589         return ret_ref;
45590 }
45591
45592 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45593         LDKHtlcBasepoint a_conv;
45594         a_conv.inner = untag_ptr(a);
45595         a_conv.is_owned = ptr_is_owned(a);
45596         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45597         a_conv.is_owned = false;
45598         LDKHtlcBasepoint b_conv;
45599         b_conv.inner = untag_ptr(b);
45600         b_conv.is_owned = ptr_is_owned(b);
45601         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45602         b_conv.is_owned = false;
45603         jboolean ret_conv = HtlcBasepoint_eq(&a_conv, &b_conv);
45604         return ret_conv;
45605 }
45606
45607 static inline uint64_t HtlcBasepoint_clone_ptr(LDKHtlcBasepoint *NONNULL_PTR arg) {
45608         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(arg);
45609         int64_t ret_ref = 0;
45610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45612         return ret_ref;
45613 }
45614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45615         LDKHtlcBasepoint arg_conv;
45616         arg_conv.inner = untag_ptr(arg);
45617         arg_conv.is_owned = ptr_is_owned(arg);
45618         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45619         arg_conv.is_owned = false;
45620         int64_t ret_conv = HtlcBasepoint_clone_ptr(&arg_conv);
45621         return ret_conv;
45622 }
45623
45624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45625         LDKHtlcBasepoint orig_conv;
45626         orig_conv.inner = untag_ptr(orig);
45627         orig_conv.is_owned = ptr_is_owned(orig);
45628         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45629         orig_conv.is_owned = false;
45630         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(&orig_conv);
45631         int64_t ret_ref = 0;
45632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45634         return ret_ref;
45635 }
45636
45637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
45638         LDKHtlcBasepoint o_conv;
45639         o_conv.inner = untag_ptr(o);
45640         o_conv.is_owned = ptr_is_owned(o);
45641         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45642         o_conv.is_owned = false;
45643         int64_t ret_conv = HtlcBasepoint_hash(&o_conv);
45644         return ret_conv;
45645 }
45646
45647 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
45648         LDKHtlcBasepoint this_arg_conv;
45649         this_arg_conv.inner = untag_ptr(this_arg);
45650         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45652         this_arg_conv.is_owned = false;
45653         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45654         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HtlcBasepoint_to_public_key(&this_arg_conv).compressed_form);
45655         return ret_arr;
45656 }
45657
45658 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
45659         LDKHtlcBasepoint obj_conv;
45660         obj_conv.inner = untag_ptr(obj);
45661         obj_conv.is_owned = ptr_is_owned(obj);
45662         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45663         obj_conv.is_owned = false;
45664         LDKCVec_u8Z ret_var = HtlcBasepoint_write(&obj_conv);
45665         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45666         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45667         CVec_u8Z_free(ret_var);
45668         return ret_arr;
45669 }
45670
45671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45672         LDKu8slice ser_ref;
45673         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45674         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45675         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
45676         *ret_conv = HtlcBasepoint_read(ser_ref);
45677         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45678         return tag_ptr(ret_conv, true);
45679 }
45680
45681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HtlcKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45682         LDKHtlcKey this_obj_conv;
45683         this_obj_conv.inner = untag_ptr(this_obj);
45684         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45686         HtlcKey_free(this_obj_conv);
45687 }
45688
45689 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
45690         LDKHtlcKey this_ptr_conv;
45691         this_ptr_conv.inner = untag_ptr(this_ptr);
45692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45694         this_ptr_conv.is_owned = false;
45695         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45696         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HtlcKey_get_a(&this_ptr_conv).compressed_form);
45697         return ret_arr;
45698 }
45699
45700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HtlcKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45701         LDKHtlcKey this_ptr_conv;
45702         this_ptr_conv.inner = untag_ptr(this_ptr);
45703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45705         this_ptr_conv.is_owned = false;
45706         LDKPublicKey val_ref;
45707         CHECK((*env)->GetArrayLength(env, val) == 33);
45708         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
45709         HtlcKey_set_a(&this_ptr_conv, val_ref);
45710 }
45711
45712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
45713         LDKPublicKey a_arg_ref;
45714         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
45715         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
45716         LDKHtlcKey ret_var = HtlcKey_new(a_arg_ref);
45717         int64_t ret_ref = 0;
45718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45720         return ret_ref;
45721 }
45722
45723 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HtlcKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45724         LDKHtlcKey a_conv;
45725         a_conv.inner = untag_ptr(a);
45726         a_conv.is_owned = ptr_is_owned(a);
45727         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45728         a_conv.is_owned = false;
45729         LDKHtlcKey b_conv;
45730         b_conv.inner = untag_ptr(b);
45731         b_conv.is_owned = ptr_is_owned(b);
45732         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45733         b_conv.is_owned = false;
45734         jboolean ret_conv = HtlcKey_eq(&a_conv, &b_conv);
45735         return ret_conv;
45736 }
45737
45738 static inline uint64_t HtlcKey_clone_ptr(LDKHtlcKey *NONNULL_PTR arg) {
45739         LDKHtlcKey ret_var = HtlcKey_clone(arg);
45740         int64_t ret_ref = 0;
45741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45743         return ret_ref;
45744 }
45745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45746         LDKHtlcKey arg_conv;
45747         arg_conv.inner = untag_ptr(arg);
45748         arg_conv.is_owned = ptr_is_owned(arg);
45749         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45750         arg_conv.is_owned = false;
45751         int64_t ret_conv = HtlcKey_clone_ptr(&arg_conv);
45752         return ret_conv;
45753 }
45754
45755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45756         LDKHtlcKey orig_conv;
45757         orig_conv.inner = untag_ptr(orig);
45758         orig_conv.is_owned = ptr_is_owned(orig);
45759         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45760         orig_conv.is_owned = false;
45761         LDKHtlcKey ret_var = HtlcKey_clone(&orig_conv);
45762         int64_t ret_ref = 0;
45763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45765         return ret_ref;
45766 }
45767
45768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1from_1basepoint(JNIEnv *env, jclass clz, int64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
45769         LDKHtlcBasepoint countersignatory_basepoint_conv;
45770         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
45771         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
45772         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
45773         countersignatory_basepoint_conv.is_owned = false;
45774         LDKPublicKey per_commitment_point_ref;
45775         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
45776         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
45777         LDKHtlcKey ret_var = HtlcKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
45778         int64_t ret_ref = 0;
45779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45781         return ret_ref;
45782 }
45783
45784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1from_1secret_1key(JNIEnv *env, jclass clz, int8_tArray sk) {
45785         uint8_t sk_arr[32];
45786         CHECK((*env)->GetArrayLength(env, sk) == 32);
45787         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
45788         uint8_t (*sk_ref)[32] = &sk_arr;
45789         LDKHtlcKey ret_var = HtlcKey_from_secret_key(sk_ref);
45790         int64_t ret_ref = 0;
45791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45793         return ret_ref;
45794 }
45795
45796 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcKey_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
45797         LDKHtlcKey this_arg_conv;
45798         this_arg_conv.inner = untag_ptr(this_arg);
45799         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45801         this_arg_conv.is_owned = false;
45802         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45803         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HtlcKey_to_public_key(&this_arg_conv).compressed_form);
45804         return ret_arr;
45805 }
45806
45807 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcKey_1write(JNIEnv *env, jclass clz, int64_t obj) {
45808         LDKHtlcKey obj_conv;
45809         obj_conv.inner = untag_ptr(obj);
45810         obj_conv.is_owned = ptr_is_owned(obj);
45811         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45812         obj_conv.is_owned = false;
45813         LDKCVec_u8Z ret_var = HtlcKey_write(&obj_conv);
45814         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45815         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45816         CVec_u8Z_free(ret_var);
45817         return ret_arr;
45818 }
45819
45820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45821         LDKu8slice ser_ref;
45822         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45823         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45824         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
45825         *ret_conv = HtlcKey_read(ser_ref);
45826         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45827         return tag_ptr(ret_conv, true);
45828 }
45829
45830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45831         LDKRevocationBasepoint this_obj_conv;
45832         this_obj_conv.inner = untag_ptr(this_obj);
45833         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45835         RevocationBasepoint_free(this_obj_conv);
45836 }
45837
45838 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
45839         LDKRevocationBasepoint this_ptr_conv;
45840         this_ptr_conv.inner = untag_ptr(this_ptr);
45841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45843         this_ptr_conv.is_owned = false;
45844         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45845         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevocationBasepoint_get_a(&this_ptr_conv).compressed_form);
45846         return ret_arr;
45847 }
45848
45849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45850         LDKRevocationBasepoint this_ptr_conv;
45851         this_ptr_conv.inner = untag_ptr(this_ptr);
45852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45854         this_ptr_conv.is_owned = false;
45855         LDKPublicKey val_ref;
45856         CHECK((*env)->GetArrayLength(env, val) == 33);
45857         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
45858         RevocationBasepoint_set_a(&this_ptr_conv, val_ref);
45859 }
45860
45861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
45862         LDKPublicKey a_arg_ref;
45863         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
45864         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
45865         LDKRevocationBasepoint ret_var = RevocationBasepoint_new(a_arg_ref);
45866         int64_t ret_ref = 0;
45867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45869         return ret_ref;
45870 }
45871
45872 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45873         LDKRevocationBasepoint a_conv;
45874         a_conv.inner = untag_ptr(a);
45875         a_conv.is_owned = ptr_is_owned(a);
45876         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45877         a_conv.is_owned = false;
45878         LDKRevocationBasepoint b_conv;
45879         b_conv.inner = untag_ptr(b);
45880         b_conv.is_owned = ptr_is_owned(b);
45881         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45882         b_conv.is_owned = false;
45883         jboolean ret_conv = RevocationBasepoint_eq(&a_conv, &b_conv);
45884         return ret_conv;
45885 }
45886
45887 static inline uint64_t RevocationBasepoint_clone_ptr(LDKRevocationBasepoint *NONNULL_PTR arg) {
45888         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(arg);
45889         int64_t ret_ref = 0;
45890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45892         return ret_ref;
45893 }
45894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45895         LDKRevocationBasepoint arg_conv;
45896         arg_conv.inner = untag_ptr(arg);
45897         arg_conv.is_owned = ptr_is_owned(arg);
45898         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45899         arg_conv.is_owned = false;
45900         int64_t ret_conv = RevocationBasepoint_clone_ptr(&arg_conv);
45901         return ret_conv;
45902 }
45903
45904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45905         LDKRevocationBasepoint orig_conv;
45906         orig_conv.inner = untag_ptr(orig);
45907         orig_conv.is_owned = ptr_is_owned(orig);
45908         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45909         orig_conv.is_owned = false;
45910         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(&orig_conv);
45911         int64_t ret_ref = 0;
45912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45914         return ret_ref;
45915 }
45916
45917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
45918         LDKRevocationBasepoint o_conv;
45919         o_conv.inner = untag_ptr(o);
45920         o_conv.is_owned = ptr_is_owned(o);
45921         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45922         o_conv.is_owned = false;
45923         int64_t ret_conv = RevocationBasepoint_hash(&o_conv);
45924         return ret_conv;
45925 }
45926
45927 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
45928         LDKRevocationBasepoint this_arg_conv;
45929         this_arg_conv.inner = untag_ptr(this_arg);
45930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45932         this_arg_conv.is_owned = false;
45933         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45934         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevocationBasepoint_to_public_key(&this_arg_conv).compressed_form);
45935         return ret_arr;
45936 }
45937
45938 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
45939         LDKRevocationBasepoint obj_conv;
45940         obj_conv.inner = untag_ptr(obj);
45941         obj_conv.is_owned = ptr_is_owned(obj);
45942         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45943         obj_conv.is_owned = false;
45944         LDKCVec_u8Z ret_var = RevocationBasepoint_write(&obj_conv);
45945         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45946         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45947         CVec_u8Z_free(ret_var);
45948         return ret_arr;
45949 }
45950
45951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45952         LDKu8slice ser_ref;
45953         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45954         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45955         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
45956         *ret_conv = RevocationBasepoint_read(ser_ref);
45957         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45958         return tag_ptr(ret_conv, true);
45959 }
45960
45961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevocationKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45962         LDKRevocationKey this_obj_conv;
45963         this_obj_conv.inner = untag_ptr(this_obj);
45964         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45966         RevocationKey_free(this_obj_conv);
45967 }
45968
45969 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
45970         LDKRevocationKey this_ptr_conv;
45971         this_ptr_conv.inner = untag_ptr(this_ptr);
45972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45974         this_ptr_conv.is_owned = false;
45975         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45976         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevocationKey_get_a(&this_ptr_conv).compressed_form);
45977         return ret_arr;
45978 }
45979
45980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevocationKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45981         LDKRevocationKey this_ptr_conv;
45982         this_ptr_conv.inner = untag_ptr(this_ptr);
45983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45985         this_ptr_conv.is_owned = false;
45986         LDKPublicKey val_ref;
45987         CHECK((*env)->GetArrayLength(env, val) == 33);
45988         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
45989         RevocationKey_set_a(&this_ptr_conv, val_ref);
45990 }
45991
45992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
45993         LDKPublicKey a_arg_ref;
45994         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
45995         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
45996         LDKRevocationKey ret_var = RevocationKey_new(a_arg_ref);
45997         int64_t ret_ref = 0;
45998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46000         return ret_ref;
46001 }
46002
46003 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RevocationKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46004         LDKRevocationKey a_conv;
46005         a_conv.inner = untag_ptr(a);
46006         a_conv.is_owned = ptr_is_owned(a);
46007         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46008         a_conv.is_owned = false;
46009         LDKRevocationKey b_conv;
46010         b_conv.inner = untag_ptr(b);
46011         b_conv.is_owned = ptr_is_owned(b);
46012         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46013         b_conv.is_owned = false;
46014         jboolean ret_conv = RevocationKey_eq(&a_conv, &b_conv);
46015         return ret_conv;
46016 }
46017
46018 static inline uint64_t RevocationKey_clone_ptr(LDKRevocationKey *NONNULL_PTR arg) {
46019         LDKRevocationKey ret_var = RevocationKey_clone(arg);
46020         int64_t ret_ref = 0;
46021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46023         return ret_ref;
46024 }
46025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46026         LDKRevocationKey arg_conv;
46027         arg_conv.inner = untag_ptr(arg);
46028         arg_conv.is_owned = ptr_is_owned(arg);
46029         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46030         arg_conv.is_owned = false;
46031         int64_t ret_conv = RevocationKey_clone_ptr(&arg_conv);
46032         return ret_conv;
46033 }
46034
46035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46036         LDKRevocationKey orig_conv;
46037         orig_conv.inner = untag_ptr(orig);
46038         orig_conv.is_owned = ptr_is_owned(orig);
46039         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46040         orig_conv.is_owned = false;
46041         LDKRevocationKey ret_var = RevocationKey_clone(&orig_conv);
46042         int64_t ret_ref = 0;
46043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46045         return ret_ref;
46046 }
46047
46048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
46049         LDKRevocationKey o_conv;
46050         o_conv.inner = untag_ptr(o);
46051         o_conv.is_owned = ptr_is_owned(o);
46052         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46053         o_conv.is_owned = false;
46054         int64_t ret_conv = RevocationKey_hash(&o_conv);
46055         return ret_conv;
46056 }
46057
46058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1from_1basepoint(JNIEnv *env, jclass clz, int64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
46059         LDKRevocationBasepoint countersignatory_basepoint_conv;
46060         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
46061         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
46062         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
46063         countersignatory_basepoint_conv.is_owned = false;
46064         LDKPublicKey per_commitment_point_ref;
46065         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
46066         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
46067         LDKRevocationKey ret_var = RevocationKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
46068         int64_t ret_ref = 0;
46069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46071         return ret_ref;
46072 }
46073
46074 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationKey_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
46075         LDKRevocationKey this_arg_conv;
46076         this_arg_conv.inner = untag_ptr(this_arg);
46077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46079         this_arg_conv.is_owned = false;
46080         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
46081         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevocationKey_to_public_key(&this_arg_conv).compressed_form);
46082         return ret_arr;
46083 }
46084
46085 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationKey_1write(JNIEnv *env, jclass clz, int64_t obj) {
46086         LDKRevocationKey obj_conv;
46087         obj_conv.inner = untag_ptr(obj);
46088         obj_conv.is_owned = ptr_is_owned(obj);
46089         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46090         obj_conv.is_owned = false;
46091         LDKCVec_u8Z ret_var = RevocationKey_write(&obj_conv);
46092         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46093         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46094         CVec_u8Z_free(ret_var);
46095         return ret_arr;
46096 }
46097
46098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
46099         LDKu8slice ser_ref;
46100         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
46101         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
46102         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
46103         *ret_conv = RevocationKey_read(ser_ref);
46104         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
46105         return tag_ptr(ret_conv, true);
46106 }
46107
46108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46109         LDKExpandedKey this_obj_conv;
46110         this_obj_conv.inner = untag_ptr(this_obj);
46111         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46113         ExpandedKey_free(this_obj_conv);
46114 }
46115
46116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *env, jclass clz, int8_tArray key_material) {
46117         uint8_t key_material_arr[32];
46118         CHECK((*env)->GetArrayLength(env, key_material) == 32);
46119         (*env)->GetByteArrayRegion(env, key_material, 0, 32, key_material_arr);
46120         uint8_t (*key_material_ref)[32] = &key_material_arr;
46121         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
46122         int64_t ret_ref = 0;
46123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46125         return ret_ref;
46126 }
46127
46128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create(JNIEnv *env, jclass clz, int64_t keys, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t entropy_source, int64_t current_time, int64_t min_final_cltv_expiry_delta) {
46129         LDKExpandedKey keys_conv;
46130         keys_conv.inner = untag_ptr(keys);
46131         keys_conv.is_owned = ptr_is_owned(keys);
46132         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
46133         keys_conv.is_owned = false;
46134         void* min_value_msat_ptr = untag_ptr(min_value_msat);
46135         CHECK_ACCESS(min_value_msat_ptr);
46136         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
46137         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
46138         void* entropy_source_ptr = untag_ptr(entropy_source);
46139         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
46140         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
46141         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
46142         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
46143         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
46144         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
46145         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
46146         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
46147         return tag_ptr(ret_conv, true);
46148 }
46149
46150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1from_1hash(JNIEnv *env, jclass clz, int64_t keys, int64_t min_value_msat, int8_tArray payment_hash, int32_t invoice_expiry_delta_secs, int64_t current_time, int64_t min_final_cltv_expiry_delta) {
46151         LDKExpandedKey keys_conv;
46152         keys_conv.inner = untag_ptr(keys);
46153         keys_conv.is_owned = ptr_is_owned(keys);
46154         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
46155         keys_conv.is_owned = false;
46156         void* min_value_msat_ptr = untag_ptr(min_value_msat);
46157         CHECK_ACCESS(min_value_msat_ptr);
46158         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
46159         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
46160         LDKThirtyTwoBytes payment_hash_ref;
46161         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
46162         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
46163         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
46164         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
46165         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
46166         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
46167         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
46168         *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time, min_final_cltv_expiry_delta_conv);
46169         return tag_ptr(ret_conv, true);
46170 }
46171
46172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
46173         if (!ptr_is_owned(this_ptr)) return;
46174         void* this_ptr_ptr = untag_ptr(this_ptr);
46175         CHECK_ACCESS(this_ptr_ptr);
46176         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
46177         FREE(untag_ptr(this_ptr));
46178         DecodeError_free(this_ptr_conv);
46179 }
46180
46181 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
46182         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46183         *ret_copy = DecodeError_clone(arg);
46184         int64_t ret_ref = tag_ptr(ret_copy, true);
46185         return ret_ref;
46186 }
46187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46188         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
46189         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
46190         return ret_conv;
46191 }
46192
46193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46194         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
46195         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46196         *ret_copy = DecodeError_clone(orig_conv);
46197         int64_t ret_ref = tag_ptr(ret_copy, true);
46198         return ret_ref;
46199 }
46200
46201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1version(JNIEnv *env, jclass clz) {
46202         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46203         *ret_copy = DecodeError_unknown_version();
46204         int64_t ret_ref = tag_ptr(ret_copy, true);
46205         return ret_ref;
46206 }
46207
46208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1required_1feature(JNIEnv *env, jclass clz) {
46209         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46210         *ret_copy = DecodeError_unknown_required_feature();
46211         int64_t ret_ref = tag_ptr(ret_copy, true);
46212         return ret_ref;
46213 }
46214
46215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1invalid_1value(JNIEnv *env, jclass clz) {
46216         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46217         *ret_copy = DecodeError_invalid_value();
46218         int64_t ret_ref = tag_ptr(ret_copy, true);
46219         return ret_ref;
46220 }
46221
46222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1short_1read(JNIEnv *env, jclass clz) {
46223         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46224         *ret_copy = DecodeError_short_read();
46225         int64_t ret_ref = tag_ptr(ret_copy, true);
46226         return ret_ref;
46227 }
46228
46229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1bad_1length_1descriptor(JNIEnv *env, jclass clz) {
46230         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46231         *ret_copy = DecodeError_bad_length_descriptor();
46232         int64_t ret_ref = tag_ptr(ret_copy, true);
46233         return ret_ref;
46234 }
46235
46236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1io(JNIEnv *env, jclass clz, jclass a) {
46237         LDKIOError a_conv = LDKIOError_from_java(env, a);
46238         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46239         *ret_copy = DecodeError_io(a_conv);
46240         int64_t ret_ref = tag_ptr(ret_copy, true);
46241         return ret_ref;
46242 }
46243
46244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unsupported_1compression(JNIEnv *env, jclass clz) {
46245         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46246         *ret_copy = DecodeError_unsupported_compression();
46247         int64_t ret_ref = tag_ptr(ret_copy, true);
46248         return ret_ref;
46249 }
46250
46251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1hash(JNIEnv *env, jclass clz, int64_t o) {
46252         LDKDecodeError* o_conv = (LDKDecodeError*)untag_ptr(o);
46253         int64_t ret_conv = DecodeError_hash(o_conv);
46254         return ret_conv;
46255 }
46256
46257 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DecodeError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46258         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
46259         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
46260         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
46261         return ret_conv;
46262 }
46263
46264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46265         LDKInit this_obj_conv;
46266         this_obj_conv.inner = untag_ptr(this_obj);
46267         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46269         Init_free(this_obj_conv);
46270 }
46271
46272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
46273         LDKInit this_ptr_conv;
46274         this_ptr_conv.inner = untag_ptr(this_ptr);
46275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46277         this_ptr_conv.is_owned = false;
46278         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
46279         int64_t ret_ref = 0;
46280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46282         return ret_ref;
46283 }
46284
46285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46286         LDKInit this_ptr_conv;
46287         this_ptr_conv.inner = untag_ptr(this_ptr);
46288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46290         this_ptr_conv.is_owned = false;
46291         LDKInitFeatures val_conv;
46292         val_conv.inner = untag_ptr(val);
46293         val_conv.is_owned = ptr_is_owned(val);
46294         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46295         val_conv = InitFeatures_clone(&val_conv);
46296         Init_set_features(&this_ptr_conv, val_conv);
46297 }
46298
46299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1networks(JNIEnv *env, jclass clz, int64_t this_ptr) {
46300         LDKInit this_ptr_conv;
46301         this_ptr_conv.inner = untag_ptr(this_ptr);
46302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46304         this_ptr_conv.is_owned = false;
46305         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
46306         *ret_copy = Init_get_networks(&this_ptr_conv);
46307         int64_t ret_ref = tag_ptr(ret_copy, true);
46308         return ret_ref;
46309 }
46310
46311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1networks(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46312         LDKInit this_ptr_conv;
46313         this_ptr_conv.inner = untag_ptr(this_ptr);
46314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46316         this_ptr_conv.is_owned = false;
46317         void* val_ptr = untag_ptr(val);
46318         CHECK_ACCESS(val_ptr);
46319         LDKCOption_CVec_ThirtyTwoBytesZZ val_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(val_ptr);
46320         val_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(val));
46321         Init_set_networks(&this_ptr_conv, val_conv);
46322 }
46323
46324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
46325         LDKInit this_ptr_conv;
46326         this_ptr_conv.inner = untag_ptr(this_ptr);
46327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46329         this_ptr_conv.is_owned = false;
46330         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
46331         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
46332         int64_t ret_ref = tag_ptr(ret_copy, true);
46333         return ret_ref;
46334 }
46335
46336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46337         LDKInit this_ptr_conv;
46338         this_ptr_conv.inner = untag_ptr(this_ptr);
46339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46341         this_ptr_conv.is_owned = false;
46342         void* val_ptr = untag_ptr(val);
46343         CHECK_ACCESS(val_ptr);
46344         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
46345         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
46346         Init_set_remote_network_address(&this_ptr_conv, val_conv);
46347 }
46348
46349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg, int64_t networks_arg, int64_t remote_network_address_arg) {
46350         LDKInitFeatures features_arg_conv;
46351         features_arg_conv.inner = untag_ptr(features_arg);
46352         features_arg_conv.is_owned = ptr_is_owned(features_arg);
46353         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
46354         features_arg_conv = InitFeatures_clone(&features_arg_conv);
46355         void* networks_arg_ptr = untag_ptr(networks_arg);
46356         CHECK_ACCESS(networks_arg_ptr);
46357         LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(networks_arg_ptr);
46358         networks_arg_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(networks_arg));
46359         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
46360         CHECK_ACCESS(remote_network_address_arg_ptr);
46361         LDKCOption_SocketAddressZ remote_network_address_arg_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_arg_ptr);
46362         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
46363         int64_t ret_ref = 0;
46364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46366         return ret_ref;
46367 }
46368
46369 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
46370         LDKInit ret_var = Init_clone(arg);
46371         int64_t ret_ref = 0;
46372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46374         return ret_ref;
46375 }
46376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46377         LDKInit arg_conv;
46378         arg_conv.inner = untag_ptr(arg);
46379         arg_conv.is_owned = ptr_is_owned(arg);
46380         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46381         arg_conv.is_owned = false;
46382         int64_t ret_conv = Init_clone_ptr(&arg_conv);
46383         return ret_conv;
46384 }
46385
46386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46387         LDKInit orig_conv;
46388         orig_conv.inner = untag_ptr(orig);
46389         orig_conv.is_owned = ptr_is_owned(orig);
46390         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46391         orig_conv.is_owned = false;
46392         LDKInit ret_var = Init_clone(&orig_conv);
46393         int64_t ret_ref = 0;
46394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46396         return ret_ref;
46397 }
46398
46399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1hash(JNIEnv *env, jclass clz, int64_t o) {
46400         LDKInit o_conv;
46401         o_conv.inner = untag_ptr(o);
46402         o_conv.is_owned = ptr_is_owned(o);
46403         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46404         o_conv.is_owned = false;
46405         int64_t ret_conv = Init_hash(&o_conv);
46406         return ret_conv;
46407 }
46408
46409 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Init_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46410         LDKInit a_conv;
46411         a_conv.inner = untag_ptr(a);
46412         a_conv.is_owned = ptr_is_owned(a);
46413         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46414         a_conv.is_owned = false;
46415         LDKInit b_conv;
46416         b_conv.inner = untag_ptr(b);
46417         b_conv.is_owned = ptr_is_owned(b);
46418         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46419         b_conv.is_owned = false;
46420         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
46421         return ret_conv;
46422 }
46423
46424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46425         LDKErrorMessage this_obj_conv;
46426         this_obj_conv.inner = untag_ptr(this_obj);
46427         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46429         ErrorMessage_free(this_obj_conv);
46430 }
46431
46432 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46433         LDKErrorMessage this_ptr_conv;
46434         this_ptr_conv.inner = untag_ptr(this_ptr);
46435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46437         this_ptr_conv.is_owned = false;
46438         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46439         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
46440         return ret_arr;
46441 }
46442
46443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46444         LDKErrorMessage this_ptr_conv;
46445         this_ptr_conv.inner = untag_ptr(this_ptr);
46446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46448         this_ptr_conv.is_owned = false;
46449         LDKThirtyTwoBytes val_ref;
46450         CHECK((*env)->GetArrayLength(env, val) == 32);
46451         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46452         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
46453 }
46454
46455 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
46456         LDKErrorMessage this_ptr_conv;
46457         this_ptr_conv.inner = untag_ptr(this_ptr);
46458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46460         this_ptr_conv.is_owned = false;
46461         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
46462         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
46463         Str_free(ret_str);
46464         return ret_conv;
46465 }
46466
46467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
46468         LDKErrorMessage this_ptr_conv;
46469         this_ptr_conv.inner = untag_ptr(this_ptr);
46470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46472         this_ptr_conv.is_owned = false;
46473         LDKStr val_conv = java_to_owned_str(env, val);
46474         ErrorMessage_set_data(&this_ptr_conv, val_conv);
46475 }
46476
46477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
46478         LDKThirtyTwoBytes channel_id_arg_ref;
46479         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
46480         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
46481         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
46482         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
46483         int64_t ret_ref = 0;
46484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46486         return ret_ref;
46487 }
46488
46489 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
46490         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
46491         int64_t ret_ref = 0;
46492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46494         return ret_ref;
46495 }
46496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46497         LDKErrorMessage arg_conv;
46498         arg_conv.inner = untag_ptr(arg);
46499         arg_conv.is_owned = ptr_is_owned(arg);
46500         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46501         arg_conv.is_owned = false;
46502         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
46503         return ret_conv;
46504 }
46505
46506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46507         LDKErrorMessage orig_conv;
46508         orig_conv.inner = untag_ptr(orig);
46509         orig_conv.is_owned = ptr_is_owned(orig);
46510         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46511         orig_conv.is_owned = false;
46512         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
46513         int64_t ret_ref = 0;
46514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46516         return ret_ref;
46517 }
46518
46519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1hash(JNIEnv *env, jclass clz, int64_t o) {
46520         LDKErrorMessage o_conv;
46521         o_conv.inner = untag_ptr(o);
46522         o_conv.is_owned = ptr_is_owned(o);
46523         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46524         o_conv.is_owned = false;
46525         int64_t ret_conv = ErrorMessage_hash(&o_conv);
46526         return ret_conv;
46527 }
46528
46529 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46530         LDKErrorMessage a_conv;
46531         a_conv.inner = untag_ptr(a);
46532         a_conv.is_owned = ptr_is_owned(a);
46533         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46534         a_conv.is_owned = false;
46535         LDKErrorMessage b_conv;
46536         b_conv.inner = untag_ptr(b);
46537         b_conv.is_owned = ptr_is_owned(b);
46538         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46539         b_conv.is_owned = false;
46540         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
46541         return ret_conv;
46542 }
46543
46544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46545         LDKWarningMessage this_obj_conv;
46546         this_obj_conv.inner = untag_ptr(this_obj);
46547         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46549         WarningMessage_free(this_obj_conv);
46550 }
46551
46552 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46553         LDKWarningMessage this_ptr_conv;
46554         this_ptr_conv.inner = untag_ptr(this_ptr);
46555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46557         this_ptr_conv.is_owned = false;
46558         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46559         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *WarningMessage_get_channel_id(&this_ptr_conv));
46560         return ret_arr;
46561 }
46562
46563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46564         LDKWarningMessage this_ptr_conv;
46565         this_ptr_conv.inner = untag_ptr(this_ptr);
46566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46568         this_ptr_conv.is_owned = false;
46569         LDKThirtyTwoBytes val_ref;
46570         CHECK((*env)->GetArrayLength(env, val) == 32);
46571         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46572         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
46573 }
46574
46575 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
46576         LDKWarningMessage this_ptr_conv;
46577         this_ptr_conv.inner = untag_ptr(this_ptr);
46578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46580         this_ptr_conv.is_owned = false;
46581         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
46582         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
46583         Str_free(ret_str);
46584         return ret_conv;
46585 }
46586
46587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
46588         LDKWarningMessage this_ptr_conv;
46589         this_ptr_conv.inner = untag_ptr(this_ptr);
46590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46592         this_ptr_conv.is_owned = false;
46593         LDKStr val_conv = java_to_owned_str(env, val);
46594         WarningMessage_set_data(&this_ptr_conv, val_conv);
46595 }
46596
46597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
46598         LDKThirtyTwoBytes channel_id_arg_ref;
46599         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
46600         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
46601         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
46602         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
46603         int64_t ret_ref = 0;
46604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46606         return ret_ref;
46607 }
46608
46609 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
46610         LDKWarningMessage ret_var = WarningMessage_clone(arg);
46611         int64_t ret_ref = 0;
46612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46614         return ret_ref;
46615 }
46616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46617         LDKWarningMessage arg_conv;
46618         arg_conv.inner = untag_ptr(arg);
46619         arg_conv.is_owned = ptr_is_owned(arg);
46620         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46621         arg_conv.is_owned = false;
46622         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
46623         return ret_conv;
46624 }
46625
46626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46627         LDKWarningMessage orig_conv;
46628         orig_conv.inner = untag_ptr(orig);
46629         orig_conv.is_owned = ptr_is_owned(orig);
46630         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46631         orig_conv.is_owned = false;
46632         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
46633         int64_t ret_ref = 0;
46634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46636         return ret_ref;
46637 }
46638
46639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1hash(JNIEnv *env, jclass clz, int64_t o) {
46640         LDKWarningMessage o_conv;
46641         o_conv.inner = untag_ptr(o);
46642         o_conv.is_owned = ptr_is_owned(o);
46643         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46644         o_conv.is_owned = false;
46645         int64_t ret_conv = WarningMessage_hash(&o_conv);
46646         return ret_conv;
46647 }
46648
46649 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WarningMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46650         LDKWarningMessage a_conv;
46651         a_conv.inner = untag_ptr(a);
46652         a_conv.is_owned = ptr_is_owned(a);
46653         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46654         a_conv.is_owned = false;
46655         LDKWarningMessage b_conv;
46656         b_conv.inner = untag_ptr(b);
46657         b_conv.is_owned = ptr_is_owned(b);
46658         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46659         b_conv.is_owned = false;
46660         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
46661         return ret_conv;
46662 }
46663
46664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46665         LDKPing this_obj_conv;
46666         this_obj_conv.inner = untag_ptr(this_obj);
46667         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46669         Ping_free(this_obj_conv);
46670 }
46671
46672 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
46673         LDKPing this_ptr_conv;
46674         this_ptr_conv.inner = untag_ptr(this_ptr);
46675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46677         this_ptr_conv.is_owned = false;
46678         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
46679         return ret_conv;
46680 }
46681
46682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
46683         LDKPing this_ptr_conv;
46684         this_ptr_conv.inner = untag_ptr(this_ptr);
46685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46687         this_ptr_conv.is_owned = false;
46688         Ping_set_ponglen(&this_ptr_conv, val);
46689 }
46690
46691 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
46692         LDKPing this_ptr_conv;
46693         this_ptr_conv.inner = untag_ptr(this_ptr);
46694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46696         this_ptr_conv.is_owned = false;
46697         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
46698         return ret_conv;
46699 }
46700
46701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
46702         LDKPing this_ptr_conv;
46703         this_ptr_conv.inner = untag_ptr(this_ptr);
46704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46706         this_ptr_conv.is_owned = false;
46707         Ping_set_byteslen(&this_ptr_conv, val);
46708 }
46709
46710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
46711         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
46712         int64_t ret_ref = 0;
46713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46715         return ret_ref;
46716 }
46717
46718 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
46719         LDKPing ret_var = Ping_clone(arg);
46720         int64_t ret_ref = 0;
46721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46723         return ret_ref;
46724 }
46725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46726         LDKPing arg_conv;
46727         arg_conv.inner = untag_ptr(arg);
46728         arg_conv.is_owned = ptr_is_owned(arg);
46729         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46730         arg_conv.is_owned = false;
46731         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
46732         return ret_conv;
46733 }
46734
46735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46736         LDKPing orig_conv;
46737         orig_conv.inner = untag_ptr(orig);
46738         orig_conv.is_owned = ptr_is_owned(orig);
46739         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46740         orig_conv.is_owned = false;
46741         LDKPing ret_var = Ping_clone(&orig_conv);
46742         int64_t ret_ref = 0;
46743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46745         return ret_ref;
46746 }
46747
46748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1hash(JNIEnv *env, jclass clz, int64_t o) {
46749         LDKPing o_conv;
46750         o_conv.inner = untag_ptr(o);
46751         o_conv.is_owned = ptr_is_owned(o);
46752         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46753         o_conv.is_owned = false;
46754         int64_t ret_conv = Ping_hash(&o_conv);
46755         return ret_conv;
46756 }
46757
46758 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Ping_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46759         LDKPing a_conv;
46760         a_conv.inner = untag_ptr(a);
46761         a_conv.is_owned = ptr_is_owned(a);
46762         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46763         a_conv.is_owned = false;
46764         LDKPing b_conv;
46765         b_conv.inner = untag_ptr(b);
46766         b_conv.is_owned = ptr_is_owned(b);
46767         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46768         b_conv.is_owned = false;
46769         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
46770         return ret_conv;
46771 }
46772
46773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46774         LDKPong this_obj_conv;
46775         this_obj_conv.inner = untag_ptr(this_obj);
46776         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46778         Pong_free(this_obj_conv);
46779 }
46780
46781 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
46782         LDKPong this_ptr_conv;
46783         this_ptr_conv.inner = untag_ptr(this_ptr);
46784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46786         this_ptr_conv.is_owned = false;
46787         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
46788         return ret_conv;
46789 }
46790
46791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
46792         LDKPong this_ptr_conv;
46793         this_ptr_conv.inner = untag_ptr(this_ptr);
46794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46796         this_ptr_conv.is_owned = false;
46797         Pong_set_byteslen(&this_ptr_conv, val);
46798 }
46799
46800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
46801         LDKPong ret_var = Pong_new(byteslen_arg);
46802         int64_t ret_ref = 0;
46803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46805         return ret_ref;
46806 }
46807
46808 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
46809         LDKPong ret_var = Pong_clone(arg);
46810         int64_t ret_ref = 0;
46811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46813         return ret_ref;
46814 }
46815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46816         LDKPong arg_conv;
46817         arg_conv.inner = untag_ptr(arg);
46818         arg_conv.is_owned = ptr_is_owned(arg);
46819         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46820         arg_conv.is_owned = false;
46821         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
46822         return ret_conv;
46823 }
46824
46825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46826         LDKPong orig_conv;
46827         orig_conv.inner = untag_ptr(orig);
46828         orig_conv.is_owned = ptr_is_owned(orig);
46829         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46830         orig_conv.is_owned = false;
46831         LDKPong ret_var = Pong_clone(&orig_conv);
46832         int64_t ret_ref = 0;
46833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46835         return ret_ref;
46836 }
46837
46838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1hash(JNIEnv *env, jclass clz, int64_t o) {
46839         LDKPong o_conv;
46840         o_conv.inner = untag_ptr(o);
46841         o_conv.is_owned = ptr_is_owned(o);
46842         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46843         o_conv.is_owned = false;
46844         int64_t ret_conv = Pong_hash(&o_conv);
46845         return ret_conv;
46846 }
46847
46848 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Pong_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46849         LDKPong a_conv;
46850         a_conv.inner = untag_ptr(a);
46851         a_conv.is_owned = ptr_is_owned(a);
46852         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46853         a_conv.is_owned = false;
46854         LDKPong b_conv;
46855         b_conv.inner = untag_ptr(b);
46856         b_conv.is_owned = ptr_is_owned(b);
46857         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46858         b_conv.is_owned = false;
46859         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
46860         return ret_conv;
46861 }
46862
46863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46864         LDKOpenChannel this_obj_conv;
46865         this_obj_conv.inner = untag_ptr(this_obj);
46866         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46868         OpenChannel_free(this_obj_conv);
46869 }
46870
46871 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
46872         LDKOpenChannel this_ptr_conv;
46873         this_ptr_conv.inner = untag_ptr(this_ptr);
46874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46876         this_ptr_conv.is_owned = false;
46877         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46878         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
46879         return ret_arr;
46880 }
46881
46882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46883         LDKOpenChannel this_ptr_conv;
46884         this_ptr_conv.inner = untag_ptr(this_ptr);
46885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46887         this_ptr_conv.is_owned = false;
46888         LDKThirtyTwoBytes val_ref;
46889         CHECK((*env)->GetArrayLength(env, val) == 32);
46890         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46891         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
46892 }
46893
46894 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46895         LDKOpenChannel this_ptr_conv;
46896         this_ptr_conv.inner = untag_ptr(this_ptr);
46897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46899         this_ptr_conv.is_owned = false;
46900         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46901         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
46902         return ret_arr;
46903 }
46904
46905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46906         LDKOpenChannel this_ptr_conv;
46907         this_ptr_conv.inner = untag_ptr(this_ptr);
46908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46910         this_ptr_conv.is_owned = false;
46911         LDKThirtyTwoBytes val_ref;
46912         CHECK((*env)->GetArrayLength(env, val) == 32);
46913         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46914         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
46915 }
46916
46917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
46918         LDKOpenChannel this_ptr_conv;
46919         this_ptr_conv.inner = untag_ptr(this_ptr);
46920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46922         this_ptr_conv.is_owned = false;
46923         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
46924         return ret_conv;
46925 }
46926
46927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46928         LDKOpenChannel this_ptr_conv;
46929         this_ptr_conv.inner = untag_ptr(this_ptr);
46930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46932         this_ptr_conv.is_owned = false;
46933         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
46934 }
46935
46936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46937         LDKOpenChannel this_ptr_conv;
46938         this_ptr_conv.inner = untag_ptr(this_ptr);
46939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46941         this_ptr_conv.is_owned = false;
46942         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
46943         return ret_conv;
46944 }
46945
46946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46947         LDKOpenChannel this_ptr_conv;
46948         this_ptr_conv.inner = untag_ptr(this_ptr);
46949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46951         this_ptr_conv.is_owned = false;
46952         OpenChannel_set_push_msat(&this_ptr_conv, val);
46953 }
46954
46955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
46956         LDKOpenChannel this_ptr_conv;
46957         this_ptr_conv.inner = untag_ptr(this_ptr);
46958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46960         this_ptr_conv.is_owned = false;
46961         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
46962         return ret_conv;
46963 }
46964
46965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46966         LDKOpenChannel this_ptr_conv;
46967         this_ptr_conv.inner = untag_ptr(this_ptr);
46968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46970         this_ptr_conv.is_owned = false;
46971         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
46972 }
46973
46974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46975         LDKOpenChannel this_ptr_conv;
46976         this_ptr_conv.inner = untag_ptr(this_ptr);
46977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46979         this_ptr_conv.is_owned = false;
46980         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
46981         return ret_conv;
46982 }
46983
46984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46985         LDKOpenChannel this_ptr_conv;
46986         this_ptr_conv.inner = untag_ptr(this_ptr);
46987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46989         this_ptr_conv.is_owned = false;
46990         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
46991 }
46992
46993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
46994         LDKOpenChannel this_ptr_conv;
46995         this_ptr_conv.inner = untag_ptr(this_ptr);
46996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46998         this_ptr_conv.is_owned = false;
46999         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
47000         return ret_conv;
47001 }
47002
47003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47004         LDKOpenChannel this_ptr_conv;
47005         this_ptr_conv.inner = untag_ptr(this_ptr);
47006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47008         this_ptr_conv.is_owned = false;
47009         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
47010 }
47011
47012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47013         LDKOpenChannel this_ptr_conv;
47014         this_ptr_conv.inner = untag_ptr(this_ptr);
47015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47017         this_ptr_conv.is_owned = false;
47018         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
47019         return ret_conv;
47020 }
47021
47022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47023         LDKOpenChannel this_ptr_conv;
47024         this_ptr_conv.inner = untag_ptr(this_ptr);
47025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47027         this_ptr_conv.is_owned = false;
47028         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
47029 }
47030
47031 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
47032         LDKOpenChannel this_ptr_conv;
47033         this_ptr_conv.inner = untag_ptr(this_ptr);
47034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47036         this_ptr_conv.is_owned = false;
47037         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
47038         return ret_conv;
47039 }
47040
47041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
47042         LDKOpenChannel this_ptr_conv;
47043         this_ptr_conv.inner = untag_ptr(this_ptr);
47044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47046         this_ptr_conv.is_owned = false;
47047         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
47048 }
47049
47050 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
47051         LDKOpenChannel this_ptr_conv;
47052         this_ptr_conv.inner = untag_ptr(this_ptr);
47053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47055         this_ptr_conv.is_owned = false;
47056         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
47057         return ret_conv;
47058 }
47059
47060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
47061         LDKOpenChannel this_ptr_conv;
47062         this_ptr_conv.inner = untag_ptr(this_ptr);
47063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47065         this_ptr_conv.is_owned = false;
47066         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
47067 }
47068
47069 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
47070         LDKOpenChannel this_ptr_conv;
47071         this_ptr_conv.inner = untag_ptr(this_ptr);
47072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47074         this_ptr_conv.is_owned = false;
47075         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
47076         return ret_conv;
47077 }
47078
47079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
47080         LDKOpenChannel this_ptr_conv;
47081         this_ptr_conv.inner = untag_ptr(this_ptr);
47082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47084         this_ptr_conv.is_owned = false;
47085         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
47086 }
47087
47088 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
47089         LDKOpenChannel this_ptr_conv;
47090         this_ptr_conv.inner = untag_ptr(this_ptr);
47091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47093         this_ptr_conv.is_owned = false;
47094         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47095         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
47096         return ret_arr;
47097 }
47098
47099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47100         LDKOpenChannel this_ptr_conv;
47101         this_ptr_conv.inner = untag_ptr(this_ptr);
47102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47104         this_ptr_conv.is_owned = false;
47105         LDKPublicKey val_ref;
47106         CHECK((*env)->GetArrayLength(env, val) == 33);
47107         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47108         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
47109 }
47110
47111 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
47112         LDKOpenChannel this_ptr_conv;
47113         this_ptr_conv.inner = untag_ptr(this_ptr);
47114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47116         this_ptr_conv.is_owned = false;
47117         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47118         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
47119         return ret_arr;
47120 }
47121
47122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47123         LDKOpenChannel this_ptr_conv;
47124         this_ptr_conv.inner = untag_ptr(this_ptr);
47125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47127         this_ptr_conv.is_owned = false;
47128         LDKPublicKey val_ref;
47129         CHECK((*env)->GetArrayLength(env, val) == 33);
47130         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47131         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
47132 }
47133
47134 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
47135         LDKOpenChannel this_ptr_conv;
47136         this_ptr_conv.inner = untag_ptr(this_ptr);
47137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47139         this_ptr_conv.is_owned = false;
47140         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47141         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
47142         return ret_arr;
47143 }
47144
47145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47146         LDKOpenChannel this_ptr_conv;
47147         this_ptr_conv.inner = untag_ptr(this_ptr);
47148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47150         this_ptr_conv.is_owned = false;
47151         LDKPublicKey val_ref;
47152         CHECK((*env)->GetArrayLength(env, val) == 33);
47153         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47154         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
47155 }
47156
47157 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
47158         LDKOpenChannel this_ptr_conv;
47159         this_ptr_conv.inner = untag_ptr(this_ptr);
47160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47162         this_ptr_conv.is_owned = false;
47163         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47164         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
47165         return ret_arr;
47166 }
47167
47168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47169         LDKOpenChannel this_ptr_conv;
47170         this_ptr_conv.inner = untag_ptr(this_ptr);
47171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47173         this_ptr_conv.is_owned = false;
47174         LDKPublicKey val_ref;
47175         CHECK((*env)->GetArrayLength(env, val) == 33);
47176         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47177         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
47178 }
47179
47180 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
47181         LDKOpenChannel this_ptr_conv;
47182         this_ptr_conv.inner = untag_ptr(this_ptr);
47183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47185         this_ptr_conv.is_owned = false;
47186         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47187         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
47188         return ret_arr;
47189 }
47190
47191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47192         LDKOpenChannel this_ptr_conv;
47193         this_ptr_conv.inner = untag_ptr(this_ptr);
47194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47196         this_ptr_conv.is_owned = false;
47197         LDKPublicKey val_ref;
47198         CHECK((*env)->GetArrayLength(env, val) == 33);
47199         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47200         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
47201 }
47202
47203 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
47204         LDKOpenChannel this_ptr_conv;
47205         this_ptr_conv.inner = untag_ptr(this_ptr);
47206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47208         this_ptr_conv.is_owned = false;
47209         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47210         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
47211         return ret_arr;
47212 }
47213
47214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47215         LDKOpenChannel this_ptr_conv;
47216         this_ptr_conv.inner = untag_ptr(this_ptr);
47217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47219         this_ptr_conv.is_owned = false;
47220         LDKPublicKey val_ref;
47221         CHECK((*env)->GetArrayLength(env, val) == 33);
47222         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47223         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
47224 }
47225
47226 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
47227         LDKOpenChannel this_ptr_conv;
47228         this_ptr_conv.inner = untag_ptr(this_ptr);
47229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47231         this_ptr_conv.is_owned = false;
47232         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
47233         return ret_conv;
47234 }
47235
47236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
47237         LDKOpenChannel this_ptr_conv;
47238         this_ptr_conv.inner = untag_ptr(this_ptr);
47239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47241         this_ptr_conv.is_owned = false;
47242         OpenChannel_set_channel_flags(&this_ptr_conv, val);
47243 }
47244
47245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
47246         LDKOpenChannel this_ptr_conv;
47247         this_ptr_conv.inner = untag_ptr(this_ptr);
47248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47250         this_ptr_conv.is_owned = false;
47251         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
47252         *ret_copy = OpenChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
47253         int64_t ret_ref = tag_ptr(ret_copy, true);
47254         return ret_ref;
47255 }
47256
47257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47258         LDKOpenChannel this_ptr_conv;
47259         this_ptr_conv.inner = untag_ptr(this_ptr);
47260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47262         this_ptr_conv.is_owned = false;
47263         void* val_ptr = untag_ptr(val);
47264         CHECK_ACCESS(val_ptr);
47265         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
47266         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
47267         OpenChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
47268 }
47269
47270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
47271         LDKOpenChannel this_ptr_conv;
47272         this_ptr_conv.inner = untag_ptr(this_ptr);
47273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47275         this_ptr_conv.is_owned = false;
47276         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
47277         int64_t ret_ref = 0;
47278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47280         return ret_ref;
47281 }
47282
47283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47284         LDKOpenChannel this_ptr_conv;
47285         this_ptr_conv.inner = untag_ptr(this_ptr);
47286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47288         this_ptr_conv.is_owned = false;
47289         LDKChannelTypeFeatures val_conv;
47290         val_conv.inner = untag_ptr(val);
47291         val_conv.is_owned = ptr_is_owned(val);
47292         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47293         val_conv = ChannelTypeFeatures_clone(&val_conv);
47294         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
47295 }
47296
47297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int8_tArray temporary_channel_id_arg, int64_t funding_satoshis_arg, int64_t push_msat_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t channel_reserve_satoshis_arg, int64_t htlc_minimum_msat_arg, int32_t feerate_per_kw_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_point_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int8_t channel_flags_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg) {
47298         LDKThirtyTwoBytes chain_hash_arg_ref;
47299         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
47300         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
47301         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
47302         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
47303         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
47304         LDKPublicKey funding_pubkey_arg_ref;
47305         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
47306         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
47307         LDKPublicKey revocation_basepoint_arg_ref;
47308         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
47309         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
47310         LDKPublicKey payment_point_arg_ref;
47311         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
47312         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
47313         LDKPublicKey delayed_payment_basepoint_arg_ref;
47314         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
47315         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
47316         LDKPublicKey htlc_basepoint_arg_ref;
47317         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
47318         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
47319         LDKPublicKey first_per_commitment_point_arg_ref;
47320         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
47321         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
47322         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
47323         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
47324         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
47325         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
47326         LDKChannelTypeFeatures channel_type_arg_conv;
47327         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
47328         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
47329         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
47330         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
47331         LDKOpenChannel ret_var = OpenChannel_new(chain_hash_arg_ref, temporary_channel_id_arg_ref, funding_satoshis_arg, push_msat_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, channel_reserve_satoshis_arg, htlc_minimum_msat_arg, feerate_per_kw_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, channel_flags_arg, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
47332         int64_t ret_ref = 0;
47333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47335         return ret_ref;
47336 }
47337
47338 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
47339         LDKOpenChannel ret_var = OpenChannel_clone(arg);
47340         int64_t ret_ref = 0;
47341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47343         return ret_ref;
47344 }
47345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47346         LDKOpenChannel arg_conv;
47347         arg_conv.inner = untag_ptr(arg);
47348         arg_conv.is_owned = ptr_is_owned(arg);
47349         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47350         arg_conv.is_owned = false;
47351         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
47352         return ret_conv;
47353 }
47354
47355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47356         LDKOpenChannel orig_conv;
47357         orig_conv.inner = untag_ptr(orig);
47358         orig_conv.is_owned = ptr_is_owned(orig);
47359         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47360         orig_conv.is_owned = false;
47361         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
47362         int64_t ret_ref = 0;
47363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47365         return ret_ref;
47366 }
47367
47368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1hash(JNIEnv *env, jclass clz, int64_t o) {
47369         LDKOpenChannel o_conv;
47370         o_conv.inner = untag_ptr(o);
47371         o_conv.is_owned = ptr_is_owned(o);
47372         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47373         o_conv.is_owned = false;
47374         int64_t ret_conv = OpenChannel_hash(&o_conv);
47375         return ret_conv;
47376 }
47377
47378 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OpenChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47379         LDKOpenChannel a_conv;
47380         a_conv.inner = untag_ptr(a);
47381         a_conv.is_owned = ptr_is_owned(a);
47382         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47383         a_conv.is_owned = false;
47384         LDKOpenChannel b_conv;
47385         b_conv.inner = untag_ptr(b);
47386         b_conv.is_owned = ptr_is_owned(b);
47387         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47388         b_conv.is_owned = false;
47389         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
47390         return ret_conv;
47391 }
47392
47393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47394         LDKOpenChannelV2 this_obj_conv;
47395         this_obj_conv.inner = untag_ptr(this_obj);
47396         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47398         OpenChannelV2_free(this_obj_conv);
47399 }
47400
47401 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
47402         LDKOpenChannelV2 this_ptr_conv;
47403         this_ptr_conv.inner = untag_ptr(this_ptr);
47404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47406         this_ptr_conv.is_owned = false;
47407         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47408         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannelV2_get_chain_hash(&this_ptr_conv));
47409         return ret_arr;
47410 }
47411
47412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47413         LDKOpenChannelV2 this_ptr_conv;
47414         this_ptr_conv.inner = untag_ptr(this_ptr);
47415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47417         this_ptr_conv.is_owned = false;
47418         LDKThirtyTwoBytes val_ref;
47419         CHECK((*env)->GetArrayLength(env, val) == 32);
47420         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47421         OpenChannelV2_set_chain_hash(&this_ptr_conv, val_ref);
47422 }
47423
47424 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47425         LDKOpenChannelV2 this_ptr_conv;
47426         this_ptr_conv.inner = untag_ptr(this_ptr);
47427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47429         this_ptr_conv.is_owned = false;
47430         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47431         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannelV2_get_temporary_channel_id(&this_ptr_conv));
47432         return ret_arr;
47433 }
47434
47435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47436         LDKOpenChannelV2 this_ptr_conv;
47437         this_ptr_conv.inner = untag_ptr(this_ptr);
47438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47440         this_ptr_conv.is_owned = false;
47441         LDKThirtyTwoBytes val_ref;
47442         CHECK((*env)->GetArrayLength(env, val) == 32);
47443         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47444         OpenChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
47445 }
47446
47447 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1funding_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
47448         LDKOpenChannelV2 this_ptr_conv;
47449         this_ptr_conv.inner = untag_ptr(this_ptr);
47450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47452         this_ptr_conv.is_owned = false;
47453         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
47454         return ret_conv;
47455 }
47456
47457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1funding_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
47458         LDKOpenChannelV2 this_ptr_conv;
47459         this_ptr_conv.inner = untag_ptr(this_ptr);
47460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47462         this_ptr_conv.is_owned = false;
47463         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
47464 }
47465
47466 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1commitment_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
47467         LDKOpenChannelV2 this_ptr_conv;
47468         this_ptr_conv.inner = untag_ptr(this_ptr);
47469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47471         this_ptr_conv.is_owned = false;
47472         int32_t ret_conv = OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
47473         return ret_conv;
47474 }
47475
47476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1commitment_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
47477         LDKOpenChannelV2 this_ptr_conv;
47478         this_ptr_conv.inner = untag_ptr(this_ptr);
47479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47481         this_ptr_conv.is_owned = false;
47482         OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
47483 }
47484
47485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
47486         LDKOpenChannelV2 this_ptr_conv;
47487         this_ptr_conv.inner = untag_ptr(this_ptr);
47488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47490         this_ptr_conv.is_owned = false;
47491         int64_t ret_conv = OpenChannelV2_get_funding_satoshis(&this_ptr_conv);
47492         return ret_conv;
47493 }
47494
47495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47496         LDKOpenChannelV2 this_ptr_conv;
47497         this_ptr_conv.inner = untag_ptr(this_ptr);
47498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47500         this_ptr_conv.is_owned = false;
47501         OpenChannelV2_set_funding_satoshis(&this_ptr_conv, val);
47502 }
47503
47504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
47505         LDKOpenChannelV2 this_ptr_conv;
47506         this_ptr_conv.inner = untag_ptr(this_ptr);
47507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47509         this_ptr_conv.is_owned = false;
47510         int64_t ret_conv = OpenChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
47511         return ret_conv;
47512 }
47513
47514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47515         LDKOpenChannelV2 this_ptr_conv;
47516         this_ptr_conv.inner = untag_ptr(this_ptr);
47517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47519         this_ptr_conv.is_owned = false;
47520         OpenChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
47521 }
47522
47523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47524         LDKOpenChannelV2 this_ptr_conv;
47525         this_ptr_conv.inner = untag_ptr(this_ptr);
47526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47528         this_ptr_conv.is_owned = false;
47529         int64_t ret_conv = OpenChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
47530         return ret_conv;
47531 }
47532
47533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47534         LDKOpenChannelV2 this_ptr_conv;
47535         this_ptr_conv.inner = untag_ptr(this_ptr);
47536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47538         this_ptr_conv.is_owned = false;
47539         OpenChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
47540 }
47541
47542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47543         LDKOpenChannelV2 this_ptr_conv;
47544         this_ptr_conv.inner = untag_ptr(this_ptr);
47545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47547         this_ptr_conv.is_owned = false;
47548         int64_t ret_conv = OpenChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
47549         return ret_conv;
47550 }
47551
47552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47553         LDKOpenChannelV2 this_ptr_conv;
47554         this_ptr_conv.inner = untag_ptr(this_ptr);
47555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47557         this_ptr_conv.is_owned = false;
47558         OpenChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
47559 }
47560
47561 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
47562         LDKOpenChannelV2 this_ptr_conv;
47563         this_ptr_conv.inner = untag_ptr(this_ptr);
47564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47566         this_ptr_conv.is_owned = false;
47567         int16_t ret_conv = OpenChannelV2_get_to_self_delay(&this_ptr_conv);
47568         return ret_conv;
47569 }
47570
47571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
47572         LDKOpenChannelV2 this_ptr_conv;
47573         this_ptr_conv.inner = untag_ptr(this_ptr);
47574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47576         this_ptr_conv.is_owned = false;
47577         OpenChannelV2_set_to_self_delay(&this_ptr_conv, val);
47578 }
47579
47580 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
47581         LDKOpenChannelV2 this_ptr_conv;
47582         this_ptr_conv.inner = untag_ptr(this_ptr);
47583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47585         this_ptr_conv.is_owned = false;
47586         int16_t ret_conv = OpenChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
47587         return ret_conv;
47588 }
47589
47590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
47591         LDKOpenChannelV2 this_ptr_conv;
47592         this_ptr_conv.inner = untag_ptr(this_ptr);
47593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47595         this_ptr_conv.is_owned = false;
47596         OpenChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
47597 }
47598
47599 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
47600         LDKOpenChannelV2 this_ptr_conv;
47601         this_ptr_conv.inner = untag_ptr(this_ptr);
47602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47604         this_ptr_conv.is_owned = false;
47605         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
47606         return ret_conv;
47607 }
47608
47609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
47610         LDKOpenChannelV2 this_ptr_conv;
47611         this_ptr_conv.inner = untag_ptr(this_ptr);
47612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47614         this_ptr_conv.is_owned = false;
47615         OpenChannelV2_set_locktime(&this_ptr_conv, val);
47616 }
47617
47618 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
47619         LDKOpenChannelV2 this_ptr_conv;
47620         this_ptr_conv.inner = untag_ptr(this_ptr);
47621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47623         this_ptr_conv.is_owned = false;
47624         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47625         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form);
47626         return ret_arr;
47627 }
47628
47629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47630         LDKOpenChannelV2 this_ptr_conv;
47631         this_ptr_conv.inner = untag_ptr(this_ptr);
47632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47634         this_ptr_conv.is_owned = false;
47635         LDKPublicKey val_ref;
47636         CHECK((*env)->GetArrayLength(env, val) == 33);
47637         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47638         OpenChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
47639 }
47640
47641 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
47642         LDKOpenChannelV2 this_ptr_conv;
47643         this_ptr_conv.inner = untag_ptr(this_ptr);
47644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47646         this_ptr_conv.is_owned = false;
47647         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47648         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form);
47649         return ret_arr;
47650 }
47651
47652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47653         LDKOpenChannelV2 this_ptr_conv;
47654         this_ptr_conv.inner = untag_ptr(this_ptr);
47655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47657         this_ptr_conv.is_owned = false;
47658         LDKPublicKey val_ref;
47659         CHECK((*env)->GetArrayLength(env, val) == 33);
47660         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47661         OpenChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
47662 }
47663
47664 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
47665         LDKOpenChannelV2 this_ptr_conv;
47666         this_ptr_conv.inner = untag_ptr(this_ptr);
47667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47669         this_ptr_conv.is_owned = false;
47670         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47671         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form);
47672         return ret_arr;
47673 }
47674
47675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47676         LDKOpenChannelV2 this_ptr_conv;
47677         this_ptr_conv.inner = untag_ptr(this_ptr);
47678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47680         this_ptr_conv.is_owned = false;
47681         LDKPublicKey val_ref;
47682         CHECK((*env)->GetArrayLength(env, val) == 33);
47683         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47684         OpenChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
47685 }
47686
47687 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
47688         LDKOpenChannelV2 this_ptr_conv;
47689         this_ptr_conv.inner = untag_ptr(this_ptr);
47690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47692         this_ptr_conv.is_owned = false;
47693         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47694         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
47695         return ret_arr;
47696 }
47697
47698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47699         LDKOpenChannelV2 this_ptr_conv;
47700         this_ptr_conv.inner = untag_ptr(this_ptr);
47701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47703         this_ptr_conv.is_owned = false;
47704         LDKPublicKey val_ref;
47705         CHECK((*env)->GetArrayLength(env, val) == 33);
47706         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47707         OpenChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
47708 }
47709
47710 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
47711         LDKOpenChannelV2 this_ptr_conv;
47712         this_ptr_conv.inner = untag_ptr(this_ptr);
47713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47715         this_ptr_conv.is_owned = false;
47716         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47717         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form);
47718         return ret_arr;
47719 }
47720
47721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47722         LDKOpenChannelV2 this_ptr_conv;
47723         this_ptr_conv.inner = untag_ptr(this_ptr);
47724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47726         this_ptr_conv.is_owned = false;
47727         LDKPublicKey val_ref;
47728         CHECK((*env)->GetArrayLength(env, val) == 33);
47729         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47730         OpenChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
47731 }
47732
47733 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
47734         LDKOpenChannelV2 this_ptr_conv;
47735         this_ptr_conv.inner = untag_ptr(this_ptr);
47736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47738         this_ptr_conv.is_owned = false;
47739         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47740         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
47741         return ret_arr;
47742 }
47743
47744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47745         LDKOpenChannelV2 this_ptr_conv;
47746         this_ptr_conv.inner = untag_ptr(this_ptr);
47747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47749         this_ptr_conv.is_owned = false;
47750         LDKPublicKey val_ref;
47751         CHECK((*env)->GetArrayLength(env, val) == 33);
47752         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47753         OpenChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
47754 }
47755
47756 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
47757         LDKOpenChannelV2 this_ptr_conv;
47758         this_ptr_conv.inner = untag_ptr(this_ptr);
47759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47761         this_ptr_conv.is_owned = false;
47762         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47763         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form);
47764         return ret_arr;
47765 }
47766
47767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47768         LDKOpenChannelV2 this_ptr_conv;
47769         this_ptr_conv.inner = untag_ptr(this_ptr);
47770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47772         this_ptr_conv.is_owned = false;
47773         LDKPublicKey val_ref;
47774         CHECK((*env)->GetArrayLength(env, val) == 33);
47775         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47776         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
47777 }
47778
47779 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
47780         LDKOpenChannelV2 this_ptr_conv;
47781         this_ptr_conv.inner = untag_ptr(this_ptr);
47782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47784         this_ptr_conv.is_owned = false;
47785         int8_t ret_conv = OpenChannelV2_get_channel_flags(&this_ptr_conv);
47786         return ret_conv;
47787 }
47788
47789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
47790         LDKOpenChannelV2 this_ptr_conv;
47791         this_ptr_conv.inner = untag_ptr(this_ptr);
47792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47794         this_ptr_conv.is_owned = false;
47795         OpenChannelV2_set_channel_flags(&this_ptr_conv, val);
47796 }
47797
47798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
47799         LDKOpenChannelV2 this_ptr_conv;
47800         this_ptr_conv.inner = untag_ptr(this_ptr);
47801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47803         this_ptr_conv.is_owned = false;
47804         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
47805         *ret_copy = OpenChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
47806         int64_t ret_ref = tag_ptr(ret_copy, true);
47807         return ret_ref;
47808 }
47809
47810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47811         LDKOpenChannelV2 this_ptr_conv;
47812         this_ptr_conv.inner = untag_ptr(this_ptr);
47813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47815         this_ptr_conv.is_owned = false;
47816         void* val_ptr = untag_ptr(val);
47817         CHECK_ACCESS(val_ptr);
47818         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
47819         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
47820         OpenChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
47821 }
47822
47823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
47824         LDKOpenChannelV2 this_ptr_conv;
47825         this_ptr_conv.inner = untag_ptr(this_ptr);
47826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47828         this_ptr_conv.is_owned = false;
47829         LDKChannelTypeFeatures ret_var = OpenChannelV2_get_channel_type(&this_ptr_conv);
47830         int64_t ret_ref = 0;
47831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47833         return ret_ref;
47834 }
47835
47836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47837         LDKOpenChannelV2 this_ptr_conv;
47838         this_ptr_conv.inner = untag_ptr(this_ptr);
47839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47841         this_ptr_conv.is_owned = false;
47842         LDKChannelTypeFeatures val_conv;
47843         val_conv.inner = untag_ptr(val);
47844         val_conv.is_owned = ptr_is_owned(val);
47845         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47846         val_conv = ChannelTypeFeatures_clone(&val_conv);
47847         OpenChannelV2_set_channel_type(&this_ptr_conv, val_conv);
47848 }
47849
47850 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr) {
47851         LDKOpenChannelV2 this_ptr_conv;
47852         this_ptr_conv.inner = untag_ptr(this_ptr);
47853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47855         this_ptr_conv.is_owned = false;
47856         jclass ret_conv = LDKCOption_NoneZ_to_java(env, OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
47857         return ret_conv;
47858 }
47859
47860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
47861         LDKOpenChannelV2 this_ptr_conv;
47862         this_ptr_conv.inner = untag_ptr(this_ptr);
47863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47865         this_ptr_conv.is_owned = false;
47866         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
47867         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
47868 }
47869
47870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int8_tArray temporary_channel_id_arg, int32_t funding_feerate_sat_per_1000_weight_arg, int32_t commitment_feerate_sat_per_1000_weight_arg, int64_t funding_satoshis_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t htlc_minimum_msat_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int32_t locktime_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_basepoint_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int8_tArray second_per_commitment_point_arg, int8_t channel_flags_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg, jclass require_confirmed_inputs_arg) {
47871         LDKThirtyTwoBytes chain_hash_arg_ref;
47872         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
47873         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
47874         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
47875         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
47876         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
47877         LDKPublicKey funding_pubkey_arg_ref;
47878         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
47879         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
47880         LDKPublicKey revocation_basepoint_arg_ref;
47881         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
47882         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
47883         LDKPublicKey payment_basepoint_arg_ref;
47884         CHECK((*env)->GetArrayLength(env, payment_basepoint_arg) == 33);
47885         (*env)->GetByteArrayRegion(env, payment_basepoint_arg, 0, 33, payment_basepoint_arg_ref.compressed_form);
47886         LDKPublicKey delayed_payment_basepoint_arg_ref;
47887         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
47888         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
47889         LDKPublicKey htlc_basepoint_arg_ref;
47890         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
47891         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
47892         LDKPublicKey first_per_commitment_point_arg_ref;
47893         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
47894         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
47895         LDKPublicKey second_per_commitment_point_arg_ref;
47896         CHECK((*env)->GetArrayLength(env, second_per_commitment_point_arg) == 33);
47897         (*env)->GetByteArrayRegion(env, second_per_commitment_point_arg, 0, 33, second_per_commitment_point_arg_ref.compressed_form);
47898         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
47899         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
47900         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
47901         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
47902         LDKChannelTypeFeatures channel_type_arg_conv;
47903         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
47904         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
47905         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
47906         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
47907         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_java(env, require_confirmed_inputs_arg);
47908         LDKOpenChannelV2 ret_var = OpenChannelV2_new(chain_hash_arg_ref, temporary_channel_id_arg_ref, funding_feerate_sat_per_1000_weight_arg, commitment_feerate_sat_per_1000_weight_arg, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, to_self_delay_arg, max_accepted_htlcs_arg, locktime_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_basepoint_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, second_per_commitment_point_arg_ref, channel_flags_arg, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv, require_confirmed_inputs_arg_conv);
47909         int64_t ret_ref = 0;
47910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47912         return ret_ref;
47913 }
47914
47915 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
47916         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
47917         int64_t ret_ref = 0;
47918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47920         return ret_ref;
47921 }
47922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47923         LDKOpenChannelV2 arg_conv;
47924         arg_conv.inner = untag_ptr(arg);
47925         arg_conv.is_owned = ptr_is_owned(arg);
47926         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47927         arg_conv.is_owned = false;
47928         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
47929         return ret_conv;
47930 }
47931
47932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47933         LDKOpenChannelV2 orig_conv;
47934         orig_conv.inner = untag_ptr(orig);
47935         orig_conv.is_owned = ptr_is_owned(orig);
47936         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47937         orig_conv.is_owned = false;
47938         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
47939         int64_t ret_ref = 0;
47940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47942         return ret_ref;
47943 }
47944
47945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1hash(JNIEnv *env, jclass clz, int64_t o) {
47946         LDKOpenChannelV2 o_conv;
47947         o_conv.inner = untag_ptr(o);
47948         o_conv.is_owned = ptr_is_owned(o);
47949         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47950         o_conv.is_owned = false;
47951         int64_t ret_conv = OpenChannelV2_hash(&o_conv);
47952         return ret_conv;
47953 }
47954
47955 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47956         LDKOpenChannelV2 a_conv;
47957         a_conv.inner = untag_ptr(a);
47958         a_conv.is_owned = ptr_is_owned(a);
47959         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47960         a_conv.is_owned = false;
47961         LDKOpenChannelV2 b_conv;
47962         b_conv.inner = untag_ptr(b);
47963         b_conv.is_owned = ptr_is_owned(b);
47964         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47965         b_conv.is_owned = false;
47966         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
47967         return ret_conv;
47968 }
47969
47970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47971         LDKAcceptChannel this_obj_conv;
47972         this_obj_conv.inner = untag_ptr(this_obj);
47973         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47975         AcceptChannel_free(this_obj_conv);
47976 }
47977
47978 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47979         LDKAcceptChannel this_ptr_conv;
47980         this_ptr_conv.inner = untag_ptr(this_ptr);
47981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47983         this_ptr_conv.is_owned = false;
47984         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47985         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
47986         return ret_arr;
47987 }
47988
47989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47990         LDKAcceptChannel this_ptr_conv;
47991         this_ptr_conv.inner = untag_ptr(this_ptr);
47992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47994         this_ptr_conv.is_owned = false;
47995         LDKThirtyTwoBytes val_ref;
47996         CHECK((*env)->GetArrayLength(env, val) == 32);
47997         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47998         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
47999 }
48000
48001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
48002         LDKAcceptChannel this_ptr_conv;
48003         this_ptr_conv.inner = untag_ptr(this_ptr);
48004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48006         this_ptr_conv.is_owned = false;
48007         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
48008         return ret_conv;
48009 }
48010
48011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48012         LDKAcceptChannel this_ptr_conv;
48013         this_ptr_conv.inner = untag_ptr(this_ptr);
48014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48016         this_ptr_conv.is_owned = false;
48017         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
48018 }
48019
48020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
48021         LDKAcceptChannel this_ptr_conv;
48022         this_ptr_conv.inner = untag_ptr(this_ptr);
48023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48025         this_ptr_conv.is_owned = false;
48026         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
48027         return ret_conv;
48028 }
48029
48030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48031         LDKAcceptChannel this_ptr_conv;
48032         this_ptr_conv.inner = untag_ptr(this_ptr);
48033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48035         this_ptr_conv.is_owned = false;
48036         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
48037 }
48038
48039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
48040         LDKAcceptChannel this_ptr_conv;
48041         this_ptr_conv.inner = untag_ptr(this_ptr);
48042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48044         this_ptr_conv.is_owned = false;
48045         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
48046         return ret_conv;
48047 }
48048
48049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48050         LDKAcceptChannel this_ptr_conv;
48051         this_ptr_conv.inner = untag_ptr(this_ptr);
48052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48054         this_ptr_conv.is_owned = false;
48055         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
48056 }
48057
48058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
48059         LDKAcceptChannel this_ptr_conv;
48060         this_ptr_conv.inner = untag_ptr(this_ptr);
48061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48063         this_ptr_conv.is_owned = false;
48064         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
48065         return ret_conv;
48066 }
48067
48068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48069         LDKAcceptChannel this_ptr_conv;
48070         this_ptr_conv.inner = untag_ptr(this_ptr);
48071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48073         this_ptr_conv.is_owned = false;
48074         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
48075 }
48076
48077 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
48078         LDKAcceptChannel this_ptr_conv;
48079         this_ptr_conv.inner = untag_ptr(this_ptr);
48080         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48082         this_ptr_conv.is_owned = false;
48083         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
48084         return ret_conv;
48085 }
48086
48087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
48088         LDKAcceptChannel this_ptr_conv;
48089         this_ptr_conv.inner = untag_ptr(this_ptr);
48090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48092         this_ptr_conv.is_owned = false;
48093         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
48094 }
48095
48096 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
48097         LDKAcceptChannel this_ptr_conv;
48098         this_ptr_conv.inner = untag_ptr(this_ptr);
48099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48101         this_ptr_conv.is_owned = false;
48102         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
48103         return ret_conv;
48104 }
48105
48106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
48107         LDKAcceptChannel this_ptr_conv;
48108         this_ptr_conv.inner = untag_ptr(this_ptr);
48109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48111         this_ptr_conv.is_owned = false;
48112         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
48113 }
48114
48115 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
48116         LDKAcceptChannel this_ptr_conv;
48117         this_ptr_conv.inner = untag_ptr(this_ptr);
48118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48120         this_ptr_conv.is_owned = false;
48121         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
48122         return ret_conv;
48123 }
48124
48125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
48126         LDKAcceptChannel this_ptr_conv;
48127         this_ptr_conv.inner = untag_ptr(this_ptr);
48128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48130         this_ptr_conv.is_owned = false;
48131         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
48132 }
48133
48134 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
48135         LDKAcceptChannel this_ptr_conv;
48136         this_ptr_conv.inner = untag_ptr(this_ptr);
48137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48139         this_ptr_conv.is_owned = false;
48140         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48141         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
48142         return ret_arr;
48143 }
48144
48145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48146         LDKAcceptChannel this_ptr_conv;
48147         this_ptr_conv.inner = untag_ptr(this_ptr);
48148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48150         this_ptr_conv.is_owned = false;
48151         LDKPublicKey val_ref;
48152         CHECK((*env)->GetArrayLength(env, val) == 33);
48153         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48154         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
48155 }
48156
48157 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
48158         LDKAcceptChannel this_ptr_conv;
48159         this_ptr_conv.inner = untag_ptr(this_ptr);
48160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48162         this_ptr_conv.is_owned = false;
48163         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48164         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
48165         return ret_arr;
48166 }
48167
48168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48169         LDKAcceptChannel this_ptr_conv;
48170         this_ptr_conv.inner = untag_ptr(this_ptr);
48171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48173         this_ptr_conv.is_owned = false;
48174         LDKPublicKey val_ref;
48175         CHECK((*env)->GetArrayLength(env, val) == 33);
48176         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48177         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
48178 }
48179
48180 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
48181         LDKAcceptChannel this_ptr_conv;
48182         this_ptr_conv.inner = untag_ptr(this_ptr);
48183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48185         this_ptr_conv.is_owned = false;
48186         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48187         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
48188         return ret_arr;
48189 }
48190
48191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48192         LDKAcceptChannel this_ptr_conv;
48193         this_ptr_conv.inner = untag_ptr(this_ptr);
48194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48196         this_ptr_conv.is_owned = false;
48197         LDKPublicKey val_ref;
48198         CHECK((*env)->GetArrayLength(env, val) == 33);
48199         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48200         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
48201 }
48202
48203 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
48204         LDKAcceptChannel this_ptr_conv;
48205         this_ptr_conv.inner = untag_ptr(this_ptr);
48206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48208         this_ptr_conv.is_owned = false;
48209         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48210         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
48211         return ret_arr;
48212 }
48213
48214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48215         LDKAcceptChannel this_ptr_conv;
48216         this_ptr_conv.inner = untag_ptr(this_ptr);
48217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48219         this_ptr_conv.is_owned = false;
48220         LDKPublicKey val_ref;
48221         CHECK((*env)->GetArrayLength(env, val) == 33);
48222         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48223         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
48224 }
48225
48226 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
48227         LDKAcceptChannel this_ptr_conv;
48228         this_ptr_conv.inner = untag_ptr(this_ptr);
48229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48231         this_ptr_conv.is_owned = false;
48232         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48233         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
48234         return ret_arr;
48235 }
48236
48237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48238         LDKAcceptChannel this_ptr_conv;
48239         this_ptr_conv.inner = untag_ptr(this_ptr);
48240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48242         this_ptr_conv.is_owned = false;
48243         LDKPublicKey val_ref;
48244         CHECK((*env)->GetArrayLength(env, val) == 33);
48245         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48246         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
48247 }
48248
48249 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
48250         LDKAcceptChannel this_ptr_conv;
48251         this_ptr_conv.inner = untag_ptr(this_ptr);
48252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48254         this_ptr_conv.is_owned = false;
48255         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48256         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
48257         return ret_arr;
48258 }
48259
48260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48261         LDKAcceptChannel this_ptr_conv;
48262         this_ptr_conv.inner = untag_ptr(this_ptr);
48263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48265         this_ptr_conv.is_owned = false;
48266         LDKPublicKey val_ref;
48267         CHECK((*env)->GetArrayLength(env, val) == 33);
48268         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48269         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
48270 }
48271
48272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
48273         LDKAcceptChannel this_ptr_conv;
48274         this_ptr_conv.inner = untag_ptr(this_ptr);
48275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48277         this_ptr_conv.is_owned = false;
48278         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
48279         *ret_copy = AcceptChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
48280         int64_t ret_ref = tag_ptr(ret_copy, true);
48281         return ret_ref;
48282 }
48283
48284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48285         LDKAcceptChannel this_ptr_conv;
48286         this_ptr_conv.inner = untag_ptr(this_ptr);
48287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48289         this_ptr_conv.is_owned = false;
48290         void* val_ptr = untag_ptr(val);
48291         CHECK_ACCESS(val_ptr);
48292         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
48293         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
48294         AcceptChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
48295 }
48296
48297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
48298         LDKAcceptChannel this_ptr_conv;
48299         this_ptr_conv.inner = untag_ptr(this_ptr);
48300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48302         this_ptr_conv.is_owned = false;
48303         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
48304         int64_t ret_ref = 0;
48305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48307         return ret_ref;
48308 }
48309
48310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48311         LDKAcceptChannel this_ptr_conv;
48312         this_ptr_conv.inner = untag_ptr(this_ptr);
48313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48315         this_ptr_conv.is_owned = false;
48316         LDKChannelTypeFeatures val_conv;
48317         val_conv.inner = untag_ptr(val);
48318         val_conv.is_owned = ptr_is_owned(val);
48319         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48320         val_conv = ChannelTypeFeatures_clone(&val_conv);
48321         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
48322 }
48323
48324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1new(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t channel_reserve_satoshis_arg, int64_t htlc_minimum_msat_arg, int32_t minimum_depth_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_point_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg) {
48325         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
48326         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
48327         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
48328         LDKPublicKey funding_pubkey_arg_ref;
48329         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
48330         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
48331         LDKPublicKey revocation_basepoint_arg_ref;
48332         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
48333         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
48334         LDKPublicKey payment_point_arg_ref;
48335         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
48336         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
48337         LDKPublicKey delayed_payment_basepoint_arg_ref;
48338         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
48339         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
48340         LDKPublicKey htlc_basepoint_arg_ref;
48341         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
48342         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
48343         LDKPublicKey first_per_commitment_point_arg_ref;
48344         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
48345         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
48346         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
48347         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
48348         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
48349         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
48350         LDKChannelTypeFeatures channel_type_arg_conv;
48351         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
48352         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
48353         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
48354         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
48355         LDKAcceptChannel ret_var = AcceptChannel_new(temporary_channel_id_arg_ref, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, channel_reserve_satoshis_arg, htlc_minimum_msat_arg, minimum_depth_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
48356         int64_t ret_ref = 0;
48357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48359         return ret_ref;
48360 }
48361
48362 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
48363         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
48364         int64_t ret_ref = 0;
48365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48367         return ret_ref;
48368 }
48369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48370         LDKAcceptChannel arg_conv;
48371         arg_conv.inner = untag_ptr(arg);
48372         arg_conv.is_owned = ptr_is_owned(arg);
48373         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48374         arg_conv.is_owned = false;
48375         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
48376         return ret_conv;
48377 }
48378
48379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48380         LDKAcceptChannel orig_conv;
48381         orig_conv.inner = untag_ptr(orig);
48382         orig_conv.is_owned = ptr_is_owned(orig);
48383         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48384         orig_conv.is_owned = false;
48385         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
48386         int64_t ret_ref = 0;
48387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48389         return ret_ref;
48390 }
48391
48392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1hash(JNIEnv *env, jclass clz, int64_t o) {
48393         LDKAcceptChannel o_conv;
48394         o_conv.inner = untag_ptr(o);
48395         o_conv.is_owned = ptr_is_owned(o);
48396         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48397         o_conv.is_owned = false;
48398         int64_t ret_conv = AcceptChannel_hash(&o_conv);
48399         return ret_conv;
48400 }
48401
48402 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48403         LDKAcceptChannel a_conv;
48404         a_conv.inner = untag_ptr(a);
48405         a_conv.is_owned = ptr_is_owned(a);
48406         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48407         a_conv.is_owned = false;
48408         LDKAcceptChannel b_conv;
48409         b_conv.inner = untag_ptr(b);
48410         b_conv.is_owned = ptr_is_owned(b);
48411         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48412         b_conv.is_owned = false;
48413         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
48414         return ret_conv;
48415 }
48416
48417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48418         LDKAcceptChannelV2 this_obj_conv;
48419         this_obj_conv.inner = untag_ptr(this_obj);
48420         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48422         AcceptChannelV2_free(this_obj_conv);
48423 }
48424
48425 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
48426         LDKAcceptChannelV2 this_ptr_conv;
48427         this_ptr_conv.inner = untag_ptr(this_ptr);
48428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48430         this_ptr_conv.is_owned = false;
48431         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48432         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannelV2_get_temporary_channel_id(&this_ptr_conv));
48433         return ret_arr;
48434 }
48435
48436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48437         LDKAcceptChannelV2 this_ptr_conv;
48438         this_ptr_conv.inner = untag_ptr(this_ptr);
48439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48441         this_ptr_conv.is_owned = false;
48442         LDKThirtyTwoBytes val_ref;
48443         CHECK((*env)->GetArrayLength(env, val) == 32);
48444         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
48445         AcceptChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
48446 }
48447
48448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
48449         LDKAcceptChannelV2 this_ptr_conv;
48450         this_ptr_conv.inner = untag_ptr(this_ptr);
48451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48453         this_ptr_conv.is_owned = false;
48454         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
48455         return ret_conv;
48456 }
48457
48458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48459         LDKAcceptChannelV2 this_ptr_conv;
48460         this_ptr_conv.inner = untag_ptr(this_ptr);
48461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48463         this_ptr_conv.is_owned = false;
48464         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
48465 }
48466
48467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
48468         LDKAcceptChannelV2 this_ptr_conv;
48469         this_ptr_conv.inner = untag_ptr(this_ptr);
48470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48472         this_ptr_conv.is_owned = false;
48473         int64_t ret_conv = AcceptChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
48474         return ret_conv;
48475 }
48476
48477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48478         LDKAcceptChannelV2 this_ptr_conv;
48479         this_ptr_conv.inner = untag_ptr(this_ptr);
48480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48482         this_ptr_conv.is_owned = false;
48483         AcceptChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
48484 }
48485
48486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
48487         LDKAcceptChannelV2 this_ptr_conv;
48488         this_ptr_conv.inner = untag_ptr(this_ptr);
48489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48491         this_ptr_conv.is_owned = false;
48492         int64_t ret_conv = AcceptChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
48493         return ret_conv;
48494 }
48495
48496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48497         LDKAcceptChannelV2 this_ptr_conv;
48498         this_ptr_conv.inner = untag_ptr(this_ptr);
48499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48501         this_ptr_conv.is_owned = false;
48502         AcceptChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
48503 }
48504
48505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
48506         LDKAcceptChannelV2 this_ptr_conv;
48507         this_ptr_conv.inner = untag_ptr(this_ptr);
48508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48510         this_ptr_conv.is_owned = false;
48511         int64_t ret_conv = AcceptChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
48512         return ret_conv;
48513 }
48514
48515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48516         LDKAcceptChannelV2 this_ptr_conv;
48517         this_ptr_conv.inner = untag_ptr(this_ptr);
48518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48520         this_ptr_conv.is_owned = false;
48521         AcceptChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
48522 }
48523
48524 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
48525         LDKAcceptChannelV2 this_ptr_conv;
48526         this_ptr_conv.inner = untag_ptr(this_ptr);
48527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48529         this_ptr_conv.is_owned = false;
48530         int32_t ret_conv = AcceptChannelV2_get_minimum_depth(&this_ptr_conv);
48531         return ret_conv;
48532 }
48533
48534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
48535         LDKAcceptChannelV2 this_ptr_conv;
48536         this_ptr_conv.inner = untag_ptr(this_ptr);
48537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48539         this_ptr_conv.is_owned = false;
48540         AcceptChannelV2_set_minimum_depth(&this_ptr_conv, val);
48541 }
48542
48543 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
48544         LDKAcceptChannelV2 this_ptr_conv;
48545         this_ptr_conv.inner = untag_ptr(this_ptr);
48546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48548         this_ptr_conv.is_owned = false;
48549         int16_t ret_conv = AcceptChannelV2_get_to_self_delay(&this_ptr_conv);
48550         return ret_conv;
48551 }
48552
48553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
48554         LDKAcceptChannelV2 this_ptr_conv;
48555         this_ptr_conv.inner = untag_ptr(this_ptr);
48556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48558         this_ptr_conv.is_owned = false;
48559         AcceptChannelV2_set_to_self_delay(&this_ptr_conv, val);
48560 }
48561
48562 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
48563         LDKAcceptChannelV2 this_ptr_conv;
48564         this_ptr_conv.inner = untag_ptr(this_ptr);
48565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48567         this_ptr_conv.is_owned = false;
48568         int16_t ret_conv = AcceptChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
48569         return ret_conv;
48570 }
48571
48572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
48573         LDKAcceptChannelV2 this_ptr_conv;
48574         this_ptr_conv.inner = untag_ptr(this_ptr);
48575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48577         this_ptr_conv.is_owned = false;
48578         AcceptChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
48579 }
48580
48581 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
48582         LDKAcceptChannelV2 this_ptr_conv;
48583         this_ptr_conv.inner = untag_ptr(this_ptr);
48584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48586         this_ptr_conv.is_owned = false;
48587         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48588         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form);
48589         return ret_arr;
48590 }
48591
48592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48593         LDKAcceptChannelV2 this_ptr_conv;
48594         this_ptr_conv.inner = untag_ptr(this_ptr);
48595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48597         this_ptr_conv.is_owned = false;
48598         LDKPublicKey val_ref;
48599         CHECK((*env)->GetArrayLength(env, val) == 33);
48600         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48601         AcceptChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
48602 }
48603
48604 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
48605         LDKAcceptChannelV2 this_ptr_conv;
48606         this_ptr_conv.inner = untag_ptr(this_ptr);
48607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48609         this_ptr_conv.is_owned = false;
48610         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48611         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form);
48612         return ret_arr;
48613 }
48614
48615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48616         LDKAcceptChannelV2 this_ptr_conv;
48617         this_ptr_conv.inner = untag_ptr(this_ptr);
48618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48620         this_ptr_conv.is_owned = false;
48621         LDKPublicKey val_ref;
48622         CHECK((*env)->GetArrayLength(env, val) == 33);
48623         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48624         AcceptChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
48625 }
48626
48627 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
48628         LDKAcceptChannelV2 this_ptr_conv;
48629         this_ptr_conv.inner = untag_ptr(this_ptr);
48630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48632         this_ptr_conv.is_owned = false;
48633         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48634         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form);
48635         return ret_arr;
48636 }
48637
48638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48639         LDKAcceptChannelV2 this_ptr_conv;
48640         this_ptr_conv.inner = untag_ptr(this_ptr);
48641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48643         this_ptr_conv.is_owned = false;
48644         LDKPublicKey val_ref;
48645         CHECK((*env)->GetArrayLength(env, val) == 33);
48646         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48647         AcceptChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
48648 }
48649
48650 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
48651         LDKAcceptChannelV2 this_ptr_conv;
48652         this_ptr_conv.inner = untag_ptr(this_ptr);
48653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48655         this_ptr_conv.is_owned = false;
48656         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48657         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
48658         return ret_arr;
48659 }
48660
48661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48662         LDKAcceptChannelV2 this_ptr_conv;
48663         this_ptr_conv.inner = untag_ptr(this_ptr);
48664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48666         this_ptr_conv.is_owned = false;
48667         LDKPublicKey val_ref;
48668         CHECK((*env)->GetArrayLength(env, val) == 33);
48669         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48670         AcceptChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
48671 }
48672
48673 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
48674         LDKAcceptChannelV2 this_ptr_conv;
48675         this_ptr_conv.inner = untag_ptr(this_ptr);
48676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48678         this_ptr_conv.is_owned = false;
48679         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48680         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form);
48681         return ret_arr;
48682 }
48683
48684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48685         LDKAcceptChannelV2 this_ptr_conv;
48686         this_ptr_conv.inner = untag_ptr(this_ptr);
48687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48689         this_ptr_conv.is_owned = false;
48690         LDKPublicKey val_ref;
48691         CHECK((*env)->GetArrayLength(env, val) == 33);
48692         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48693         AcceptChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
48694 }
48695
48696 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
48697         LDKAcceptChannelV2 this_ptr_conv;
48698         this_ptr_conv.inner = untag_ptr(this_ptr);
48699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48701         this_ptr_conv.is_owned = false;
48702         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48703         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
48704         return ret_arr;
48705 }
48706
48707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48708         LDKAcceptChannelV2 this_ptr_conv;
48709         this_ptr_conv.inner = untag_ptr(this_ptr);
48710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48712         this_ptr_conv.is_owned = false;
48713         LDKPublicKey val_ref;
48714         CHECK((*env)->GetArrayLength(env, val) == 33);
48715         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48716         AcceptChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
48717 }
48718
48719 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
48720         LDKAcceptChannelV2 this_ptr_conv;
48721         this_ptr_conv.inner = untag_ptr(this_ptr);
48722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48724         this_ptr_conv.is_owned = false;
48725         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48726         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form);
48727         return ret_arr;
48728 }
48729
48730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48731         LDKAcceptChannelV2 this_ptr_conv;
48732         this_ptr_conv.inner = untag_ptr(this_ptr);
48733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48735         this_ptr_conv.is_owned = false;
48736         LDKPublicKey val_ref;
48737         CHECK((*env)->GetArrayLength(env, val) == 33);
48738         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48739         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
48740 }
48741
48742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
48743         LDKAcceptChannelV2 this_ptr_conv;
48744         this_ptr_conv.inner = untag_ptr(this_ptr);
48745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48747         this_ptr_conv.is_owned = false;
48748         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
48749         *ret_copy = AcceptChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
48750         int64_t ret_ref = tag_ptr(ret_copy, true);
48751         return ret_ref;
48752 }
48753
48754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48755         LDKAcceptChannelV2 this_ptr_conv;
48756         this_ptr_conv.inner = untag_ptr(this_ptr);
48757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48759         this_ptr_conv.is_owned = false;
48760         void* val_ptr = untag_ptr(val);
48761         CHECK_ACCESS(val_ptr);
48762         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
48763         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
48764         AcceptChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
48765 }
48766
48767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
48768         LDKAcceptChannelV2 this_ptr_conv;
48769         this_ptr_conv.inner = untag_ptr(this_ptr);
48770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48772         this_ptr_conv.is_owned = false;
48773         LDKChannelTypeFeatures ret_var = AcceptChannelV2_get_channel_type(&this_ptr_conv);
48774         int64_t ret_ref = 0;
48775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48777         return ret_ref;
48778 }
48779
48780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48781         LDKAcceptChannelV2 this_ptr_conv;
48782         this_ptr_conv.inner = untag_ptr(this_ptr);
48783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48785         this_ptr_conv.is_owned = false;
48786         LDKChannelTypeFeatures val_conv;
48787         val_conv.inner = untag_ptr(val);
48788         val_conv.is_owned = ptr_is_owned(val);
48789         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48790         val_conv = ChannelTypeFeatures_clone(&val_conv);
48791         AcceptChannelV2_set_channel_type(&this_ptr_conv, val_conv);
48792 }
48793
48794 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr) {
48795         LDKAcceptChannelV2 this_ptr_conv;
48796         this_ptr_conv.inner = untag_ptr(this_ptr);
48797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48799         this_ptr_conv.is_owned = false;
48800         jclass ret_conv = LDKCOption_NoneZ_to_java(env, AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
48801         return ret_conv;
48802 }
48803
48804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
48805         LDKAcceptChannelV2 this_ptr_conv;
48806         this_ptr_conv.inner = untag_ptr(this_ptr);
48807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48809         this_ptr_conv.is_owned = false;
48810         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
48811         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
48812 }
48813
48814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1new(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id_arg, int64_t funding_satoshis_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t htlc_minimum_msat_arg, int32_t minimum_depth_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_basepoint_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int8_tArray second_per_commitment_point_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg, jclass require_confirmed_inputs_arg) {
48815         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
48816         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
48817         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
48818         LDKPublicKey funding_pubkey_arg_ref;
48819         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
48820         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
48821         LDKPublicKey revocation_basepoint_arg_ref;
48822         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
48823         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
48824         LDKPublicKey payment_basepoint_arg_ref;
48825         CHECK((*env)->GetArrayLength(env, payment_basepoint_arg) == 33);
48826         (*env)->GetByteArrayRegion(env, payment_basepoint_arg, 0, 33, payment_basepoint_arg_ref.compressed_form);
48827         LDKPublicKey delayed_payment_basepoint_arg_ref;
48828         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
48829         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
48830         LDKPublicKey htlc_basepoint_arg_ref;
48831         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
48832         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
48833         LDKPublicKey first_per_commitment_point_arg_ref;
48834         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
48835         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
48836         LDKPublicKey second_per_commitment_point_arg_ref;
48837         CHECK((*env)->GetArrayLength(env, second_per_commitment_point_arg) == 33);
48838         (*env)->GetByteArrayRegion(env, second_per_commitment_point_arg, 0, 33, second_per_commitment_point_arg_ref.compressed_form);
48839         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
48840         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
48841         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
48842         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
48843         LDKChannelTypeFeatures channel_type_arg_conv;
48844         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
48845         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
48846         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
48847         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
48848         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_java(env, require_confirmed_inputs_arg);
48849         LDKAcceptChannelV2 ret_var = AcceptChannelV2_new(temporary_channel_id_arg_ref, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, minimum_depth_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_basepoint_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, second_per_commitment_point_arg_ref, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv, require_confirmed_inputs_arg_conv);
48850         int64_t ret_ref = 0;
48851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48853         return ret_ref;
48854 }
48855
48856 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
48857         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
48858         int64_t ret_ref = 0;
48859         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48860         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48861         return ret_ref;
48862 }
48863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48864         LDKAcceptChannelV2 arg_conv;
48865         arg_conv.inner = untag_ptr(arg);
48866         arg_conv.is_owned = ptr_is_owned(arg);
48867         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48868         arg_conv.is_owned = false;
48869         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
48870         return ret_conv;
48871 }
48872
48873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48874         LDKAcceptChannelV2 orig_conv;
48875         orig_conv.inner = untag_ptr(orig);
48876         orig_conv.is_owned = ptr_is_owned(orig);
48877         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48878         orig_conv.is_owned = false;
48879         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
48880         int64_t ret_ref = 0;
48881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48883         return ret_ref;
48884 }
48885
48886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1hash(JNIEnv *env, jclass clz, int64_t o) {
48887         LDKAcceptChannelV2 o_conv;
48888         o_conv.inner = untag_ptr(o);
48889         o_conv.is_owned = ptr_is_owned(o);
48890         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48891         o_conv.is_owned = false;
48892         int64_t ret_conv = AcceptChannelV2_hash(&o_conv);
48893         return ret_conv;
48894 }
48895
48896 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48897         LDKAcceptChannelV2 a_conv;
48898         a_conv.inner = untag_ptr(a);
48899         a_conv.is_owned = ptr_is_owned(a);
48900         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48901         a_conv.is_owned = false;
48902         LDKAcceptChannelV2 b_conv;
48903         b_conv.inner = untag_ptr(b);
48904         b_conv.is_owned = ptr_is_owned(b);
48905         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48906         b_conv.is_owned = false;
48907         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
48908         return ret_conv;
48909 }
48910
48911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48912         LDKFundingCreated this_obj_conv;
48913         this_obj_conv.inner = untag_ptr(this_obj);
48914         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48916         FundingCreated_free(this_obj_conv);
48917 }
48918
48919 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
48920         LDKFundingCreated this_ptr_conv;
48921         this_ptr_conv.inner = untag_ptr(this_ptr);
48922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48924         this_ptr_conv.is_owned = false;
48925         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48926         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
48927         return ret_arr;
48928 }
48929
48930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48931         LDKFundingCreated this_ptr_conv;
48932         this_ptr_conv.inner = untag_ptr(this_ptr);
48933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48935         this_ptr_conv.is_owned = false;
48936         LDKThirtyTwoBytes val_ref;
48937         CHECK((*env)->GetArrayLength(env, val) == 32);
48938         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
48939         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
48940 }
48941
48942 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
48943         LDKFundingCreated this_ptr_conv;
48944         this_ptr_conv.inner = untag_ptr(this_ptr);
48945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48947         this_ptr_conv.is_owned = false;
48948         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
48949         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
48950         return ret_arr;
48951 }
48952
48953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48954         LDKFundingCreated this_ptr_conv;
48955         this_ptr_conv.inner = untag_ptr(this_ptr);
48956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48958         this_ptr_conv.is_owned = false;
48959         LDKThirtyTwoBytes val_ref;
48960         CHECK((*env)->GetArrayLength(env, val) == 32);
48961         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
48962         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
48963 }
48964
48965 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
48966         LDKFundingCreated this_ptr_conv;
48967         this_ptr_conv.inner = untag_ptr(this_ptr);
48968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48970         this_ptr_conv.is_owned = false;
48971         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
48972         return ret_conv;
48973 }
48974
48975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
48976         LDKFundingCreated this_ptr_conv;
48977         this_ptr_conv.inner = untag_ptr(this_ptr);
48978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48980         this_ptr_conv.is_owned = false;
48981         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
48982 }
48983
48984 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
48985         LDKFundingCreated this_ptr_conv;
48986         this_ptr_conv.inner = untag_ptr(this_ptr);
48987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48989         this_ptr_conv.is_owned = false;
48990         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
48991         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
48992         return ret_arr;
48993 }
48994
48995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48996         LDKFundingCreated this_ptr_conv;
48997         this_ptr_conv.inner = untag_ptr(this_ptr);
48998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49000         this_ptr_conv.is_owned = false;
49001         LDKECDSASignature val_ref;
49002         CHECK((*env)->GetArrayLength(env, val) == 64);
49003         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
49004         FundingCreated_set_signature(&this_ptr_conv, val_ref);
49005 }
49006
49007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1new(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id_arg, int8_tArray funding_txid_arg, int16_t funding_output_index_arg, int8_tArray signature_arg) {
49008         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
49009         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
49010         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
49011         LDKThirtyTwoBytes funding_txid_arg_ref;
49012         CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
49013         (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
49014         LDKECDSASignature signature_arg_ref;
49015         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
49016         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
49017         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
49018         int64_t ret_ref = 0;
49019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49021         return ret_ref;
49022 }
49023
49024 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
49025         LDKFundingCreated ret_var = FundingCreated_clone(arg);
49026         int64_t ret_ref = 0;
49027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49029         return ret_ref;
49030 }
49031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49032         LDKFundingCreated arg_conv;
49033         arg_conv.inner = untag_ptr(arg);
49034         arg_conv.is_owned = ptr_is_owned(arg);
49035         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49036         arg_conv.is_owned = false;
49037         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
49038         return ret_conv;
49039 }
49040
49041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49042         LDKFundingCreated orig_conv;
49043         orig_conv.inner = untag_ptr(orig);
49044         orig_conv.is_owned = ptr_is_owned(orig);
49045         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49046         orig_conv.is_owned = false;
49047         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
49048         int64_t ret_ref = 0;
49049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49051         return ret_ref;
49052 }
49053
49054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1hash(JNIEnv *env, jclass clz, int64_t o) {
49055         LDKFundingCreated o_conv;
49056         o_conv.inner = untag_ptr(o);
49057         o_conv.is_owned = ptr_is_owned(o);
49058         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49059         o_conv.is_owned = false;
49060         int64_t ret_conv = FundingCreated_hash(&o_conv);
49061         return ret_conv;
49062 }
49063
49064 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingCreated_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49065         LDKFundingCreated a_conv;
49066         a_conv.inner = untag_ptr(a);
49067         a_conv.is_owned = ptr_is_owned(a);
49068         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49069         a_conv.is_owned = false;
49070         LDKFundingCreated b_conv;
49071         b_conv.inner = untag_ptr(b);
49072         b_conv.is_owned = ptr_is_owned(b);
49073         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49074         b_conv.is_owned = false;
49075         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
49076         return ret_conv;
49077 }
49078
49079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49080         LDKFundingSigned this_obj_conv;
49081         this_obj_conv.inner = untag_ptr(this_obj);
49082         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49084         FundingSigned_free(this_obj_conv);
49085 }
49086
49087 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
49088         LDKFundingSigned this_ptr_conv;
49089         this_ptr_conv.inner = untag_ptr(this_ptr);
49090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49092         this_ptr_conv.is_owned = false;
49093         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49094         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
49095         return ret_arr;
49096 }
49097
49098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49099         LDKFundingSigned this_ptr_conv;
49100         this_ptr_conv.inner = untag_ptr(this_ptr);
49101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49103         this_ptr_conv.is_owned = false;
49104         LDKThirtyTwoBytes val_ref;
49105         CHECK((*env)->GetArrayLength(env, val) == 32);
49106         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49107         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
49108 }
49109
49110 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
49111         LDKFundingSigned this_ptr_conv;
49112         this_ptr_conv.inner = untag_ptr(this_ptr);
49113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49115         this_ptr_conv.is_owned = false;
49116         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
49117         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
49118         return ret_arr;
49119 }
49120
49121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49122         LDKFundingSigned this_ptr_conv;
49123         this_ptr_conv.inner = untag_ptr(this_ptr);
49124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49126         this_ptr_conv.is_owned = false;
49127         LDKECDSASignature val_ref;
49128         CHECK((*env)->GetArrayLength(env, val) == 64);
49129         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
49130         FundingSigned_set_signature(&this_ptr_conv, val_ref);
49131 }
49132
49133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
49134         LDKThirtyTwoBytes channel_id_arg_ref;
49135         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
49136         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
49137         LDKECDSASignature signature_arg_ref;
49138         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
49139         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
49140         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
49141         int64_t ret_ref = 0;
49142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49144         return ret_ref;
49145 }
49146
49147 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
49148         LDKFundingSigned ret_var = FundingSigned_clone(arg);
49149         int64_t ret_ref = 0;
49150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49152         return ret_ref;
49153 }
49154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49155         LDKFundingSigned arg_conv;
49156         arg_conv.inner = untag_ptr(arg);
49157         arg_conv.is_owned = ptr_is_owned(arg);
49158         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49159         arg_conv.is_owned = false;
49160         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
49161         return ret_conv;
49162 }
49163
49164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49165         LDKFundingSigned orig_conv;
49166         orig_conv.inner = untag_ptr(orig);
49167         orig_conv.is_owned = ptr_is_owned(orig);
49168         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49169         orig_conv.is_owned = false;
49170         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
49171         int64_t ret_ref = 0;
49172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49174         return ret_ref;
49175 }
49176
49177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1hash(JNIEnv *env, jclass clz, int64_t o) {
49178         LDKFundingSigned o_conv;
49179         o_conv.inner = untag_ptr(o);
49180         o_conv.is_owned = ptr_is_owned(o);
49181         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49182         o_conv.is_owned = false;
49183         int64_t ret_conv = FundingSigned_hash(&o_conv);
49184         return ret_conv;
49185 }
49186
49187 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49188         LDKFundingSigned a_conv;
49189         a_conv.inner = untag_ptr(a);
49190         a_conv.is_owned = ptr_is_owned(a);
49191         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49192         a_conv.is_owned = false;
49193         LDKFundingSigned b_conv;
49194         b_conv.inner = untag_ptr(b);
49195         b_conv.is_owned = ptr_is_owned(b);
49196         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49197         b_conv.is_owned = false;
49198         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
49199         return ret_conv;
49200 }
49201
49202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49203         LDKChannelReady this_obj_conv;
49204         this_obj_conv.inner = untag_ptr(this_obj);
49205         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49207         ChannelReady_free(this_obj_conv);
49208 }
49209
49210 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
49211         LDKChannelReady this_ptr_conv;
49212         this_ptr_conv.inner = untag_ptr(this_ptr);
49213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49215         this_ptr_conv.is_owned = false;
49216         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49217         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReady_get_channel_id(&this_ptr_conv));
49218         return ret_arr;
49219 }
49220
49221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49222         LDKChannelReady this_ptr_conv;
49223         this_ptr_conv.inner = untag_ptr(this_ptr);
49224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49226         this_ptr_conv.is_owned = false;
49227         LDKThirtyTwoBytes val_ref;
49228         CHECK((*env)->GetArrayLength(env, val) == 32);
49229         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49230         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
49231 }
49232
49233 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
49234         LDKChannelReady this_ptr_conv;
49235         this_ptr_conv.inner = untag_ptr(this_ptr);
49236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49238         this_ptr_conv.is_owned = false;
49239         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49240         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
49241         return ret_arr;
49242 }
49243
49244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49245         LDKChannelReady this_ptr_conv;
49246         this_ptr_conv.inner = untag_ptr(this_ptr);
49247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49249         this_ptr_conv.is_owned = false;
49250         LDKPublicKey val_ref;
49251         CHECK((*env)->GetArrayLength(env, val) == 33);
49252         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
49253         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
49254 }
49255
49256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
49257         LDKChannelReady this_ptr_conv;
49258         this_ptr_conv.inner = untag_ptr(this_ptr);
49259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49261         this_ptr_conv.is_owned = false;
49262         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
49263         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
49264         int64_t ret_ref = tag_ptr(ret_copy, true);
49265         return ret_ref;
49266 }
49267
49268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49269         LDKChannelReady this_ptr_conv;
49270         this_ptr_conv.inner = untag_ptr(this_ptr);
49271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49273         this_ptr_conv.is_owned = false;
49274         void* val_ptr = untag_ptr(val);
49275         CHECK_ACCESS(val_ptr);
49276         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
49277         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
49278         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
49279 }
49280
49281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg, int64_t short_channel_id_alias_arg) {
49282         LDKThirtyTwoBytes channel_id_arg_ref;
49283         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
49284         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
49285         LDKPublicKey next_per_commitment_point_arg_ref;
49286         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
49287         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
49288         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
49289         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
49290         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
49291         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
49292         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
49293         int64_t ret_ref = 0;
49294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49296         return ret_ref;
49297 }
49298
49299 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
49300         LDKChannelReady ret_var = ChannelReady_clone(arg);
49301         int64_t ret_ref = 0;
49302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49304         return ret_ref;
49305 }
49306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49307         LDKChannelReady arg_conv;
49308         arg_conv.inner = untag_ptr(arg);
49309         arg_conv.is_owned = ptr_is_owned(arg);
49310         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49311         arg_conv.is_owned = false;
49312         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
49313         return ret_conv;
49314 }
49315
49316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49317         LDKChannelReady orig_conv;
49318         orig_conv.inner = untag_ptr(orig);
49319         orig_conv.is_owned = ptr_is_owned(orig);
49320         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49321         orig_conv.is_owned = false;
49322         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
49323         int64_t ret_ref = 0;
49324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49326         return ret_ref;
49327 }
49328
49329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1hash(JNIEnv *env, jclass clz, int64_t o) {
49330         LDKChannelReady o_conv;
49331         o_conv.inner = untag_ptr(o);
49332         o_conv.is_owned = ptr_is_owned(o);
49333         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49334         o_conv.is_owned = false;
49335         int64_t ret_conv = ChannelReady_hash(&o_conv);
49336         return ret_conv;
49337 }
49338
49339 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReady_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49340         LDKChannelReady a_conv;
49341         a_conv.inner = untag_ptr(a);
49342         a_conv.is_owned = ptr_is_owned(a);
49343         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49344         a_conv.is_owned = false;
49345         LDKChannelReady b_conv;
49346         b_conv.inner = untag_ptr(b);
49347         b_conv.is_owned = ptr_is_owned(b);
49348         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49349         b_conv.is_owned = false;
49350         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
49351         return ret_conv;
49352 }
49353
49354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Stfu_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49355         LDKStfu this_obj_conv;
49356         this_obj_conv.inner = untag_ptr(this_obj);
49357         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49359         Stfu_free(this_obj_conv);
49360 }
49361
49362 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Stfu_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
49363         LDKStfu this_ptr_conv;
49364         this_ptr_conv.inner = untag_ptr(this_ptr);
49365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49367         this_ptr_conv.is_owned = false;
49368         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49369         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Stfu_get_channel_id(&this_ptr_conv));
49370         return ret_arr;
49371 }
49372
49373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Stfu_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49374         LDKStfu this_ptr_conv;
49375         this_ptr_conv.inner = untag_ptr(this_ptr);
49376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49378         this_ptr_conv.is_owned = false;
49379         LDKThirtyTwoBytes val_ref;
49380         CHECK((*env)->GetArrayLength(env, val) == 32);
49381         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49382         Stfu_set_channel_id(&this_ptr_conv, val_ref);
49383 }
49384
49385 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Stfu_1get_1initiator(JNIEnv *env, jclass clz, int64_t this_ptr) {
49386         LDKStfu this_ptr_conv;
49387         this_ptr_conv.inner = untag_ptr(this_ptr);
49388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49390         this_ptr_conv.is_owned = false;
49391         int8_t ret_conv = Stfu_get_initiator(&this_ptr_conv);
49392         return ret_conv;
49393 }
49394
49395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Stfu_1set_1initiator(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
49396         LDKStfu this_ptr_conv;
49397         this_ptr_conv.inner = untag_ptr(this_ptr);
49398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49400         this_ptr_conv.is_owned = false;
49401         Stfu_set_initiator(&this_ptr_conv, val);
49402 }
49403
49404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Stfu_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_t initiator_arg) {
49405         LDKThirtyTwoBytes channel_id_arg_ref;
49406         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
49407         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
49408         LDKStfu ret_var = Stfu_new(channel_id_arg_ref, initiator_arg);
49409         int64_t ret_ref = 0;
49410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49412         return ret_ref;
49413 }
49414
49415 static inline uint64_t Stfu_clone_ptr(LDKStfu *NONNULL_PTR arg) {
49416         LDKStfu ret_var = Stfu_clone(arg);
49417         int64_t ret_ref = 0;
49418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49420         return ret_ref;
49421 }
49422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Stfu_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49423         LDKStfu arg_conv;
49424         arg_conv.inner = untag_ptr(arg);
49425         arg_conv.is_owned = ptr_is_owned(arg);
49426         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49427         arg_conv.is_owned = false;
49428         int64_t ret_conv = Stfu_clone_ptr(&arg_conv);
49429         return ret_conv;
49430 }
49431
49432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Stfu_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49433         LDKStfu orig_conv;
49434         orig_conv.inner = untag_ptr(orig);
49435         orig_conv.is_owned = ptr_is_owned(orig);
49436         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49437         orig_conv.is_owned = false;
49438         LDKStfu ret_var = Stfu_clone(&orig_conv);
49439         int64_t ret_ref = 0;
49440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49442         return ret_ref;
49443 }
49444
49445 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Stfu_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49446         LDKStfu a_conv;
49447         a_conv.inner = untag_ptr(a);
49448         a_conv.is_owned = ptr_is_owned(a);
49449         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49450         a_conv.is_owned = false;
49451         LDKStfu b_conv;
49452         b_conv.inner = untag_ptr(b);
49453         b_conv.is_owned = ptr_is_owned(b);
49454         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49455         b_conv.is_owned = false;
49456         jboolean ret_conv = Stfu_eq(&a_conv, &b_conv);
49457         return ret_conv;
49458 }
49459
49460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49461         LDKSplice this_obj_conv;
49462         this_obj_conv.inner = untag_ptr(this_obj);
49463         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49465         Splice_free(this_obj_conv);
49466 }
49467
49468 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Splice_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
49469         LDKSplice this_ptr_conv;
49470         this_ptr_conv.inner = untag_ptr(this_ptr);
49471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49473         this_ptr_conv.is_owned = false;
49474         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49475         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Splice_get_channel_id(&this_ptr_conv));
49476         return ret_arr;
49477 }
49478
49479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49480         LDKSplice this_ptr_conv;
49481         this_ptr_conv.inner = untag_ptr(this_ptr);
49482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49484         this_ptr_conv.is_owned = false;
49485         LDKThirtyTwoBytes val_ref;
49486         CHECK((*env)->GetArrayLength(env, val) == 32);
49487         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49488         Splice_set_channel_id(&this_ptr_conv, val_ref);
49489 }
49490
49491 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Splice_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
49492         LDKSplice this_ptr_conv;
49493         this_ptr_conv.inner = untag_ptr(this_ptr);
49494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49496         this_ptr_conv.is_owned = false;
49497         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49498         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Splice_get_chain_hash(&this_ptr_conv));
49499         return ret_arr;
49500 }
49501
49502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49503         LDKSplice this_ptr_conv;
49504         this_ptr_conv.inner = untag_ptr(this_ptr);
49505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49507         this_ptr_conv.is_owned = false;
49508         LDKThirtyTwoBytes val_ref;
49509         CHECK((*env)->GetArrayLength(env, val) == 32);
49510         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49511         Splice_set_chain_hash(&this_ptr_conv, val_ref);
49512 }
49513
49514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1get_1relative_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
49515         LDKSplice this_ptr_conv;
49516         this_ptr_conv.inner = untag_ptr(this_ptr);
49517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49519         this_ptr_conv.is_owned = false;
49520         int64_t ret_conv = Splice_get_relative_satoshis(&this_ptr_conv);
49521         return ret_conv;
49522 }
49523
49524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1relative_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49525         LDKSplice this_ptr_conv;
49526         this_ptr_conv.inner = untag_ptr(this_ptr);
49527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49529         this_ptr_conv.is_owned = false;
49530         Splice_set_relative_satoshis(&this_ptr_conv, val);
49531 }
49532
49533 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Splice_1get_1funding_1feerate_1perkw(JNIEnv *env, jclass clz, int64_t this_ptr) {
49534         LDKSplice this_ptr_conv;
49535         this_ptr_conv.inner = untag_ptr(this_ptr);
49536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49538         this_ptr_conv.is_owned = false;
49539         int32_t ret_conv = Splice_get_funding_feerate_perkw(&this_ptr_conv);
49540         return ret_conv;
49541 }
49542
49543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1funding_1feerate_1perkw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49544         LDKSplice this_ptr_conv;
49545         this_ptr_conv.inner = untag_ptr(this_ptr);
49546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49548         this_ptr_conv.is_owned = false;
49549         Splice_set_funding_feerate_perkw(&this_ptr_conv, val);
49550 }
49551
49552 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Splice_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
49553         LDKSplice this_ptr_conv;
49554         this_ptr_conv.inner = untag_ptr(this_ptr);
49555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49557         this_ptr_conv.is_owned = false;
49558         int32_t ret_conv = Splice_get_locktime(&this_ptr_conv);
49559         return ret_conv;
49560 }
49561
49562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49563         LDKSplice this_ptr_conv;
49564         this_ptr_conv.inner = untag_ptr(this_ptr);
49565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49567         this_ptr_conv.is_owned = false;
49568         Splice_set_locktime(&this_ptr_conv, val);
49569 }
49570
49571 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Splice_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
49572         LDKSplice this_ptr_conv;
49573         this_ptr_conv.inner = untag_ptr(this_ptr);
49574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49576         this_ptr_conv.is_owned = false;
49577         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49578         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Splice_get_funding_pubkey(&this_ptr_conv).compressed_form);
49579         return ret_arr;
49580 }
49581
49582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49583         LDKSplice this_ptr_conv;
49584         this_ptr_conv.inner = untag_ptr(this_ptr);
49585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49587         this_ptr_conv.is_owned = false;
49588         LDKPublicKey val_ref;
49589         CHECK((*env)->GetArrayLength(env, val) == 33);
49590         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
49591         Splice_set_funding_pubkey(&this_ptr_conv, val_ref);
49592 }
49593
49594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray chain_hash_arg, int64_t relative_satoshis_arg, int32_t funding_feerate_perkw_arg, int32_t locktime_arg, int8_tArray funding_pubkey_arg) {
49595         LDKThirtyTwoBytes channel_id_arg_ref;
49596         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
49597         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
49598         LDKThirtyTwoBytes chain_hash_arg_ref;
49599         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
49600         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
49601         LDKPublicKey funding_pubkey_arg_ref;
49602         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
49603         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
49604         LDKSplice ret_var = Splice_new(channel_id_arg_ref, chain_hash_arg_ref, relative_satoshis_arg, funding_feerate_perkw_arg, locktime_arg, funding_pubkey_arg_ref);
49605         int64_t ret_ref = 0;
49606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49608         return ret_ref;
49609 }
49610
49611 static inline uint64_t Splice_clone_ptr(LDKSplice *NONNULL_PTR arg) {
49612         LDKSplice ret_var = Splice_clone(arg);
49613         int64_t ret_ref = 0;
49614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49616         return ret_ref;
49617 }
49618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49619         LDKSplice arg_conv;
49620         arg_conv.inner = untag_ptr(arg);
49621         arg_conv.is_owned = ptr_is_owned(arg);
49622         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49623         arg_conv.is_owned = false;
49624         int64_t ret_conv = Splice_clone_ptr(&arg_conv);
49625         return ret_conv;
49626 }
49627
49628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49629         LDKSplice orig_conv;
49630         orig_conv.inner = untag_ptr(orig);
49631         orig_conv.is_owned = ptr_is_owned(orig);
49632         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49633         orig_conv.is_owned = false;
49634         LDKSplice ret_var = Splice_clone(&orig_conv);
49635         int64_t ret_ref = 0;
49636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49638         return ret_ref;
49639 }
49640
49641 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Splice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49642         LDKSplice a_conv;
49643         a_conv.inner = untag_ptr(a);
49644         a_conv.is_owned = ptr_is_owned(a);
49645         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49646         a_conv.is_owned = false;
49647         LDKSplice b_conv;
49648         b_conv.inner = untag_ptr(b);
49649         b_conv.is_owned = ptr_is_owned(b);
49650         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49651         b_conv.is_owned = false;
49652         jboolean ret_conv = Splice_eq(&a_conv, &b_conv);
49653         return ret_conv;
49654 }
49655
49656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49657         LDKSpliceAck this_obj_conv;
49658         this_obj_conv.inner = untag_ptr(this_obj);
49659         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49661         SpliceAck_free(this_obj_conv);
49662 }
49663
49664 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceAck_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
49665         LDKSpliceAck this_ptr_conv;
49666         this_ptr_conv.inner = untag_ptr(this_ptr);
49667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49669         this_ptr_conv.is_owned = false;
49670         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49671         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SpliceAck_get_channel_id(&this_ptr_conv));
49672         return ret_arr;
49673 }
49674
49675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49676         LDKSpliceAck this_ptr_conv;
49677         this_ptr_conv.inner = untag_ptr(this_ptr);
49678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49680         this_ptr_conv.is_owned = false;
49681         LDKThirtyTwoBytes val_ref;
49682         CHECK((*env)->GetArrayLength(env, val) == 32);
49683         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49684         SpliceAck_set_channel_id(&this_ptr_conv, val_ref);
49685 }
49686
49687 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceAck_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
49688         LDKSpliceAck this_ptr_conv;
49689         this_ptr_conv.inner = untag_ptr(this_ptr);
49690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49692         this_ptr_conv.is_owned = false;
49693         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49694         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SpliceAck_get_chain_hash(&this_ptr_conv));
49695         return ret_arr;
49696 }
49697
49698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49699         LDKSpliceAck this_ptr_conv;
49700         this_ptr_conv.inner = untag_ptr(this_ptr);
49701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49703         this_ptr_conv.is_owned = false;
49704         LDKThirtyTwoBytes val_ref;
49705         CHECK((*env)->GetArrayLength(env, val) == 32);
49706         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49707         SpliceAck_set_chain_hash(&this_ptr_conv, val_ref);
49708 }
49709
49710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1get_1relative_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
49711         LDKSpliceAck this_ptr_conv;
49712         this_ptr_conv.inner = untag_ptr(this_ptr);
49713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49715         this_ptr_conv.is_owned = false;
49716         int64_t ret_conv = SpliceAck_get_relative_satoshis(&this_ptr_conv);
49717         return ret_conv;
49718 }
49719
49720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1set_1relative_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49721         LDKSpliceAck this_ptr_conv;
49722         this_ptr_conv.inner = untag_ptr(this_ptr);
49723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49725         this_ptr_conv.is_owned = false;
49726         SpliceAck_set_relative_satoshis(&this_ptr_conv, val);
49727 }
49728
49729 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceAck_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
49730         LDKSpliceAck this_ptr_conv;
49731         this_ptr_conv.inner = untag_ptr(this_ptr);
49732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49734         this_ptr_conv.is_owned = false;
49735         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49736         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, SpliceAck_get_funding_pubkey(&this_ptr_conv).compressed_form);
49737         return ret_arr;
49738 }
49739
49740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49741         LDKSpliceAck this_ptr_conv;
49742         this_ptr_conv.inner = untag_ptr(this_ptr);
49743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49745         this_ptr_conv.is_owned = false;
49746         LDKPublicKey val_ref;
49747         CHECK((*env)->GetArrayLength(env, val) == 33);
49748         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
49749         SpliceAck_set_funding_pubkey(&this_ptr_conv, val_ref);
49750 }
49751
49752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray chain_hash_arg, int64_t relative_satoshis_arg, int8_tArray funding_pubkey_arg) {
49753         LDKThirtyTwoBytes channel_id_arg_ref;
49754         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
49755         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
49756         LDKThirtyTwoBytes chain_hash_arg_ref;
49757         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
49758         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
49759         LDKPublicKey funding_pubkey_arg_ref;
49760         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
49761         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
49762         LDKSpliceAck ret_var = SpliceAck_new(channel_id_arg_ref, chain_hash_arg_ref, relative_satoshis_arg, funding_pubkey_arg_ref);
49763         int64_t ret_ref = 0;
49764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49766         return ret_ref;
49767 }
49768
49769 static inline uint64_t SpliceAck_clone_ptr(LDKSpliceAck *NONNULL_PTR arg) {
49770         LDKSpliceAck ret_var = SpliceAck_clone(arg);
49771         int64_t ret_ref = 0;
49772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49774         return ret_ref;
49775 }
49776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49777         LDKSpliceAck arg_conv;
49778         arg_conv.inner = untag_ptr(arg);
49779         arg_conv.is_owned = ptr_is_owned(arg);
49780         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49781         arg_conv.is_owned = false;
49782         int64_t ret_conv = SpliceAck_clone_ptr(&arg_conv);
49783         return ret_conv;
49784 }
49785
49786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49787         LDKSpliceAck orig_conv;
49788         orig_conv.inner = untag_ptr(orig);
49789         orig_conv.is_owned = ptr_is_owned(orig);
49790         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49791         orig_conv.is_owned = false;
49792         LDKSpliceAck ret_var = SpliceAck_clone(&orig_conv);
49793         int64_t ret_ref = 0;
49794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49796         return ret_ref;
49797 }
49798
49799 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SpliceAck_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49800         LDKSpliceAck a_conv;
49801         a_conv.inner = untag_ptr(a);
49802         a_conv.is_owned = ptr_is_owned(a);
49803         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49804         a_conv.is_owned = false;
49805         LDKSpliceAck b_conv;
49806         b_conv.inner = untag_ptr(b);
49807         b_conv.is_owned = ptr_is_owned(b);
49808         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49809         b_conv.is_owned = false;
49810         jboolean ret_conv = SpliceAck_eq(&a_conv, &b_conv);
49811         return ret_conv;
49812 }
49813
49814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49815         LDKSpliceLocked this_obj_conv;
49816         this_obj_conv.inner = untag_ptr(this_obj);
49817         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49819         SpliceLocked_free(this_obj_conv);
49820 }
49821
49822 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
49823         LDKSpliceLocked this_ptr_conv;
49824         this_ptr_conv.inner = untag_ptr(this_ptr);
49825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49827         this_ptr_conv.is_owned = false;
49828         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49829         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SpliceLocked_get_channel_id(&this_ptr_conv));
49830         return ret_arr;
49831 }
49832
49833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49834         LDKSpliceLocked this_ptr_conv;
49835         this_ptr_conv.inner = untag_ptr(this_ptr);
49836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49838         this_ptr_conv.is_owned = false;
49839         LDKThirtyTwoBytes val_ref;
49840         CHECK((*env)->GetArrayLength(env, val) == 32);
49841         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49842         SpliceLocked_set_channel_id(&this_ptr_conv, val_ref);
49843 }
49844
49845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg) {
49846         LDKThirtyTwoBytes channel_id_arg_ref;
49847         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
49848         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
49849         LDKSpliceLocked ret_var = SpliceLocked_new(channel_id_arg_ref);
49850         int64_t ret_ref = 0;
49851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49853         return ret_ref;
49854 }
49855
49856 static inline uint64_t SpliceLocked_clone_ptr(LDKSpliceLocked *NONNULL_PTR arg) {
49857         LDKSpliceLocked ret_var = SpliceLocked_clone(arg);
49858         int64_t ret_ref = 0;
49859         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49860         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49861         return ret_ref;
49862 }
49863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49864         LDKSpliceLocked arg_conv;
49865         arg_conv.inner = untag_ptr(arg);
49866         arg_conv.is_owned = ptr_is_owned(arg);
49867         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49868         arg_conv.is_owned = false;
49869         int64_t ret_conv = SpliceLocked_clone_ptr(&arg_conv);
49870         return ret_conv;
49871 }
49872
49873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49874         LDKSpliceLocked orig_conv;
49875         orig_conv.inner = untag_ptr(orig);
49876         orig_conv.is_owned = ptr_is_owned(orig);
49877         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49878         orig_conv.is_owned = false;
49879         LDKSpliceLocked ret_var = SpliceLocked_clone(&orig_conv);
49880         int64_t ret_ref = 0;
49881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49883         return ret_ref;
49884 }
49885
49886 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49887         LDKSpliceLocked a_conv;
49888         a_conv.inner = untag_ptr(a);
49889         a_conv.is_owned = ptr_is_owned(a);
49890         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49891         a_conv.is_owned = false;
49892         LDKSpliceLocked b_conv;
49893         b_conv.inner = untag_ptr(b);
49894         b_conv.is_owned = ptr_is_owned(b);
49895         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49896         b_conv.is_owned = false;
49897         jboolean ret_conv = SpliceLocked_eq(&a_conv, &b_conv);
49898         return ret_conv;
49899 }
49900
49901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49902         LDKTxAddInput this_obj_conv;
49903         this_obj_conv.inner = untag_ptr(this_obj);
49904         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49906         TxAddInput_free(this_obj_conv);
49907 }
49908
49909 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
49910         LDKTxAddInput this_ptr_conv;
49911         this_ptr_conv.inner = untag_ptr(this_ptr);
49912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49914         this_ptr_conv.is_owned = false;
49915         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49916         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAddInput_get_channel_id(&this_ptr_conv));
49917         return ret_arr;
49918 }
49919
49920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49921         LDKTxAddInput this_ptr_conv;
49922         this_ptr_conv.inner = untag_ptr(this_ptr);
49923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49925         this_ptr_conv.is_owned = false;
49926         LDKThirtyTwoBytes val_ref;
49927         CHECK((*env)->GetArrayLength(env, val) == 32);
49928         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
49929         TxAddInput_set_channel_id(&this_ptr_conv, val_ref);
49930 }
49931
49932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
49933         LDKTxAddInput this_ptr_conv;
49934         this_ptr_conv.inner = untag_ptr(this_ptr);
49935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49937         this_ptr_conv.is_owned = false;
49938         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
49939         return ret_conv;
49940 }
49941
49942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49943         LDKTxAddInput this_ptr_conv;
49944         this_ptr_conv.inner = untag_ptr(this_ptr);
49945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49947         this_ptr_conv.is_owned = false;
49948         TxAddInput_set_serial_id(&this_ptr_conv, val);
49949 }
49950
49951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1prevtx(JNIEnv *env, jclass clz, int64_t this_ptr) {
49952         LDKTxAddInput this_ptr_conv;
49953         this_ptr_conv.inner = untag_ptr(this_ptr);
49954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49956         this_ptr_conv.is_owned = false;
49957         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
49958         int64_t ret_ref = 0;
49959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49961         return ret_ref;
49962 }
49963
49964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1prevtx(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49965         LDKTxAddInput this_ptr_conv;
49966         this_ptr_conv.inner = untag_ptr(this_ptr);
49967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49969         this_ptr_conv.is_owned = false;
49970         LDKTransactionU16LenLimited val_conv;
49971         val_conv.inner = untag_ptr(val);
49972         val_conv.is_owned = ptr_is_owned(val);
49973         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49974         val_conv = TransactionU16LenLimited_clone(&val_conv);
49975         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
49976 }
49977
49978 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1prevtx_1out(JNIEnv *env, jclass clz, int64_t this_ptr) {
49979         LDKTxAddInput this_ptr_conv;
49980         this_ptr_conv.inner = untag_ptr(this_ptr);
49981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49983         this_ptr_conv.is_owned = false;
49984         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
49985         return ret_conv;
49986 }
49987
49988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1prevtx_1out(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
49989         LDKTxAddInput this_ptr_conv;
49990         this_ptr_conv.inner = untag_ptr(this_ptr);
49991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49993         this_ptr_conv.is_owned = false;
49994         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
49995 }
49996
49997 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1sequence(JNIEnv *env, jclass clz, int64_t this_ptr) {
49998         LDKTxAddInput this_ptr_conv;
49999         this_ptr_conv.inner = untag_ptr(this_ptr);
50000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50002         this_ptr_conv.is_owned = false;
50003         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
50004         return ret_conv;
50005 }
50006
50007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1sequence(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
50008         LDKTxAddInput this_ptr_conv;
50009         this_ptr_conv.inner = untag_ptr(this_ptr);
50010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50012         this_ptr_conv.is_owned = false;
50013         TxAddInput_set_sequence(&this_ptr_conv, val);
50014 }
50015
50016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t serial_id_arg, int64_t prevtx_arg, int32_t prevtx_out_arg, int32_t sequence_arg) {
50017         LDKThirtyTwoBytes channel_id_arg_ref;
50018         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
50019         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
50020         LDKTransactionU16LenLimited prevtx_arg_conv;
50021         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
50022         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
50023         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
50024         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
50025         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_ref, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
50026         int64_t ret_ref = 0;
50027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50029         return ret_ref;
50030 }
50031
50032 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
50033         LDKTxAddInput ret_var = TxAddInput_clone(arg);
50034         int64_t ret_ref = 0;
50035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50037         return ret_ref;
50038 }
50039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50040         LDKTxAddInput arg_conv;
50041         arg_conv.inner = untag_ptr(arg);
50042         arg_conv.is_owned = ptr_is_owned(arg);
50043         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50044         arg_conv.is_owned = false;
50045         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
50046         return ret_conv;
50047 }
50048
50049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50050         LDKTxAddInput orig_conv;
50051         orig_conv.inner = untag_ptr(orig);
50052         orig_conv.is_owned = ptr_is_owned(orig);
50053         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50054         orig_conv.is_owned = false;
50055         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
50056         int64_t ret_ref = 0;
50057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50059         return ret_ref;
50060 }
50061
50062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1hash(JNIEnv *env, jclass clz, int64_t o) {
50063         LDKTxAddInput o_conv;
50064         o_conv.inner = untag_ptr(o);
50065         o_conv.is_owned = ptr_is_owned(o);
50066         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50067         o_conv.is_owned = false;
50068         int64_t ret_conv = TxAddInput_hash(&o_conv);
50069         return ret_conv;
50070 }
50071
50072 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAddInput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50073         LDKTxAddInput a_conv;
50074         a_conv.inner = untag_ptr(a);
50075         a_conv.is_owned = ptr_is_owned(a);
50076         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50077         a_conv.is_owned = false;
50078         LDKTxAddInput b_conv;
50079         b_conv.inner = untag_ptr(b);
50080         b_conv.is_owned = ptr_is_owned(b);
50081         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50082         b_conv.is_owned = false;
50083         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
50084         return ret_conv;
50085 }
50086
50087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50088         LDKTxAddOutput this_obj_conv;
50089         this_obj_conv.inner = untag_ptr(this_obj);
50090         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50092         TxAddOutput_free(this_obj_conv);
50093 }
50094
50095 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50096         LDKTxAddOutput this_ptr_conv;
50097         this_ptr_conv.inner = untag_ptr(this_ptr);
50098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50100         this_ptr_conv.is_owned = false;
50101         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50102         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAddOutput_get_channel_id(&this_ptr_conv));
50103         return ret_arr;
50104 }
50105
50106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50107         LDKTxAddOutput this_ptr_conv;
50108         this_ptr_conv.inner = untag_ptr(this_ptr);
50109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50111         this_ptr_conv.is_owned = false;
50112         LDKThirtyTwoBytes val_ref;
50113         CHECK((*env)->GetArrayLength(env, val) == 32);
50114         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50115         TxAddOutput_set_channel_id(&this_ptr_conv, val_ref);
50116 }
50117
50118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50119         LDKTxAddOutput this_ptr_conv;
50120         this_ptr_conv.inner = untag_ptr(this_ptr);
50121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50123         this_ptr_conv.is_owned = false;
50124         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
50125         return ret_conv;
50126 }
50127
50128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50129         LDKTxAddOutput this_ptr_conv;
50130         this_ptr_conv.inner = untag_ptr(this_ptr);
50131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50133         this_ptr_conv.is_owned = false;
50134         TxAddOutput_set_serial_id(&this_ptr_conv, val);
50135 }
50136
50137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
50138         LDKTxAddOutput this_ptr_conv;
50139         this_ptr_conv.inner = untag_ptr(this_ptr);
50140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50142         this_ptr_conv.is_owned = false;
50143         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
50144         return ret_conv;
50145 }
50146
50147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50148         LDKTxAddOutput this_ptr_conv;
50149         this_ptr_conv.inner = untag_ptr(this_ptr);
50150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50152         this_ptr_conv.is_owned = false;
50153         TxAddOutput_set_sats(&this_ptr_conv, val);
50154 }
50155
50156 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
50157         LDKTxAddOutput this_ptr_conv;
50158         this_ptr_conv.inner = untag_ptr(this_ptr);
50159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50161         this_ptr_conv.is_owned = false;
50162         LDKCVec_u8Z ret_var = TxAddOutput_get_script(&this_ptr_conv);
50163         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50164         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50165         CVec_u8Z_free(ret_var);
50166         return ret_arr;
50167 }
50168
50169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50170         LDKTxAddOutput this_ptr_conv;
50171         this_ptr_conv.inner = untag_ptr(this_ptr);
50172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50174         this_ptr_conv.is_owned = false;
50175         LDKCVec_u8Z val_ref;
50176         val_ref.datalen = (*env)->GetArrayLength(env, val);
50177         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
50178         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
50179         TxAddOutput_set_script(&this_ptr_conv, val_ref);
50180 }
50181
50182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t serial_id_arg, int64_t sats_arg, int8_tArray script_arg) {
50183         LDKThirtyTwoBytes channel_id_arg_ref;
50184         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
50185         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
50186         LDKCVec_u8Z script_arg_ref;
50187         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
50188         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
50189         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
50190         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_ref, serial_id_arg, sats_arg, script_arg_ref);
50191         int64_t ret_ref = 0;
50192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50194         return ret_ref;
50195 }
50196
50197 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
50198         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
50199         int64_t ret_ref = 0;
50200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50202         return ret_ref;
50203 }
50204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50205         LDKTxAddOutput arg_conv;
50206         arg_conv.inner = untag_ptr(arg);
50207         arg_conv.is_owned = ptr_is_owned(arg);
50208         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50209         arg_conv.is_owned = false;
50210         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
50211         return ret_conv;
50212 }
50213
50214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50215         LDKTxAddOutput orig_conv;
50216         orig_conv.inner = untag_ptr(orig);
50217         orig_conv.is_owned = ptr_is_owned(orig);
50218         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50219         orig_conv.is_owned = false;
50220         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
50221         int64_t ret_ref = 0;
50222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50224         return ret_ref;
50225 }
50226
50227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
50228         LDKTxAddOutput o_conv;
50229         o_conv.inner = untag_ptr(o);
50230         o_conv.is_owned = ptr_is_owned(o);
50231         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50232         o_conv.is_owned = false;
50233         int64_t ret_conv = TxAddOutput_hash(&o_conv);
50234         return ret_conv;
50235 }
50236
50237 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50238         LDKTxAddOutput a_conv;
50239         a_conv.inner = untag_ptr(a);
50240         a_conv.is_owned = ptr_is_owned(a);
50241         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50242         a_conv.is_owned = false;
50243         LDKTxAddOutput b_conv;
50244         b_conv.inner = untag_ptr(b);
50245         b_conv.is_owned = ptr_is_owned(b);
50246         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50247         b_conv.is_owned = false;
50248         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
50249         return ret_conv;
50250 }
50251
50252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50253         LDKTxRemoveInput this_obj_conv;
50254         this_obj_conv.inner = untag_ptr(this_obj);
50255         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50257         TxRemoveInput_free(this_obj_conv);
50258 }
50259
50260 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50261         LDKTxRemoveInput this_ptr_conv;
50262         this_ptr_conv.inner = untag_ptr(this_ptr);
50263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50265         this_ptr_conv.is_owned = false;
50266         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50267         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxRemoveInput_get_channel_id(&this_ptr_conv));
50268         return ret_arr;
50269 }
50270
50271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50272         LDKTxRemoveInput this_ptr_conv;
50273         this_ptr_conv.inner = untag_ptr(this_ptr);
50274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50276         this_ptr_conv.is_owned = false;
50277         LDKThirtyTwoBytes val_ref;
50278         CHECK((*env)->GetArrayLength(env, val) == 32);
50279         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50280         TxRemoveInput_set_channel_id(&this_ptr_conv, val_ref);
50281 }
50282
50283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50284         LDKTxRemoveInput this_ptr_conv;
50285         this_ptr_conv.inner = untag_ptr(this_ptr);
50286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50288         this_ptr_conv.is_owned = false;
50289         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
50290         return ret_conv;
50291 }
50292
50293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50294         LDKTxRemoveInput this_ptr_conv;
50295         this_ptr_conv.inner = untag_ptr(this_ptr);
50296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50298         this_ptr_conv.is_owned = false;
50299         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
50300 }
50301
50302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t serial_id_arg) {
50303         LDKThirtyTwoBytes channel_id_arg_ref;
50304         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
50305         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
50306         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_ref, serial_id_arg);
50307         int64_t ret_ref = 0;
50308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50310         return ret_ref;
50311 }
50312
50313 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
50314         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
50315         int64_t ret_ref = 0;
50316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50318         return ret_ref;
50319 }
50320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50321         LDKTxRemoveInput arg_conv;
50322         arg_conv.inner = untag_ptr(arg);
50323         arg_conv.is_owned = ptr_is_owned(arg);
50324         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50325         arg_conv.is_owned = false;
50326         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
50327         return ret_conv;
50328 }
50329
50330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50331         LDKTxRemoveInput orig_conv;
50332         orig_conv.inner = untag_ptr(orig);
50333         orig_conv.is_owned = ptr_is_owned(orig);
50334         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50335         orig_conv.is_owned = false;
50336         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
50337         int64_t ret_ref = 0;
50338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50340         return ret_ref;
50341 }
50342
50343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1hash(JNIEnv *env, jclass clz, int64_t o) {
50344         LDKTxRemoveInput o_conv;
50345         o_conv.inner = untag_ptr(o);
50346         o_conv.is_owned = ptr_is_owned(o);
50347         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50348         o_conv.is_owned = false;
50349         int64_t ret_conv = TxRemoveInput_hash(&o_conv);
50350         return ret_conv;
50351 }
50352
50353 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50354         LDKTxRemoveInput a_conv;
50355         a_conv.inner = untag_ptr(a);
50356         a_conv.is_owned = ptr_is_owned(a);
50357         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50358         a_conv.is_owned = false;
50359         LDKTxRemoveInput b_conv;
50360         b_conv.inner = untag_ptr(b);
50361         b_conv.is_owned = ptr_is_owned(b);
50362         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50363         b_conv.is_owned = false;
50364         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
50365         return ret_conv;
50366 }
50367
50368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50369         LDKTxRemoveOutput this_obj_conv;
50370         this_obj_conv.inner = untag_ptr(this_obj);
50371         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50373         TxRemoveOutput_free(this_obj_conv);
50374 }
50375
50376 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50377         LDKTxRemoveOutput this_ptr_conv;
50378         this_ptr_conv.inner = untag_ptr(this_ptr);
50379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50381         this_ptr_conv.is_owned = false;
50382         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50383         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxRemoveOutput_get_channel_id(&this_ptr_conv));
50384         return ret_arr;
50385 }
50386
50387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50388         LDKTxRemoveOutput this_ptr_conv;
50389         this_ptr_conv.inner = untag_ptr(this_ptr);
50390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50392         this_ptr_conv.is_owned = false;
50393         LDKThirtyTwoBytes val_ref;
50394         CHECK((*env)->GetArrayLength(env, val) == 32);
50395         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50396         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_ref);
50397 }
50398
50399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50400         LDKTxRemoveOutput this_ptr_conv;
50401         this_ptr_conv.inner = untag_ptr(this_ptr);
50402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50404         this_ptr_conv.is_owned = false;
50405         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
50406         return ret_conv;
50407 }
50408
50409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50410         LDKTxRemoveOutput this_ptr_conv;
50411         this_ptr_conv.inner = untag_ptr(this_ptr);
50412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50414         this_ptr_conv.is_owned = false;
50415         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
50416 }
50417
50418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t serial_id_arg) {
50419         LDKThirtyTwoBytes channel_id_arg_ref;
50420         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
50421         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
50422         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_ref, serial_id_arg);
50423         int64_t ret_ref = 0;
50424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50426         return ret_ref;
50427 }
50428
50429 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
50430         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
50431         int64_t ret_ref = 0;
50432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50434         return ret_ref;
50435 }
50436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50437         LDKTxRemoveOutput arg_conv;
50438         arg_conv.inner = untag_ptr(arg);
50439         arg_conv.is_owned = ptr_is_owned(arg);
50440         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50441         arg_conv.is_owned = false;
50442         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
50443         return ret_conv;
50444 }
50445
50446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50447         LDKTxRemoveOutput orig_conv;
50448         orig_conv.inner = untag_ptr(orig);
50449         orig_conv.is_owned = ptr_is_owned(orig);
50450         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50451         orig_conv.is_owned = false;
50452         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
50453         int64_t ret_ref = 0;
50454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50456         return ret_ref;
50457 }
50458
50459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
50460         LDKTxRemoveOutput o_conv;
50461         o_conv.inner = untag_ptr(o);
50462         o_conv.is_owned = ptr_is_owned(o);
50463         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50464         o_conv.is_owned = false;
50465         int64_t ret_conv = TxRemoveOutput_hash(&o_conv);
50466         return ret_conv;
50467 }
50468
50469 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50470         LDKTxRemoveOutput a_conv;
50471         a_conv.inner = untag_ptr(a);
50472         a_conv.is_owned = ptr_is_owned(a);
50473         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50474         a_conv.is_owned = false;
50475         LDKTxRemoveOutput b_conv;
50476         b_conv.inner = untag_ptr(b);
50477         b_conv.is_owned = ptr_is_owned(b);
50478         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50479         b_conv.is_owned = false;
50480         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
50481         return ret_conv;
50482 }
50483
50484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxComplete_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50485         LDKTxComplete this_obj_conv;
50486         this_obj_conv.inner = untag_ptr(this_obj);
50487         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50489         TxComplete_free(this_obj_conv);
50490 }
50491
50492 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxComplete_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50493         LDKTxComplete this_ptr_conv;
50494         this_ptr_conv.inner = untag_ptr(this_ptr);
50495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50497         this_ptr_conv.is_owned = false;
50498         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50499         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxComplete_get_channel_id(&this_ptr_conv));
50500         return ret_arr;
50501 }
50502
50503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxComplete_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50504         LDKTxComplete this_ptr_conv;
50505         this_ptr_conv.inner = untag_ptr(this_ptr);
50506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50508         this_ptr_conv.is_owned = false;
50509         LDKThirtyTwoBytes val_ref;
50510         CHECK((*env)->GetArrayLength(env, val) == 32);
50511         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50512         TxComplete_set_channel_id(&this_ptr_conv, val_ref);
50513 }
50514
50515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg) {
50516         LDKThirtyTwoBytes channel_id_arg_ref;
50517         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
50518         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
50519         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_ref);
50520         int64_t ret_ref = 0;
50521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50523         return ret_ref;
50524 }
50525
50526 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
50527         LDKTxComplete ret_var = TxComplete_clone(arg);
50528         int64_t ret_ref = 0;
50529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50531         return ret_ref;
50532 }
50533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50534         LDKTxComplete arg_conv;
50535         arg_conv.inner = untag_ptr(arg);
50536         arg_conv.is_owned = ptr_is_owned(arg);
50537         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50538         arg_conv.is_owned = false;
50539         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
50540         return ret_conv;
50541 }
50542
50543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50544         LDKTxComplete orig_conv;
50545         orig_conv.inner = untag_ptr(orig);
50546         orig_conv.is_owned = ptr_is_owned(orig);
50547         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50548         orig_conv.is_owned = false;
50549         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
50550         int64_t ret_ref = 0;
50551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50553         return ret_ref;
50554 }
50555
50556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1hash(JNIEnv *env, jclass clz, int64_t o) {
50557         LDKTxComplete o_conv;
50558         o_conv.inner = untag_ptr(o);
50559         o_conv.is_owned = ptr_is_owned(o);
50560         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50561         o_conv.is_owned = false;
50562         int64_t ret_conv = TxComplete_hash(&o_conv);
50563         return ret_conv;
50564 }
50565
50566 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxComplete_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50567         LDKTxComplete a_conv;
50568         a_conv.inner = untag_ptr(a);
50569         a_conv.is_owned = ptr_is_owned(a);
50570         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50571         a_conv.is_owned = false;
50572         LDKTxComplete b_conv;
50573         b_conv.inner = untag_ptr(b);
50574         b_conv.is_owned = ptr_is_owned(b);
50575         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50576         b_conv.is_owned = false;
50577         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
50578         return ret_conv;
50579 }
50580
50581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50582         LDKTxSignatures this_obj_conv;
50583         this_obj_conv.inner = untag_ptr(this_obj);
50584         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50586         TxSignatures_free(this_obj_conv);
50587 }
50588
50589 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50590         LDKTxSignatures this_ptr_conv;
50591         this_ptr_conv.inner = untag_ptr(this_ptr);
50592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50594         this_ptr_conv.is_owned = false;
50595         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50596         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxSignatures_get_channel_id(&this_ptr_conv));
50597         return ret_arr;
50598 }
50599
50600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50601         LDKTxSignatures this_ptr_conv;
50602         this_ptr_conv.inner = untag_ptr(this_ptr);
50603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50605         this_ptr_conv.is_owned = false;
50606         LDKThirtyTwoBytes val_ref;
50607         CHECK((*env)->GetArrayLength(env, val) == 32);
50608         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50609         TxSignatures_set_channel_id(&this_ptr_conv, val_ref);
50610 }
50611
50612 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1tx_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
50613         LDKTxSignatures this_ptr_conv;
50614         this_ptr_conv.inner = untag_ptr(this_ptr);
50615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50617         this_ptr_conv.is_owned = false;
50618         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50619         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxSignatures_get_tx_hash(&this_ptr_conv));
50620         return ret_arr;
50621 }
50622
50623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1tx_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50624         LDKTxSignatures this_ptr_conv;
50625         this_ptr_conv.inner = untag_ptr(this_ptr);
50626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50628         this_ptr_conv.is_owned = false;
50629         LDKThirtyTwoBytes val_ref;
50630         CHECK((*env)->GetArrayLength(env, val) == 32);
50631         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50632         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
50633 }
50634
50635 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1witnesses(JNIEnv *env, jclass clz, int64_t this_ptr) {
50636         LDKTxSignatures this_ptr_conv;
50637         this_ptr_conv.inner = untag_ptr(this_ptr);
50638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50640         this_ptr_conv.is_owned = false;
50641         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
50642         jobjectArray ret_arr = NULL;
50643         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
50644         ;
50645         for (size_t i = 0; i < ret_var.datalen; i++) {
50646                 LDKWitness ret_conv_8_var = ret_var.data[i];
50647                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
50648                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
50649                 Witness_free(ret_conv_8_var);
50650                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
50651         }
50652         
50653         FREE(ret_var.data);
50654         return ret_arr;
50655 }
50656
50657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1witnesses(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
50658         LDKTxSignatures this_ptr_conv;
50659         this_ptr_conv.inner = untag_ptr(this_ptr);
50660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50662         this_ptr_conv.is_owned = false;
50663         LDKCVec_WitnessZ val_constr;
50664         val_constr.datalen = (*env)->GetArrayLength(env, val);
50665         if (val_constr.datalen > 0)
50666                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
50667         else
50668                 val_constr.data = NULL;
50669         for (size_t i = 0; i < val_constr.datalen; i++) {
50670                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
50671                 LDKWitness val_conv_8_ref;
50672                 val_conv_8_ref.datalen = (*env)->GetArrayLength(env, val_conv_8);
50673                 val_conv_8_ref.data = MALLOC(val_conv_8_ref.datalen, "LDKWitness Bytes");
50674                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, val_conv_8_ref.datalen, val_conv_8_ref.data);
50675                 val_conv_8_ref.data_is_owned = true;
50676                 val_constr.data[i] = val_conv_8_ref;
50677         }
50678         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
50679 }
50680
50681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray tx_hash_arg, jobjectArray witnesses_arg) {
50682         LDKThirtyTwoBytes channel_id_arg_ref;
50683         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
50684         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
50685         LDKThirtyTwoBytes tx_hash_arg_ref;
50686         CHECK((*env)->GetArrayLength(env, tx_hash_arg) == 32);
50687         (*env)->GetByteArrayRegion(env, tx_hash_arg, 0, 32, tx_hash_arg_ref.data);
50688         LDKCVec_WitnessZ witnesses_arg_constr;
50689         witnesses_arg_constr.datalen = (*env)->GetArrayLength(env, witnesses_arg);
50690         if (witnesses_arg_constr.datalen > 0)
50691                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
50692         else
50693                 witnesses_arg_constr.data = NULL;
50694         for (size_t i = 0; i < witnesses_arg_constr.datalen; i++) {
50695                 int8_tArray witnesses_arg_conv_8 = (*env)->GetObjectArrayElement(env, witnesses_arg, i);
50696                 LDKWitness witnesses_arg_conv_8_ref;
50697                 witnesses_arg_conv_8_ref.datalen = (*env)->GetArrayLength(env, witnesses_arg_conv_8);
50698                 witnesses_arg_conv_8_ref.data = MALLOC(witnesses_arg_conv_8_ref.datalen, "LDKWitness Bytes");
50699                 (*env)->GetByteArrayRegion(env, witnesses_arg_conv_8, 0, witnesses_arg_conv_8_ref.datalen, witnesses_arg_conv_8_ref.data);
50700                 witnesses_arg_conv_8_ref.data_is_owned = true;
50701                 witnesses_arg_constr.data[i] = witnesses_arg_conv_8_ref;
50702         }
50703         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_ref, tx_hash_arg_ref, witnesses_arg_constr);
50704         int64_t ret_ref = 0;
50705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50707         return ret_ref;
50708 }
50709
50710 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
50711         LDKTxSignatures ret_var = TxSignatures_clone(arg);
50712         int64_t ret_ref = 0;
50713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50715         return ret_ref;
50716 }
50717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50718         LDKTxSignatures arg_conv;
50719         arg_conv.inner = untag_ptr(arg);
50720         arg_conv.is_owned = ptr_is_owned(arg);
50721         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50722         arg_conv.is_owned = false;
50723         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
50724         return ret_conv;
50725 }
50726
50727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50728         LDKTxSignatures orig_conv;
50729         orig_conv.inner = untag_ptr(orig);
50730         orig_conv.is_owned = ptr_is_owned(orig);
50731         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50732         orig_conv.is_owned = false;
50733         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
50734         int64_t ret_ref = 0;
50735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50737         return ret_ref;
50738 }
50739
50740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
50741         LDKTxSignatures o_conv;
50742         o_conv.inner = untag_ptr(o);
50743         o_conv.is_owned = ptr_is_owned(o);
50744         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50745         o_conv.is_owned = false;
50746         int64_t ret_conv = TxSignatures_hash(&o_conv);
50747         return ret_conv;
50748 }
50749
50750 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxSignatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50751         LDKTxSignatures a_conv;
50752         a_conv.inner = untag_ptr(a);
50753         a_conv.is_owned = ptr_is_owned(a);
50754         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50755         a_conv.is_owned = false;
50756         LDKTxSignatures b_conv;
50757         b_conv.inner = untag_ptr(b);
50758         b_conv.is_owned = ptr_is_owned(b);
50759         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50760         b_conv.is_owned = false;
50761         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
50762         return ret_conv;
50763 }
50764
50765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50766         LDKTxInitRbf this_obj_conv;
50767         this_obj_conv.inner = untag_ptr(this_obj);
50768         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50770         TxInitRbf_free(this_obj_conv);
50771 }
50772
50773 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50774         LDKTxInitRbf this_ptr_conv;
50775         this_ptr_conv.inner = untag_ptr(this_ptr);
50776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50778         this_ptr_conv.is_owned = false;
50779         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50780         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxInitRbf_get_channel_id(&this_ptr_conv));
50781         return ret_arr;
50782 }
50783
50784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50785         LDKTxInitRbf this_ptr_conv;
50786         this_ptr_conv.inner = untag_ptr(this_ptr);
50787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50789         this_ptr_conv.is_owned = false;
50790         LDKThirtyTwoBytes val_ref;
50791         CHECK((*env)->GetArrayLength(env, val) == 32);
50792         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50793         TxInitRbf_set_channel_id(&this_ptr_conv, val_ref);
50794 }
50795
50796 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
50797         LDKTxInitRbf this_ptr_conv;
50798         this_ptr_conv.inner = untag_ptr(this_ptr);
50799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50801         this_ptr_conv.is_owned = false;
50802         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
50803         return ret_conv;
50804 }
50805
50806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
50807         LDKTxInitRbf this_ptr_conv;
50808         this_ptr_conv.inner = untag_ptr(this_ptr);
50809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50811         this_ptr_conv.is_owned = false;
50812         TxInitRbf_set_locktime(&this_ptr_conv, val);
50813 }
50814
50815 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
50816         LDKTxInitRbf this_ptr_conv;
50817         this_ptr_conv.inner = untag_ptr(this_ptr);
50818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50820         this_ptr_conv.is_owned = false;
50821         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
50822         return ret_conv;
50823 }
50824
50825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
50826         LDKTxInitRbf this_ptr_conv;
50827         this_ptr_conv.inner = untag_ptr(this_ptr);
50828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50830         this_ptr_conv.is_owned = false;
50831         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
50832 }
50833
50834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr) {
50835         LDKTxInitRbf this_ptr_conv;
50836         this_ptr_conv.inner = untag_ptr(this_ptr);
50837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50839         this_ptr_conv.is_owned = false;
50840         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
50841         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
50842         int64_t ret_ref = tag_ptr(ret_copy, true);
50843         return ret_ref;
50844 }
50845
50846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50847         LDKTxInitRbf this_ptr_conv;
50848         this_ptr_conv.inner = untag_ptr(this_ptr);
50849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50851         this_ptr_conv.is_owned = false;
50852         void* val_ptr = untag_ptr(val);
50853         CHECK_ACCESS(val_ptr);
50854         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
50855         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
50856         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
50857 }
50858
50859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int32_t locktime_arg, int32_t feerate_sat_per_1000_weight_arg, int64_t funding_output_contribution_arg) {
50860         LDKThirtyTwoBytes channel_id_arg_ref;
50861         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
50862         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
50863         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
50864         CHECK_ACCESS(funding_output_contribution_arg_ptr);
50865         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
50866         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
50867         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_ref, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
50868         int64_t ret_ref = 0;
50869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50871         return ret_ref;
50872 }
50873
50874 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
50875         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
50876         int64_t ret_ref = 0;
50877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50879         return ret_ref;
50880 }
50881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50882         LDKTxInitRbf arg_conv;
50883         arg_conv.inner = untag_ptr(arg);
50884         arg_conv.is_owned = ptr_is_owned(arg);
50885         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50886         arg_conv.is_owned = false;
50887         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
50888         return ret_conv;
50889 }
50890
50891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50892         LDKTxInitRbf orig_conv;
50893         orig_conv.inner = untag_ptr(orig);
50894         orig_conv.is_owned = ptr_is_owned(orig);
50895         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50896         orig_conv.is_owned = false;
50897         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
50898         int64_t ret_ref = 0;
50899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50901         return ret_ref;
50902 }
50903
50904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1hash(JNIEnv *env, jclass clz, int64_t o) {
50905         LDKTxInitRbf o_conv;
50906         o_conv.inner = untag_ptr(o);
50907         o_conv.is_owned = ptr_is_owned(o);
50908         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50909         o_conv.is_owned = false;
50910         int64_t ret_conv = TxInitRbf_hash(&o_conv);
50911         return ret_conv;
50912 }
50913
50914 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50915         LDKTxInitRbf a_conv;
50916         a_conv.inner = untag_ptr(a);
50917         a_conv.is_owned = ptr_is_owned(a);
50918         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50919         a_conv.is_owned = false;
50920         LDKTxInitRbf b_conv;
50921         b_conv.inner = untag_ptr(b);
50922         b_conv.is_owned = ptr_is_owned(b);
50923         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50924         b_conv.is_owned = false;
50925         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
50926         return ret_conv;
50927 }
50928
50929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50930         LDKTxAckRbf this_obj_conv;
50931         this_obj_conv.inner = untag_ptr(this_obj);
50932         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50934         TxAckRbf_free(this_obj_conv);
50935 }
50936
50937 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50938         LDKTxAckRbf this_ptr_conv;
50939         this_ptr_conv.inner = untag_ptr(this_ptr);
50940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50942         this_ptr_conv.is_owned = false;
50943         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50944         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAckRbf_get_channel_id(&this_ptr_conv));
50945         return ret_arr;
50946 }
50947
50948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50949         LDKTxAckRbf this_ptr_conv;
50950         this_ptr_conv.inner = untag_ptr(this_ptr);
50951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50953         this_ptr_conv.is_owned = false;
50954         LDKThirtyTwoBytes val_ref;
50955         CHECK((*env)->GetArrayLength(env, val) == 32);
50956         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50957         TxAckRbf_set_channel_id(&this_ptr_conv, val_ref);
50958 }
50959
50960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1get_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr) {
50961         LDKTxAckRbf this_ptr_conv;
50962         this_ptr_conv.inner = untag_ptr(this_ptr);
50963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50965         this_ptr_conv.is_owned = false;
50966         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
50967         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
50968         int64_t ret_ref = tag_ptr(ret_copy, true);
50969         return ret_ref;
50970 }
50971
50972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1set_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50973         LDKTxAckRbf this_ptr_conv;
50974         this_ptr_conv.inner = untag_ptr(this_ptr);
50975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50977         this_ptr_conv.is_owned = false;
50978         void* val_ptr = untag_ptr(val);
50979         CHECK_ACCESS(val_ptr);
50980         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
50981         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
50982         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
50983 }
50984
50985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t funding_output_contribution_arg) {
50986         LDKThirtyTwoBytes channel_id_arg_ref;
50987         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
50988         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
50989         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
50990         CHECK_ACCESS(funding_output_contribution_arg_ptr);
50991         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
50992         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
50993         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_ref, funding_output_contribution_arg_conv);
50994         int64_t ret_ref = 0;
50995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50997         return ret_ref;
50998 }
50999
51000 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
51001         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
51002         int64_t ret_ref = 0;
51003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51005         return ret_ref;
51006 }
51007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51008         LDKTxAckRbf arg_conv;
51009         arg_conv.inner = untag_ptr(arg);
51010         arg_conv.is_owned = ptr_is_owned(arg);
51011         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51012         arg_conv.is_owned = false;
51013         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
51014         return ret_conv;
51015 }
51016
51017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51018         LDKTxAckRbf orig_conv;
51019         orig_conv.inner = untag_ptr(orig);
51020         orig_conv.is_owned = ptr_is_owned(orig);
51021         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51022         orig_conv.is_owned = false;
51023         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
51024         int64_t ret_ref = 0;
51025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51027         return ret_ref;
51028 }
51029
51030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1hash(JNIEnv *env, jclass clz, int64_t o) {
51031         LDKTxAckRbf o_conv;
51032         o_conv.inner = untag_ptr(o);
51033         o_conv.is_owned = ptr_is_owned(o);
51034         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51035         o_conv.is_owned = false;
51036         int64_t ret_conv = TxAckRbf_hash(&o_conv);
51037         return ret_conv;
51038 }
51039
51040 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51041         LDKTxAckRbf a_conv;
51042         a_conv.inner = untag_ptr(a);
51043         a_conv.is_owned = ptr_is_owned(a);
51044         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51045         a_conv.is_owned = false;
51046         LDKTxAckRbf b_conv;
51047         b_conv.inner = untag_ptr(b);
51048         b_conv.is_owned = ptr_is_owned(b);
51049         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51050         b_conv.is_owned = false;
51051         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
51052         return ret_conv;
51053 }
51054
51055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51056         LDKTxAbort this_obj_conv;
51057         this_obj_conv.inner = untag_ptr(this_obj);
51058         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51060         TxAbort_free(this_obj_conv);
51061 }
51062
51063 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
51064         LDKTxAbort this_ptr_conv;
51065         this_ptr_conv.inner = untag_ptr(this_ptr);
51066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51068         this_ptr_conv.is_owned = false;
51069         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
51070         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAbort_get_channel_id(&this_ptr_conv));
51071         return ret_arr;
51072 }
51073
51074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51075         LDKTxAbort this_ptr_conv;
51076         this_ptr_conv.inner = untag_ptr(this_ptr);
51077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51079         this_ptr_conv.is_owned = false;
51080         LDKThirtyTwoBytes val_ref;
51081         CHECK((*env)->GetArrayLength(env, val) == 32);
51082         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
51083         TxAbort_set_channel_id(&this_ptr_conv, val_ref);
51084 }
51085
51086 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
51087         LDKTxAbort this_ptr_conv;
51088         this_ptr_conv.inner = untag_ptr(this_ptr);
51089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51091         this_ptr_conv.is_owned = false;
51092         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
51093         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51094         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51095         CVec_u8Z_free(ret_var);
51096         return ret_arr;
51097 }
51098
51099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51100         LDKTxAbort this_ptr_conv;
51101         this_ptr_conv.inner = untag_ptr(this_ptr);
51102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51104         this_ptr_conv.is_owned = false;
51105         LDKCVec_u8Z val_ref;
51106         val_ref.datalen = (*env)->GetArrayLength(env, val);
51107         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
51108         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
51109         TxAbort_set_data(&this_ptr_conv, val_ref);
51110 }
51111
51112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray data_arg) {
51113         LDKThirtyTwoBytes channel_id_arg_ref;
51114         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
51115         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
51116         LDKCVec_u8Z data_arg_ref;
51117         data_arg_ref.datalen = (*env)->GetArrayLength(env, data_arg);
51118         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
51119         (*env)->GetByteArrayRegion(env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
51120         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_ref, data_arg_ref);
51121         int64_t ret_ref = 0;
51122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51124         return ret_ref;
51125 }
51126
51127 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
51128         LDKTxAbort ret_var = TxAbort_clone(arg);
51129         int64_t ret_ref = 0;
51130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51132         return ret_ref;
51133 }
51134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51135         LDKTxAbort arg_conv;
51136         arg_conv.inner = untag_ptr(arg);
51137         arg_conv.is_owned = ptr_is_owned(arg);
51138         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51139         arg_conv.is_owned = false;
51140         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
51141         return ret_conv;
51142 }
51143
51144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51145         LDKTxAbort orig_conv;
51146         orig_conv.inner = untag_ptr(orig);
51147         orig_conv.is_owned = ptr_is_owned(orig);
51148         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51149         orig_conv.is_owned = false;
51150         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
51151         int64_t ret_ref = 0;
51152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51154         return ret_ref;
51155 }
51156
51157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1hash(JNIEnv *env, jclass clz, int64_t o) {
51158         LDKTxAbort o_conv;
51159         o_conv.inner = untag_ptr(o);
51160         o_conv.is_owned = ptr_is_owned(o);
51161         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51162         o_conv.is_owned = false;
51163         int64_t ret_conv = TxAbort_hash(&o_conv);
51164         return ret_conv;
51165 }
51166
51167 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAbort_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51168         LDKTxAbort a_conv;
51169         a_conv.inner = untag_ptr(a);
51170         a_conv.is_owned = ptr_is_owned(a);
51171         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51172         a_conv.is_owned = false;
51173         LDKTxAbort b_conv;
51174         b_conv.inner = untag_ptr(b);
51175         b_conv.is_owned = ptr_is_owned(b);
51176         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51177         b_conv.is_owned = false;
51178         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
51179         return ret_conv;
51180 }
51181
51182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51183         LDKShutdown this_obj_conv;
51184         this_obj_conv.inner = untag_ptr(this_obj);
51185         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51187         Shutdown_free(this_obj_conv);
51188 }
51189
51190 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
51191         LDKShutdown this_ptr_conv;
51192         this_ptr_conv.inner = untag_ptr(this_ptr);
51193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51195         this_ptr_conv.is_owned = false;
51196         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
51197         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
51198         return ret_arr;
51199 }
51200
51201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51202         LDKShutdown this_ptr_conv;
51203         this_ptr_conv.inner = untag_ptr(this_ptr);
51204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51206         this_ptr_conv.is_owned = false;
51207         LDKThirtyTwoBytes val_ref;
51208         CHECK((*env)->GetArrayLength(env, val) == 32);
51209         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
51210         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
51211 }
51212
51213 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
51214         LDKShutdown this_ptr_conv;
51215         this_ptr_conv.inner = untag_ptr(this_ptr);
51216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51218         this_ptr_conv.is_owned = false;
51219         LDKCVec_u8Z ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
51220         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51221         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51222         CVec_u8Z_free(ret_var);
51223         return ret_arr;
51224 }
51225
51226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51227         LDKShutdown this_ptr_conv;
51228         this_ptr_conv.inner = untag_ptr(this_ptr);
51229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51231         this_ptr_conv.is_owned = false;
51232         LDKCVec_u8Z val_ref;
51233         val_ref.datalen = (*env)->GetArrayLength(env, val);
51234         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
51235         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
51236         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
51237 }
51238
51239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
51240         LDKThirtyTwoBytes channel_id_arg_ref;
51241         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
51242         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
51243         LDKCVec_u8Z scriptpubkey_arg_ref;
51244         scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
51245         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
51246         (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
51247         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
51248         int64_t ret_ref = 0;
51249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51251         return ret_ref;
51252 }
51253
51254 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
51255         LDKShutdown ret_var = Shutdown_clone(arg);
51256         int64_t ret_ref = 0;
51257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51259         return ret_ref;
51260 }
51261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51262         LDKShutdown arg_conv;
51263         arg_conv.inner = untag_ptr(arg);
51264         arg_conv.is_owned = ptr_is_owned(arg);
51265         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51266         arg_conv.is_owned = false;
51267         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
51268         return ret_conv;
51269 }
51270
51271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51272         LDKShutdown orig_conv;
51273         orig_conv.inner = untag_ptr(orig);
51274         orig_conv.is_owned = ptr_is_owned(orig);
51275         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51276         orig_conv.is_owned = false;
51277         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
51278         int64_t ret_ref = 0;
51279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51281         return ret_ref;
51282 }
51283
51284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1hash(JNIEnv *env, jclass clz, int64_t o) {
51285         LDKShutdown o_conv;
51286         o_conv.inner = untag_ptr(o);
51287         o_conv.is_owned = ptr_is_owned(o);
51288         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51289         o_conv.is_owned = false;
51290         int64_t ret_conv = Shutdown_hash(&o_conv);
51291         return ret_conv;
51292 }
51293
51294 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Shutdown_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51295         LDKShutdown a_conv;
51296         a_conv.inner = untag_ptr(a);
51297         a_conv.is_owned = ptr_is_owned(a);
51298         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51299         a_conv.is_owned = false;
51300         LDKShutdown b_conv;
51301         b_conv.inner = untag_ptr(b);
51302         b_conv.is_owned = ptr_is_owned(b);
51303         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51304         b_conv.is_owned = false;
51305         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
51306         return ret_conv;
51307 }
51308
51309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51310         LDKClosingSignedFeeRange this_obj_conv;
51311         this_obj_conv.inner = untag_ptr(this_obj);
51312         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51314         ClosingSignedFeeRange_free(this_obj_conv);
51315 }
51316
51317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
51318         LDKClosingSignedFeeRange this_ptr_conv;
51319         this_ptr_conv.inner = untag_ptr(this_ptr);
51320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51322         this_ptr_conv.is_owned = false;
51323         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
51324         return ret_conv;
51325 }
51326
51327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51328         LDKClosingSignedFeeRange this_ptr_conv;
51329         this_ptr_conv.inner = untag_ptr(this_ptr);
51330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51332         this_ptr_conv.is_owned = false;
51333         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
51334 }
51335
51336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
51337         LDKClosingSignedFeeRange this_ptr_conv;
51338         this_ptr_conv.inner = untag_ptr(this_ptr);
51339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51341         this_ptr_conv.is_owned = false;
51342         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
51343         return ret_conv;
51344 }
51345
51346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51347         LDKClosingSignedFeeRange this_ptr_conv;
51348         this_ptr_conv.inner = untag_ptr(this_ptr);
51349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51351         this_ptr_conv.is_owned = false;
51352         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
51353 }
51354
51355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1new(JNIEnv *env, jclass clz, int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
51356         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
51357         int64_t ret_ref = 0;
51358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51360         return ret_ref;
51361 }
51362
51363 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
51364         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
51365         int64_t ret_ref = 0;
51366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51368         return ret_ref;
51369 }
51370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51371         LDKClosingSignedFeeRange arg_conv;
51372         arg_conv.inner = untag_ptr(arg);
51373         arg_conv.is_owned = ptr_is_owned(arg);
51374         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51375         arg_conv.is_owned = false;
51376         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
51377         return ret_conv;
51378 }
51379
51380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51381         LDKClosingSignedFeeRange orig_conv;
51382         orig_conv.inner = untag_ptr(orig);
51383         orig_conv.is_owned = ptr_is_owned(orig);
51384         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51385         orig_conv.is_owned = false;
51386         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
51387         int64_t ret_ref = 0;
51388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51390         return ret_ref;
51391 }
51392
51393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1hash(JNIEnv *env, jclass clz, int64_t o) {
51394         LDKClosingSignedFeeRange o_conv;
51395         o_conv.inner = untag_ptr(o);
51396         o_conv.is_owned = ptr_is_owned(o);
51397         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51398         o_conv.is_owned = false;
51399         int64_t ret_conv = ClosingSignedFeeRange_hash(&o_conv);
51400         return ret_conv;
51401 }
51402
51403 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51404         LDKClosingSignedFeeRange a_conv;
51405         a_conv.inner = untag_ptr(a);
51406         a_conv.is_owned = ptr_is_owned(a);
51407         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51408         a_conv.is_owned = false;
51409         LDKClosingSignedFeeRange b_conv;
51410         b_conv.inner = untag_ptr(b);
51411         b_conv.is_owned = ptr_is_owned(b);
51412         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51413         b_conv.is_owned = false;
51414         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
51415         return ret_conv;
51416 }
51417
51418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51419         LDKClosingSigned this_obj_conv;
51420         this_obj_conv.inner = untag_ptr(this_obj);
51421         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51423         ClosingSigned_free(this_obj_conv);
51424 }
51425
51426 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
51427         LDKClosingSigned this_ptr_conv;
51428         this_ptr_conv.inner = untag_ptr(this_ptr);
51429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51431         this_ptr_conv.is_owned = false;
51432         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
51433         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
51434         return ret_arr;
51435 }
51436
51437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51438         LDKClosingSigned this_ptr_conv;
51439         this_ptr_conv.inner = untag_ptr(this_ptr);
51440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51442         this_ptr_conv.is_owned = false;
51443         LDKThirtyTwoBytes val_ref;
51444         CHECK((*env)->GetArrayLength(env, val) == 32);
51445         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
51446         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
51447 }
51448
51449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
51450         LDKClosingSigned this_ptr_conv;
51451         this_ptr_conv.inner = untag_ptr(this_ptr);
51452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51454         this_ptr_conv.is_owned = false;
51455         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
51456         return ret_conv;
51457 }
51458
51459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51460         LDKClosingSigned this_ptr_conv;
51461         this_ptr_conv.inner = untag_ptr(this_ptr);
51462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51464         this_ptr_conv.is_owned = false;
51465         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
51466 }
51467
51468 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
51469         LDKClosingSigned this_ptr_conv;
51470         this_ptr_conv.inner = untag_ptr(this_ptr);
51471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51473         this_ptr_conv.is_owned = false;
51474         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
51475         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
51476         return ret_arr;
51477 }
51478
51479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51480         LDKClosingSigned this_ptr_conv;
51481         this_ptr_conv.inner = untag_ptr(this_ptr);
51482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51484         this_ptr_conv.is_owned = false;
51485         LDKECDSASignature val_ref;
51486         CHECK((*env)->GetArrayLength(env, val) == 64);
51487         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
51488         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
51489 }
51490
51491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
51492         LDKClosingSigned this_ptr_conv;
51493         this_ptr_conv.inner = untag_ptr(this_ptr);
51494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51496         this_ptr_conv.is_owned = false;
51497         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
51498         int64_t ret_ref = 0;
51499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51501         return ret_ref;
51502 }
51503
51504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51505         LDKClosingSigned this_ptr_conv;
51506         this_ptr_conv.inner = untag_ptr(this_ptr);
51507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51509         this_ptr_conv.is_owned = false;
51510         LDKClosingSignedFeeRange val_conv;
51511         val_conv.inner = untag_ptr(val);
51512         val_conv.is_owned = ptr_is_owned(val);
51513         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51514         val_conv = ClosingSignedFeeRange_clone(&val_conv);
51515         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
51516 }
51517
51518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, int64_t fee_range_arg) {
51519         LDKThirtyTwoBytes channel_id_arg_ref;
51520         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
51521         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
51522         LDKECDSASignature signature_arg_ref;
51523         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
51524         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
51525         LDKClosingSignedFeeRange fee_range_arg_conv;
51526         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
51527         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
51528         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
51529         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
51530         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
51531         int64_t ret_ref = 0;
51532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51534         return ret_ref;
51535 }
51536
51537 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
51538         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
51539         int64_t ret_ref = 0;
51540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51542         return ret_ref;
51543 }
51544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51545         LDKClosingSigned arg_conv;
51546         arg_conv.inner = untag_ptr(arg);
51547         arg_conv.is_owned = ptr_is_owned(arg);
51548         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51549         arg_conv.is_owned = false;
51550         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
51551         return ret_conv;
51552 }
51553
51554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51555         LDKClosingSigned orig_conv;
51556         orig_conv.inner = untag_ptr(orig);
51557         orig_conv.is_owned = ptr_is_owned(orig);
51558         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51559         orig_conv.is_owned = false;
51560         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
51561         int64_t ret_ref = 0;
51562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51564         return ret_ref;
51565 }
51566
51567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1hash(JNIEnv *env, jclass clz, int64_t o) {
51568         LDKClosingSigned o_conv;
51569         o_conv.inner = untag_ptr(o);
51570         o_conv.is_owned = ptr_is_owned(o);
51571         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51572         o_conv.is_owned = false;
51573         int64_t ret_conv = ClosingSigned_hash(&o_conv);
51574         return ret_conv;
51575 }
51576
51577 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51578         LDKClosingSigned a_conv;
51579         a_conv.inner = untag_ptr(a);
51580         a_conv.is_owned = ptr_is_owned(a);
51581         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51582         a_conv.is_owned = false;
51583         LDKClosingSigned b_conv;
51584         b_conv.inner = untag_ptr(b);
51585         b_conv.is_owned = ptr_is_owned(b);
51586         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51587         b_conv.is_owned = false;
51588         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
51589         return ret_conv;
51590 }
51591
51592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51593         LDKUpdateAddHTLC this_obj_conv;
51594         this_obj_conv.inner = untag_ptr(this_obj);
51595         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51597         UpdateAddHTLC_free(this_obj_conv);
51598 }
51599
51600 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
51601         LDKUpdateAddHTLC this_ptr_conv;
51602         this_ptr_conv.inner = untag_ptr(this_ptr);
51603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51605         this_ptr_conv.is_owned = false;
51606         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
51607         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
51608         return ret_arr;
51609 }
51610
51611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51612         LDKUpdateAddHTLC this_ptr_conv;
51613         this_ptr_conv.inner = untag_ptr(this_ptr);
51614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51616         this_ptr_conv.is_owned = false;
51617         LDKThirtyTwoBytes val_ref;
51618         CHECK((*env)->GetArrayLength(env, val) == 32);
51619         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
51620         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
51621 }
51622
51623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
51624         LDKUpdateAddHTLC this_ptr_conv;
51625         this_ptr_conv.inner = untag_ptr(this_ptr);
51626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51628         this_ptr_conv.is_owned = false;
51629         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
51630         return ret_conv;
51631 }
51632
51633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51634         LDKUpdateAddHTLC this_ptr_conv;
51635         this_ptr_conv.inner = untag_ptr(this_ptr);
51636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51638         this_ptr_conv.is_owned = false;
51639         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
51640 }
51641
51642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51643         LDKUpdateAddHTLC this_ptr_conv;
51644         this_ptr_conv.inner = untag_ptr(this_ptr);
51645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51647         this_ptr_conv.is_owned = false;
51648         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
51649         return ret_conv;
51650 }
51651
51652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51653         LDKUpdateAddHTLC this_ptr_conv;
51654         this_ptr_conv.inner = untag_ptr(this_ptr);
51655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51657         this_ptr_conv.is_owned = false;
51658         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
51659 }
51660
51661 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
51662         LDKUpdateAddHTLC this_ptr_conv;
51663         this_ptr_conv.inner = untag_ptr(this_ptr);
51664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51666         this_ptr_conv.is_owned = false;
51667         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
51668         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
51669         return ret_arr;
51670 }
51671
51672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51673         LDKUpdateAddHTLC this_ptr_conv;
51674         this_ptr_conv.inner = untag_ptr(this_ptr);
51675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51677         this_ptr_conv.is_owned = false;
51678         LDKThirtyTwoBytes val_ref;
51679         CHECK((*env)->GetArrayLength(env, val) == 32);
51680         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
51681         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
51682 }
51683
51684 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
51685         LDKUpdateAddHTLC this_ptr_conv;
51686         this_ptr_conv.inner = untag_ptr(this_ptr);
51687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51689         this_ptr_conv.is_owned = false;
51690         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
51691         return ret_conv;
51692 }
51693
51694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
51695         LDKUpdateAddHTLC this_ptr_conv;
51696         this_ptr_conv.inner = untag_ptr(this_ptr);
51697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51699         this_ptr_conv.is_owned = false;
51700         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
51701 }
51702
51703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51704         LDKUpdateAddHTLC this_ptr_conv;
51705         this_ptr_conv.inner = untag_ptr(this_ptr);
51706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51708         this_ptr_conv.is_owned = false;
51709         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
51710         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
51711         int64_t ret_ref = tag_ptr(ret_copy, true);
51712         return ret_ref;
51713 }
51714
51715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51716         LDKUpdateAddHTLC this_ptr_conv;
51717         this_ptr_conv.inner = untag_ptr(this_ptr);
51718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51720         this_ptr_conv.is_owned = false;
51721         void* val_ptr = untag_ptr(val);
51722         CHECK_ACCESS(val_ptr);
51723         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
51724         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
51725         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
51726 }
51727
51728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr) {
51729         LDKUpdateAddHTLC this_ptr_conv;
51730         this_ptr_conv.inner = untag_ptr(this_ptr);
51731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51733         this_ptr_conv.is_owned = false;
51734         LDKOnionPacket ret_var = UpdateAddHTLC_get_onion_routing_packet(&this_ptr_conv);
51735         int64_t ret_ref = 0;
51736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51738         return ret_ref;
51739 }
51740
51741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51742         LDKUpdateAddHTLC this_ptr_conv;
51743         this_ptr_conv.inner = untag_ptr(this_ptr);
51744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51746         this_ptr_conv.is_owned = false;
51747         LDKOnionPacket val_conv;
51748         val_conv.inner = untag_ptr(val);
51749         val_conv.is_owned = ptr_is_owned(val);
51750         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51751         val_conv = OnionPacket_clone(&val_conv);
51752         UpdateAddHTLC_set_onion_routing_packet(&this_ptr_conv, val_conv);
51753 }
51754
51755 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
51756         LDKUpdateAddHTLC this_ptr_conv;
51757         this_ptr_conv.inner = untag_ptr(this_ptr);
51758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51760         this_ptr_conv.is_owned = false;
51761         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
51762         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UpdateAddHTLC_get_blinding_point(&this_ptr_conv).compressed_form);
51763         return ret_arr;
51764 }
51765
51766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51767         LDKUpdateAddHTLC this_ptr_conv;
51768         this_ptr_conv.inner = untag_ptr(this_ptr);
51769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51771         this_ptr_conv.is_owned = false;
51772         LDKPublicKey val_ref;
51773         CHECK((*env)->GetArrayLength(env, val) == 33);
51774         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
51775         UpdateAddHTLC_set_blinding_point(&this_ptr_conv, val_ref);
51776 }
51777
51778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t htlc_id_arg, int64_t amount_msat_arg, int8_tArray payment_hash_arg, int32_t cltv_expiry_arg, int64_t skimmed_fee_msat_arg, int64_t onion_routing_packet_arg, int8_tArray blinding_point_arg) {
51779         LDKThirtyTwoBytes channel_id_arg_ref;
51780         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
51781         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
51782         LDKThirtyTwoBytes payment_hash_arg_ref;
51783         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
51784         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
51785         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
51786         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
51787         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
51788         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
51789         LDKOnionPacket onion_routing_packet_arg_conv;
51790         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
51791         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
51792         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
51793         onion_routing_packet_arg_conv = OnionPacket_clone(&onion_routing_packet_arg_conv);
51794         LDKPublicKey blinding_point_arg_ref;
51795         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
51796         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
51797         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_new(channel_id_arg_ref, htlc_id_arg, amount_msat_arg, payment_hash_arg_ref, cltv_expiry_arg, skimmed_fee_msat_arg_conv, onion_routing_packet_arg_conv, blinding_point_arg_ref);
51798         int64_t ret_ref = 0;
51799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51801         return ret_ref;
51802 }
51803
51804 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
51805         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
51806         int64_t ret_ref = 0;
51807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51809         return ret_ref;
51810 }
51811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51812         LDKUpdateAddHTLC arg_conv;
51813         arg_conv.inner = untag_ptr(arg);
51814         arg_conv.is_owned = ptr_is_owned(arg);
51815         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51816         arg_conv.is_owned = false;
51817         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
51818         return ret_conv;
51819 }
51820
51821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51822         LDKUpdateAddHTLC orig_conv;
51823         orig_conv.inner = untag_ptr(orig);
51824         orig_conv.is_owned = ptr_is_owned(orig);
51825         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51826         orig_conv.is_owned = false;
51827         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
51828         int64_t ret_ref = 0;
51829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51831         return ret_ref;
51832 }
51833
51834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1hash(JNIEnv *env, jclass clz, int64_t o) {
51835         LDKUpdateAddHTLC o_conv;
51836         o_conv.inner = untag_ptr(o);
51837         o_conv.is_owned = ptr_is_owned(o);
51838         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51839         o_conv.is_owned = false;
51840         int64_t ret_conv = UpdateAddHTLC_hash(&o_conv);
51841         return ret_conv;
51842 }
51843
51844 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51845         LDKUpdateAddHTLC a_conv;
51846         a_conv.inner = untag_ptr(a);
51847         a_conv.is_owned = ptr_is_owned(a);
51848         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51849         a_conv.is_owned = false;
51850         LDKUpdateAddHTLC b_conv;
51851         b_conv.inner = untag_ptr(b);
51852         b_conv.is_owned = ptr_is_owned(b);
51853         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51854         b_conv.is_owned = false;
51855         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
51856         return ret_conv;
51857 }
51858
51859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51860         LDKOnionMessage this_obj_conv;
51861         this_obj_conv.inner = untag_ptr(this_obj);
51862         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51864         OnionMessage_free(this_obj_conv);
51865 }
51866
51867 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
51868         LDKOnionMessage this_ptr_conv;
51869         this_ptr_conv.inner = untag_ptr(this_ptr);
51870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51872         this_ptr_conv.is_owned = false;
51873         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
51874         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form);
51875         return ret_arr;
51876 }
51877
51878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51879         LDKOnionMessage this_ptr_conv;
51880         this_ptr_conv.inner = untag_ptr(this_ptr);
51881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51883         this_ptr_conv.is_owned = false;
51884         LDKPublicKey val_ref;
51885         CHECK((*env)->GetArrayLength(env, val) == 33);
51886         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
51887         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
51888 }
51889
51890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1get_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr) {
51891         LDKOnionMessage this_ptr_conv;
51892         this_ptr_conv.inner = untag_ptr(this_ptr);
51893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51895         this_ptr_conv.is_owned = false;
51896         LDKPacket ret_var = OnionMessage_get_onion_routing_packet(&this_ptr_conv);
51897         int64_t ret_ref = 0;
51898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51900         return ret_ref;
51901 }
51902
51903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1set_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51904         LDKOnionMessage this_ptr_conv;
51905         this_ptr_conv.inner = untag_ptr(this_ptr);
51906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51908         this_ptr_conv.is_owned = false;
51909         LDKPacket val_conv;
51910         val_conv.inner = untag_ptr(val);
51911         val_conv.is_owned = ptr_is_owned(val);
51912         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51913         val_conv = Packet_clone(&val_conv);
51914         OnionMessage_set_onion_routing_packet(&this_ptr_conv, val_conv);
51915 }
51916
51917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1new(JNIEnv *env, jclass clz, int8_tArray blinding_point_arg, int64_t onion_routing_packet_arg) {
51918         LDKPublicKey blinding_point_arg_ref;
51919         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
51920         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
51921         LDKPacket onion_routing_packet_arg_conv;
51922         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
51923         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
51924         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
51925         onion_routing_packet_arg_conv = Packet_clone(&onion_routing_packet_arg_conv);
51926         LDKOnionMessage ret_var = OnionMessage_new(blinding_point_arg_ref, onion_routing_packet_arg_conv);
51927         int64_t ret_ref = 0;
51928         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51929         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51930         return ret_ref;
51931 }
51932
51933 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
51934         LDKOnionMessage ret_var = OnionMessage_clone(arg);
51935         int64_t ret_ref = 0;
51936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51938         return ret_ref;
51939 }
51940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51941         LDKOnionMessage arg_conv;
51942         arg_conv.inner = untag_ptr(arg);
51943         arg_conv.is_owned = ptr_is_owned(arg);
51944         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51945         arg_conv.is_owned = false;
51946         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
51947         return ret_conv;
51948 }
51949
51950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51951         LDKOnionMessage orig_conv;
51952         orig_conv.inner = untag_ptr(orig);
51953         orig_conv.is_owned = ptr_is_owned(orig);
51954         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51955         orig_conv.is_owned = false;
51956         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
51957         int64_t ret_ref = 0;
51958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51960         return ret_ref;
51961 }
51962
51963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1hash(JNIEnv *env, jclass clz, int64_t o) {
51964         LDKOnionMessage o_conv;
51965         o_conv.inner = untag_ptr(o);
51966         o_conv.is_owned = ptr_is_owned(o);
51967         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51968         o_conv.is_owned = false;
51969         int64_t ret_conv = OnionMessage_hash(&o_conv);
51970         return ret_conv;
51971 }
51972
51973 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OnionMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51974         LDKOnionMessage a_conv;
51975         a_conv.inner = untag_ptr(a);
51976         a_conv.is_owned = ptr_is_owned(a);
51977         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51978         a_conv.is_owned = false;
51979         LDKOnionMessage b_conv;
51980         b_conv.inner = untag_ptr(b);
51981         b_conv.is_owned = ptr_is_owned(b);
51982         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51983         b_conv.is_owned = false;
51984         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
51985         return ret_conv;
51986 }
51987
51988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51989         LDKUpdateFulfillHTLC this_obj_conv;
51990         this_obj_conv.inner = untag_ptr(this_obj);
51991         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51993         UpdateFulfillHTLC_free(this_obj_conv);
51994 }
51995
51996 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
51997         LDKUpdateFulfillHTLC this_ptr_conv;
51998         this_ptr_conv.inner = untag_ptr(this_ptr);
51999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52001         this_ptr_conv.is_owned = false;
52002         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52003         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
52004         return ret_arr;
52005 }
52006
52007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52008         LDKUpdateFulfillHTLC this_ptr_conv;
52009         this_ptr_conv.inner = untag_ptr(this_ptr);
52010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52012         this_ptr_conv.is_owned = false;
52013         LDKThirtyTwoBytes val_ref;
52014         CHECK((*env)->GetArrayLength(env, val) == 32);
52015         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52016         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
52017 }
52018
52019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52020         LDKUpdateFulfillHTLC this_ptr_conv;
52021         this_ptr_conv.inner = untag_ptr(this_ptr);
52022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52024         this_ptr_conv.is_owned = false;
52025         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
52026         return ret_conv;
52027 }
52028
52029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52030         LDKUpdateFulfillHTLC this_ptr_conv;
52031         this_ptr_conv.inner = untag_ptr(this_ptr);
52032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52034         this_ptr_conv.is_owned = false;
52035         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
52036 }
52037
52038 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
52039         LDKUpdateFulfillHTLC this_ptr_conv;
52040         this_ptr_conv.inner = untag_ptr(this_ptr);
52041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52043         this_ptr_conv.is_owned = false;
52044         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52045         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
52046         return ret_arr;
52047 }
52048
52049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52050         LDKUpdateFulfillHTLC this_ptr_conv;
52051         this_ptr_conv.inner = untag_ptr(this_ptr);
52052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52054         this_ptr_conv.is_owned = false;
52055         LDKThirtyTwoBytes val_ref;
52056         CHECK((*env)->GetArrayLength(env, val) == 32);
52057         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52058         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
52059 }
52060
52061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
52062         LDKThirtyTwoBytes channel_id_arg_ref;
52063         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
52064         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
52065         LDKThirtyTwoBytes payment_preimage_arg_ref;
52066         CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
52067         (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
52068         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
52069         int64_t ret_ref = 0;
52070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52072         return ret_ref;
52073 }
52074
52075 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
52076         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
52077         int64_t ret_ref = 0;
52078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52080         return ret_ref;
52081 }
52082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52083         LDKUpdateFulfillHTLC arg_conv;
52084         arg_conv.inner = untag_ptr(arg);
52085         arg_conv.is_owned = ptr_is_owned(arg);
52086         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52087         arg_conv.is_owned = false;
52088         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
52089         return ret_conv;
52090 }
52091
52092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52093         LDKUpdateFulfillHTLC orig_conv;
52094         orig_conv.inner = untag_ptr(orig);
52095         orig_conv.is_owned = ptr_is_owned(orig);
52096         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52097         orig_conv.is_owned = false;
52098         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
52099         int64_t ret_ref = 0;
52100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52102         return ret_ref;
52103 }
52104
52105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1hash(JNIEnv *env, jclass clz, int64_t o) {
52106         LDKUpdateFulfillHTLC o_conv;
52107         o_conv.inner = untag_ptr(o);
52108         o_conv.is_owned = ptr_is_owned(o);
52109         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52110         o_conv.is_owned = false;
52111         int64_t ret_conv = UpdateFulfillHTLC_hash(&o_conv);
52112         return ret_conv;
52113 }
52114
52115 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52116         LDKUpdateFulfillHTLC a_conv;
52117         a_conv.inner = untag_ptr(a);
52118         a_conv.is_owned = ptr_is_owned(a);
52119         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52120         a_conv.is_owned = false;
52121         LDKUpdateFulfillHTLC b_conv;
52122         b_conv.inner = untag_ptr(b);
52123         b_conv.is_owned = ptr_is_owned(b);
52124         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52125         b_conv.is_owned = false;
52126         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
52127         return ret_conv;
52128 }
52129
52130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52131         LDKUpdateFailHTLC this_obj_conv;
52132         this_obj_conv.inner = untag_ptr(this_obj);
52133         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52135         UpdateFailHTLC_free(this_obj_conv);
52136 }
52137
52138 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52139         LDKUpdateFailHTLC this_ptr_conv;
52140         this_ptr_conv.inner = untag_ptr(this_ptr);
52141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52143         this_ptr_conv.is_owned = false;
52144         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52145         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
52146         return ret_arr;
52147 }
52148
52149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52150         LDKUpdateFailHTLC this_ptr_conv;
52151         this_ptr_conv.inner = untag_ptr(this_ptr);
52152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52154         this_ptr_conv.is_owned = false;
52155         LDKThirtyTwoBytes val_ref;
52156         CHECK((*env)->GetArrayLength(env, val) == 32);
52157         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52158         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
52159 }
52160
52161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52162         LDKUpdateFailHTLC this_ptr_conv;
52163         this_ptr_conv.inner = untag_ptr(this_ptr);
52164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52166         this_ptr_conv.is_owned = false;
52167         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
52168         return ret_conv;
52169 }
52170
52171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52172         LDKUpdateFailHTLC this_ptr_conv;
52173         this_ptr_conv.inner = untag_ptr(this_ptr);
52174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52176         this_ptr_conv.is_owned = false;
52177         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
52178 }
52179
52180 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
52181         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
52182         int64_t ret_ref = 0;
52183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52185         return ret_ref;
52186 }
52187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52188         LDKUpdateFailHTLC arg_conv;
52189         arg_conv.inner = untag_ptr(arg);
52190         arg_conv.is_owned = ptr_is_owned(arg);
52191         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52192         arg_conv.is_owned = false;
52193         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
52194         return ret_conv;
52195 }
52196
52197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52198         LDKUpdateFailHTLC orig_conv;
52199         orig_conv.inner = untag_ptr(orig);
52200         orig_conv.is_owned = ptr_is_owned(orig);
52201         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52202         orig_conv.is_owned = false;
52203         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
52204         int64_t ret_ref = 0;
52205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52207         return ret_ref;
52208 }
52209
52210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1hash(JNIEnv *env, jclass clz, int64_t o) {
52211         LDKUpdateFailHTLC o_conv;
52212         o_conv.inner = untag_ptr(o);
52213         o_conv.is_owned = ptr_is_owned(o);
52214         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52215         o_conv.is_owned = false;
52216         int64_t ret_conv = UpdateFailHTLC_hash(&o_conv);
52217         return ret_conv;
52218 }
52219
52220 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52221         LDKUpdateFailHTLC a_conv;
52222         a_conv.inner = untag_ptr(a);
52223         a_conv.is_owned = ptr_is_owned(a);
52224         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52225         a_conv.is_owned = false;
52226         LDKUpdateFailHTLC b_conv;
52227         b_conv.inner = untag_ptr(b);
52228         b_conv.is_owned = ptr_is_owned(b);
52229         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52230         b_conv.is_owned = false;
52231         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
52232         return ret_conv;
52233 }
52234
52235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52236         LDKUpdateFailMalformedHTLC this_obj_conv;
52237         this_obj_conv.inner = untag_ptr(this_obj);
52238         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52240         UpdateFailMalformedHTLC_free(this_obj_conv);
52241 }
52242
52243 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52244         LDKUpdateFailMalformedHTLC this_ptr_conv;
52245         this_ptr_conv.inner = untag_ptr(this_ptr);
52246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52248         this_ptr_conv.is_owned = false;
52249         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52250         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
52251         return ret_arr;
52252 }
52253
52254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52255         LDKUpdateFailMalformedHTLC this_ptr_conv;
52256         this_ptr_conv.inner = untag_ptr(this_ptr);
52257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52259         this_ptr_conv.is_owned = false;
52260         LDKThirtyTwoBytes val_ref;
52261         CHECK((*env)->GetArrayLength(env, val) == 32);
52262         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52263         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
52264 }
52265
52266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52267         LDKUpdateFailMalformedHTLC this_ptr_conv;
52268         this_ptr_conv.inner = untag_ptr(this_ptr);
52269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52271         this_ptr_conv.is_owned = false;
52272         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
52273         return ret_conv;
52274 }
52275
52276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52277         LDKUpdateFailMalformedHTLC this_ptr_conv;
52278         this_ptr_conv.inner = untag_ptr(this_ptr);
52279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52281         this_ptr_conv.is_owned = false;
52282         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
52283 }
52284
52285 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
52286         LDKUpdateFailMalformedHTLC this_ptr_conv;
52287         this_ptr_conv.inner = untag_ptr(this_ptr);
52288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52290         this_ptr_conv.is_owned = false;
52291         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
52292         return ret_conv;
52293 }
52294
52295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
52296         LDKUpdateFailMalformedHTLC this_ptr_conv;
52297         this_ptr_conv.inner = untag_ptr(this_ptr);
52298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52300         this_ptr_conv.is_owned = false;
52301         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
52302 }
52303
52304 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
52305         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
52306         int64_t ret_ref = 0;
52307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52309         return ret_ref;
52310 }
52311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52312         LDKUpdateFailMalformedHTLC arg_conv;
52313         arg_conv.inner = untag_ptr(arg);
52314         arg_conv.is_owned = ptr_is_owned(arg);
52315         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52316         arg_conv.is_owned = false;
52317         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
52318         return ret_conv;
52319 }
52320
52321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52322         LDKUpdateFailMalformedHTLC orig_conv;
52323         orig_conv.inner = untag_ptr(orig);
52324         orig_conv.is_owned = ptr_is_owned(orig);
52325         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52326         orig_conv.is_owned = false;
52327         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
52328         int64_t ret_ref = 0;
52329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52331         return ret_ref;
52332 }
52333
52334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1hash(JNIEnv *env, jclass clz, int64_t o) {
52335         LDKUpdateFailMalformedHTLC o_conv;
52336         o_conv.inner = untag_ptr(o);
52337         o_conv.is_owned = ptr_is_owned(o);
52338         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52339         o_conv.is_owned = false;
52340         int64_t ret_conv = UpdateFailMalformedHTLC_hash(&o_conv);
52341         return ret_conv;
52342 }
52343
52344 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52345         LDKUpdateFailMalformedHTLC a_conv;
52346         a_conv.inner = untag_ptr(a);
52347         a_conv.is_owned = ptr_is_owned(a);
52348         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52349         a_conv.is_owned = false;
52350         LDKUpdateFailMalformedHTLC b_conv;
52351         b_conv.inner = untag_ptr(b);
52352         b_conv.is_owned = ptr_is_owned(b);
52353         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52354         b_conv.is_owned = false;
52355         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
52356         return ret_conv;
52357 }
52358
52359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52360         LDKCommitmentSigned this_obj_conv;
52361         this_obj_conv.inner = untag_ptr(this_obj);
52362         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52364         CommitmentSigned_free(this_obj_conv);
52365 }
52366
52367 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52368         LDKCommitmentSigned this_ptr_conv;
52369         this_ptr_conv.inner = untag_ptr(this_ptr);
52370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52372         this_ptr_conv.is_owned = false;
52373         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52374         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
52375         return ret_arr;
52376 }
52377
52378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52379         LDKCommitmentSigned this_ptr_conv;
52380         this_ptr_conv.inner = untag_ptr(this_ptr);
52381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52383         this_ptr_conv.is_owned = false;
52384         LDKThirtyTwoBytes val_ref;
52385         CHECK((*env)->GetArrayLength(env, val) == 32);
52386         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52387         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
52388 }
52389
52390 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
52391         LDKCommitmentSigned this_ptr_conv;
52392         this_ptr_conv.inner = untag_ptr(this_ptr);
52393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52395         this_ptr_conv.is_owned = false;
52396         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
52397         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
52398         return ret_arr;
52399 }
52400
52401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52402         LDKCommitmentSigned this_ptr_conv;
52403         this_ptr_conv.inner = untag_ptr(this_ptr);
52404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52406         this_ptr_conv.is_owned = false;
52407         LDKECDSASignature val_ref;
52408         CHECK((*env)->GetArrayLength(env, val) == 64);
52409         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
52410         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
52411 }
52412
52413 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr) {
52414         LDKCommitmentSigned this_ptr_conv;
52415         this_ptr_conv.inner = untag_ptr(this_ptr);
52416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52418         this_ptr_conv.is_owned = false;
52419         LDKCVec_ECDSASignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
52420         jobjectArray ret_arr = NULL;
52421         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
52422         ;
52423         for (size_t i = 0; i < ret_var.datalen; i++) {
52424                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
52425                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
52426                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
52427         }
52428         
52429         FREE(ret_var.data);
52430         return ret_arr;
52431 }
52432
52433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
52434         LDKCommitmentSigned this_ptr_conv;
52435         this_ptr_conv.inner = untag_ptr(this_ptr);
52436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52438         this_ptr_conv.is_owned = false;
52439         LDKCVec_ECDSASignatureZ val_constr;
52440         val_constr.datalen = (*env)->GetArrayLength(env, val);
52441         if (val_constr.datalen > 0)
52442                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
52443         else
52444                 val_constr.data = NULL;
52445         for (size_t i = 0; i < val_constr.datalen; i++) {
52446                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
52447                 LDKECDSASignature val_conv_8_ref;
52448                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
52449                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
52450                 val_constr.data[i] = val_conv_8_ref;
52451         }
52452         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
52453 }
52454
52455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg, jobjectArray htlc_signatures_arg) {
52456         LDKThirtyTwoBytes channel_id_arg_ref;
52457         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
52458         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
52459         LDKECDSASignature signature_arg_ref;
52460         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
52461         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
52462         LDKCVec_ECDSASignatureZ htlc_signatures_arg_constr;
52463         htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
52464         if (htlc_signatures_arg_constr.datalen > 0)
52465                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
52466         else
52467                 htlc_signatures_arg_constr.data = NULL;
52468         for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
52469                 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
52470                 LDKECDSASignature htlc_signatures_arg_conv_8_ref;
52471                 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
52472                 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
52473                 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
52474         }
52475         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
52476         int64_t ret_ref = 0;
52477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52479         return ret_ref;
52480 }
52481
52482 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
52483         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
52484         int64_t ret_ref = 0;
52485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52487         return ret_ref;
52488 }
52489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52490         LDKCommitmentSigned arg_conv;
52491         arg_conv.inner = untag_ptr(arg);
52492         arg_conv.is_owned = ptr_is_owned(arg);
52493         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52494         arg_conv.is_owned = false;
52495         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
52496         return ret_conv;
52497 }
52498
52499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52500         LDKCommitmentSigned orig_conv;
52501         orig_conv.inner = untag_ptr(orig);
52502         orig_conv.is_owned = ptr_is_owned(orig);
52503         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52504         orig_conv.is_owned = false;
52505         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
52506         int64_t ret_ref = 0;
52507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52509         return ret_ref;
52510 }
52511
52512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1hash(JNIEnv *env, jclass clz, int64_t o) {
52513         LDKCommitmentSigned o_conv;
52514         o_conv.inner = untag_ptr(o);
52515         o_conv.is_owned = ptr_is_owned(o);
52516         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52517         o_conv.is_owned = false;
52518         int64_t ret_conv = CommitmentSigned_hash(&o_conv);
52519         return ret_conv;
52520 }
52521
52522 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52523         LDKCommitmentSigned a_conv;
52524         a_conv.inner = untag_ptr(a);
52525         a_conv.is_owned = ptr_is_owned(a);
52526         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52527         a_conv.is_owned = false;
52528         LDKCommitmentSigned b_conv;
52529         b_conv.inner = untag_ptr(b);
52530         b_conv.is_owned = ptr_is_owned(b);
52531         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52532         b_conv.is_owned = false;
52533         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
52534         return ret_conv;
52535 }
52536
52537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52538         LDKRevokeAndACK this_obj_conv;
52539         this_obj_conv.inner = untag_ptr(this_obj);
52540         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52542         RevokeAndACK_free(this_obj_conv);
52543 }
52544
52545 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52546         LDKRevokeAndACK this_ptr_conv;
52547         this_ptr_conv.inner = untag_ptr(this_ptr);
52548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52550         this_ptr_conv.is_owned = false;
52551         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52552         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
52553         return ret_arr;
52554 }
52555
52556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52557         LDKRevokeAndACK this_ptr_conv;
52558         this_ptr_conv.inner = untag_ptr(this_ptr);
52559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52561         this_ptr_conv.is_owned = false;
52562         LDKThirtyTwoBytes val_ref;
52563         CHECK((*env)->GetArrayLength(env, val) == 32);
52564         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52565         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
52566 }
52567
52568 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
52569         LDKRevokeAndACK this_ptr_conv;
52570         this_ptr_conv.inner = untag_ptr(this_ptr);
52571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52573         this_ptr_conv.is_owned = false;
52574         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52575         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
52576         return ret_arr;
52577 }
52578
52579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52580         LDKRevokeAndACK this_ptr_conv;
52581         this_ptr_conv.inner = untag_ptr(this_ptr);
52582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52584         this_ptr_conv.is_owned = false;
52585         LDKThirtyTwoBytes val_ref;
52586         CHECK((*env)->GetArrayLength(env, val) == 32);
52587         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52588         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
52589 }
52590
52591 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
52592         LDKRevokeAndACK this_ptr_conv;
52593         this_ptr_conv.inner = untag_ptr(this_ptr);
52594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52596         this_ptr_conv.is_owned = false;
52597         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52598         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
52599         return ret_arr;
52600 }
52601
52602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52603         LDKRevokeAndACK this_ptr_conv;
52604         this_ptr_conv.inner = untag_ptr(this_ptr);
52605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52607         this_ptr_conv.is_owned = false;
52608         LDKPublicKey val_ref;
52609         CHECK((*env)->GetArrayLength(env, val) == 33);
52610         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52611         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
52612 }
52613
52614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray per_commitment_secret_arg, int8_tArray next_per_commitment_point_arg) {
52615         LDKThirtyTwoBytes channel_id_arg_ref;
52616         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
52617         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
52618         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
52619         CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
52620         (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
52621         LDKPublicKey next_per_commitment_point_arg_ref;
52622         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
52623         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
52624         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
52625         int64_t ret_ref = 0;
52626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52628         return ret_ref;
52629 }
52630
52631 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
52632         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
52633         int64_t ret_ref = 0;
52634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52636         return ret_ref;
52637 }
52638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52639         LDKRevokeAndACK arg_conv;
52640         arg_conv.inner = untag_ptr(arg);
52641         arg_conv.is_owned = ptr_is_owned(arg);
52642         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52643         arg_conv.is_owned = false;
52644         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
52645         return ret_conv;
52646 }
52647
52648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52649         LDKRevokeAndACK orig_conv;
52650         orig_conv.inner = untag_ptr(orig);
52651         orig_conv.is_owned = ptr_is_owned(orig);
52652         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52653         orig_conv.is_owned = false;
52654         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
52655         int64_t ret_ref = 0;
52656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52658         return ret_ref;
52659 }
52660
52661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1hash(JNIEnv *env, jclass clz, int64_t o) {
52662         LDKRevokeAndACK o_conv;
52663         o_conv.inner = untag_ptr(o);
52664         o_conv.is_owned = ptr_is_owned(o);
52665         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52666         o_conv.is_owned = false;
52667         int64_t ret_conv = RevokeAndACK_hash(&o_conv);
52668         return ret_conv;
52669 }
52670
52671 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52672         LDKRevokeAndACK a_conv;
52673         a_conv.inner = untag_ptr(a);
52674         a_conv.is_owned = ptr_is_owned(a);
52675         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52676         a_conv.is_owned = false;
52677         LDKRevokeAndACK b_conv;
52678         b_conv.inner = untag_ptr(b);
52679         b_conv.is_owned = ptr_is_owned(b);
52680         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52681         b_conv.is_owned = false;
52682         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
52683         return ret_conv;
52684 }
52685
52686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52687         LDKUpdateFee this_obj_conv;
52688         this_obj_conv.inner = untag_ptr(this_obj);
52689         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52691         UpdateFee_free(this_obj_conv);
52692 }
52693
52694 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52695         LDKUpdateFee this_ptr_conv;
52696         this_ptr_conv.inner = untag_ptr(this_ptr);
52697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52699         this_ptr_conv.is_owned = false;
52700         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52701         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
52702         return ret_arr;
52703 }
52704
52705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52706         LDKUpdateFee this_ptr_conv;
52707         this_ptr_conv.inner = untag_ptr(this_ptr);
52708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52710         this_ptr_conv.is_owned = false;
52711         LDKThirtyTwoBytes val_ref;
52712         CHECK((*env)->GetArrayLength(env, val) == 32);
52713         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52714         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
52715 }
52716
52717 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
52718         LDKUpdateFee this_ptr_conv;
52719         this_ptr_conv.inner = untag_ptr(this_ptr);
52720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52722         this_ptr_conv.is_owned = false;
52723         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
52724         return ret_conv;
52725 }
52726
52727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
52728         LDKUpdateFee this_ptr_conv;
52729         this_ptr_conv.inner = untag_ptr(this_ptr);
52730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52732         this_ptr_conv.is_owned = false;
52733         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
52734 }
52735
52736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
52737         LDKThirtyTwoBytes channel_id_arg_ref;
52738         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
52739         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
52740         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
52741         int64_t ret_ref = 0;
52742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52744         return ret_ref;
52745 }
52746
52747 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
52748         LDKUpdateFee ret_var = UpdateFee_clone(arg);
52749         int64_t ret_ref = 0;
52750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52752         return ret_ref;
52753 }
52754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52755         LDKUpdateFee arg_conv;
52756         arg_conv.inner = untag_ptr(arg);
52757         arg_conv.is_owned = ptr_is_owned(arg);
52758         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52759         arg_conv.is_owned = false;
52760         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
52761         return ret_conv;
52762 }
52763
52764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52765         LDKUpdateFee orig_conv;
52766         orig_conv.inner = untag_ptr(orig);
52767         orig_conv.is_owned = ptr_is_owned(orig);
52768         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52769         orig_conv.is_owned = false;
52770         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
52771         int64_t ret_ref = 0;
52772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52774         return ret_ref;
52775 }
52776
52777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1hash(JNIEnv *env, jclass clz, int64_t o) {
52778         LDKUpdateFee o_conv;
52779         o_conv.inner = untag_ptr(o);
52780         o_conv.is_owned = ptr_is_owned(o);
52781         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52782         o_conv.is_owned = false;
52783         int64_t ret_conv = UpdateFee_hash(&o_conv);
52784         return ret_conv;
52785 }
52786
52787 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52788         LDKUpdateFee a_conv;
52789         a_conv.inner = untag_ptr(a);
52790         a_conv.is_owned = ptr_is_owned(a);
52791         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52792         a_conv.is_owned = false;
52793         LDKUpdateFee b_conv;
52794         b_conv.inner = untag_ptr(b);
52795         b_conv.is_owned = ptr_is_owned(b);
52796         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52797         b_conv.is_owned = false;
52798         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
52799         return ret_conv;
52800 }
52801
52802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52803         LDKChannelReestablish this_obj_conv;
52804         this_obj_conv.inner = untag_ptr(this_obj);
52805         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52807         ChannelReestablish_free(this_obj_conv);
52808 }
52809
52810 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52811         LDKChannelReestablish this_ptr_conv;
52812         this_ptr_conv.inner = untag_ptr(this_ptr);
52813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52815         this_ptr_conv.is_owned = false;
52816         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52817         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
52818         return ret_arr;
52819 }
52820
52821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52822         LDKChannelReestablish this_ptr_conv;
52823         this_ptr_conv.inner = untag_ptr(this_ptr);
52824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52826         this_ptr_conv.is_owned = false;
52827         LDKThirtyTwoBytes val_ref;
52828         CHECK((*env)->GetArrayLength(env, val) == 32);
52829         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52830         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
52831 }
52832
52833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
52834         LDKChannelReestablish this_ptr_conv;
52835         this_ptr_conv.inner = untag_ptr(this_ptr);
52836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52838         this_ptr_conv.is_owned = false;
52839         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
52840         return ret_conv;
52841 }
52842
52843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52844         LDKChannelReestablish this_ptr_conv;
52845         this_ptr_conv.inner = untag_ptr(this_ptr);
52846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52848         this_ptr_conv.is_owned = false;
52849         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
52850 }
52851
52852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
52853         LDKChannelReestablish this_ptr_conv;
52854         this_ptr_conv.inner = untag_ptr(this_ptr);
52855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52857         this_ptr_conv.is_owned = false;
52858         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
52859         return ret_conv;
52860 }
52861
52862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52863         LDKChannelReestablish this_ptr_conv;
52864         this_ptr_conv.inner = untag_ptr(this_ptr);
52865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52867         this_ptr_conv.is_owned = false;
52868         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
52869 }
52870
52871 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
52872         LDKChannelReestablish this_ptr_conv;
52873         this_ptr_conv.inner = untag_ptr(this_ptr);
52874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52876         this_ptr_conv.is_owned = false;
52877         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52878         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv));
52879         return ret_arr;
52880 }
52881
52882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52883         LDKChannelReestablish this_ptr_conv;
52884         this_ptr_conv.inner = untag_ptr(this_ptr);
52885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52887         this_ptr_conv.is_owned = false;
52888         LDKThirtyTwoBytes val_ref;
52889         CHECK((*env)->GetArrayLength(env, val) == 32);
52890         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52891         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
52892 }
52893
52894 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
52895         LDKChannelReestablish this_ptr_conv;
52896         this_ptr_conv.inner = untag_ptr(this_ptr);
52897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52899         this_ptr_conv.is_owned = false;
52900         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52901         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
52902         return ret_arr;
52903 }
52904
52905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52906         LDKChannelReestablish this_ptr_conv;
52907         this_ptr_conv.inner = untag_ptr(this_ptr);
52908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52910         this_ptr_conv.is_owned = false;
52911         LDKPublicKey val_ref;
52912         CHECK((*env)->GetArrayLength(env, val) == 33);
52913         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52914         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
52915 }
52916
52917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
52918         LDKChannelReestablish this_ptr_conv;
52919         this_ptr_conv.inner = untag_ptr(this_ptr);
52920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52922         this_ptr_conv.is_owned = false;
52923         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
52924         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
52925         int64_t ret_ref = tag_ptr(ret_copy, true);
52926         return ret_ref;
52927 }
52928
52929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52930         LDKChannelReestablish this_ptr_conv;
52931         this_ptr_conv.inner = untag_ptr(this_ptr);
52932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52934         this_ptr_conv.is_owned = false;
52935         void* val_ptr = untag_ptr(val);
52936         CHECK_ACCESS(val_ptr);
52937         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
52938         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
52939         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
52940 }
52941
52942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t next_local_commitment_number_arg, int64_t next_remote_commitment_number_arg, int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg, int64_t next_funding_txid_arg) {
52943         LDKThirtyTwoBytes channel_id_arg_ref;
52944         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
52945         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
52946         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
52947         CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
52948         (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
52949         LDKPublicKey my_current_per_commitment_point_arg_ref;
52950         CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
52951         (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
52952         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
52953         CHECK_ACCESS(next_funding_txid_arg_ptr);
52954         LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_funding_txid_arg_ptr);
52955         next_funding_txid_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_funding_txid_arg));
52956         LDKChannelReestablish ret_var = ChannelReestablish_new(channel_id_arg_ref, next_local_commitment_number_arg, next_remote_commitment_number_arg, your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref, next_funding_txid_arg_conv);
52957         int64_t ret_ref = 0;
52958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52960         return ret_ref;
52961 }
52962
52963 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
52964         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
52965         int64_t ret_ref = 0;
52966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52968         return ret_ref;
52969 }
52970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52971         LDKChannelReestablish arg_conv;
52972         arg_conv.inner = untag_ptr(arg);
52973         arg_conv.is_owned = ptr_is_owned(arg);
52974         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52975         arg_conv.is_owned = false;
52976         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
52977         return ret_conv;
52978 }
52979
52980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52981         LDKChannelReestablish orig_conv;
52982         orig_conv.inner = untag_ptr(orig);
52983         orig_conv.is_owned = ptr_is_owned(orig);
52984         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52985         orig_conv.is_owned = false;
52986         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
52987         int64_t ret_ref = 0;
52988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52990         return ret_ref;
52991 }
52992
52993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1hash(JNIEnv *env, jclass clz, int64_t o) {
52994         LDKChannelReestablish o_conv;
52995         o_conv.inner = untag_ptr(o);
52996         o_conv.is_owned = ptr_is_owned(o);
52997         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52998         o_conv.is_owned = false;
52999         int64_t ret_conv = ChannelReestablish_hash(&o_conv);
53000         return ret_conv;
53001 }
53002
53003 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53004         LDKChannelReestablish a_conv;
53005         a_conv.inner = untag_ptr(a);
53006         a_conv.is_owned = ptr_is_owned(a);
53007         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53008         a_conv.is_owned = false;
53009         LDKChannelReestablish b_conv;
53010         b_conv.inner = untag_ptr(b);
53011         b_conv.is_owned = ptr_is_owned(b);
53012         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53013         b_conv.is_owned = false;
53014         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
53015         return ret_conv;
53016 }
53017
53018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53019         LDKAnnouncementSignatures this_obj_conv;
53020         this_obj_conv.inner = untag_ptr(this_obj);
53021         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53023         AnnouncementSignatures_free(this_obj_conv);
53024 }
53025
53026 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53027         LDKAnnouncementSignatures this_ptr_conv;
53028         this_ptr_conv.inner = untag_ptr(this_ptr);
53029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53031         this_ptr_conv.is_owned = false;
53032         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
53033         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
53034         return ret_arr;
53035 }
53036
53037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53038         LDKAnnouncementSignatures this_ptr_conv;
53039         this_ptr_conv.inner = untag_ptr(this_ptr);
53040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53042         this_ptr_conv.is_owned = false;
53043         LDKThirtyTwoBytes val_ref;
53044         CHECK((*env)->GetArrayLength(env, val) == 32);
53045         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
53046         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
53047 }
53048
53049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53050         LDKAnnouncementSignatures this_ptr_conv;
53051         this_ptr_conv.inner = untag_ptr(this_ptr);
53052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53054         this_ptr_conv.is_owned = false;
53055         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
53056         return ret_conv;
53057 }
53058
53059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53060         LDKAnnouncementSignatures this_ptr_conv;
53061         this_ptr_conv.inner = untag_ptr(this_ptr);
53062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53064         this_ptr_conv.is_owned = false;
53065         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
53066 }
53067
53068 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
53069         LDKAnnouncementSignatures this_ptr_conv;
53070         this_ptr_conv.inner = untag_ptr(this_ptr);
53071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53073         this_ptr_conv.is_owned = false;
53074         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
53075         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
53076         return ret_arr;
53077 }
53078
53079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53080         LDKAnnouncementSignatures this_ptr_conv;
53081         this_ptr_conv.inner = untag_ptr(this_ptr);
53082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53084         this_ptr_conv.is_owned = false;
53085         LDKECDSASignature val_ref;
53086         CHECK((*env)->GetArrayLength(env, val) == 64);
53087         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
53088         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
53089 }
53090
53091 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
53092         LDKAnnouncementSignatures this_ptr_conv;
53093         this_ptr_conv.inner = untag_ptr(this_ptr);
53094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53096         this_ptr_conv.is_owned = false;
53097         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
53098         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
53099         return ret_arr;
53100 }
53101
53102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53103         LDKAnnouncementSignatures this_ptr_conv;
53104         this_ptr_conv.inner = untag_ptr(this_ptr);
53105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53107         this_ptr_conv.is_owned = false;
53108         LDKECDSASignature val_ref;
53109         CHECK((*env)->GetArrayLength(env, val) == 64);
53110         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
53111         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
53112 }
53113
53114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t short_channel_id_arg, int8_tArray node_signature_arg, int8_tArray bitcoin_signature_arg) {
53115         LDKThirtyTwoBytes channel_id_arg_ref;
53116         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
53117         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
53118         LDKECDSASignature node_signature_arg_ref;
53119         CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
53120         (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
53121         LDKECDSASignature bitcoin_signature_arg_ref;
53122         CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
53123         (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
53124         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
53125         int64_t ret_ref = 0;
53126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53128         return ret_ref;
53129 }
53130
53131 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
53132         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
53133         int64_t ret_ref = 0;
53134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53136         return ret_ref;
53137 }
53138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53139         LDKAnnouncementSignatures arg_conv;
53140         arg_conv.inner = untag_ptr(arg);
53141         arg_conv.is_owned = ptr_is_owned(arg);
53142         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53143         arg_conv.is_owned = false;
53144         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
53145         return ret_conv;
53146 }
53147
53148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53149         LDKAnnouncementSignatures orig_conv;
53150         orig_conv.inner = untag_ptr(orig);
53151         orig_conv.is_owned = ptr_is_owned(orig);
53152         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53153         orig_conv.is_owned = false;
53154         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
53155         int64_t ret_ref = 0;
53156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53158         return ret_ref;
53159 }
53160
53161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
53162         LDKAnnouncementSignatures o_conv;
53163         o_conv.inner = untag_ptr(o);
53164         o_conv.is_owned = ptr_is_owned(o);
53165         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53166         o_conv.is_owned = false;
53167         int64_t ret_conv = AnnouncementSignatures_hash(&o_conv);
53168         return ret_conv;
53169 }
53170
53171 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53172         LDKAnnouncementSignatures a_conv;
53173         a_conv.inner = untag_ptr(a);
53174         a_conv.is_owned = ptr_is_owned(a);
53175         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53176         a_conv.is_owned = false;
53177         LDKAnnouncementSignatures b_conv;
53178         b_conv.inner = untag_ptr(b);
53179         b_conv.is_owned = ptr_is_owned(b);
53180         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53181         b_conv.is_owned = false;
53182         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
53183         return ret_conv;
53184 }
53185
53186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
53187         if (!ptr_is_owned(this_ptr)) return;
53188         void* this_ptr_ptr = untag_ptr(this_ptr);
53189         CHECK_ACCESS(this_ptr_ptr);
53190         LDKSocketAddress this_ptr_conv = *(LDKSocketAddress*)(this_ptr_ptr);
53191         FREE(untag_ptr(this_ptr));
53192         SocketAddress_free(this_ptr_conv);
53193 }
53194
53195 static inline uint64_t SocketAddress_clone_ptr(LDKSocketAddress *NONNULL_PTR arg) {
53196         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
53197         *ret_copy = SocketAddress_clone(arg);
53198         int64_t ret_ref = tag_ptr(ret_copy, true);
53199         return ret_ref;
53200 }
53201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53202         LDKSocketAddress* arg_conv = (LDKSocketAddress*)untag_ptr(arg);
53203         int64_t ret_conv = SocketAddress_clone_ptr(arg_conv);
53204         return ret_conv;
53205 }
53206
53207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53208         LDKSocketAddress* orig_conv = (LDKSocketAddress*)untag_ptr(orig);
53209         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
53210         *ret_copy = SocketAddress_clone(orig_conv);
53211         int64_t ret_ref = tag_ptr(ret_copy, true);
53212         return ret_ref;
53213 }
53214
53215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1tcp_1ip_1v4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
53216         LDKFourBytes addr_ref;
53217         CHECK((*env)->GetArrayLength(env, addr) == 4);
53218         (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
53219         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
53220         *ret_copy = SocketAddress_tcp_ip_v4(addr_ref, port);
53221         int64_t ret_ref = tag_ptr(ret_copy, true);
53222         return ret_ref;
53223 }
53224
53225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1tcp_1ip_1v6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
53226         LDKSixteenBytes addr_ref;
53227         CHECK((*env)->GetArrayLength(env, addr) == 16);
53228         (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
53229         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
53230         *ret_copy = SocketAddress_tcp_ip_v6(addr_ref, port);
53231         int64_t ret_ref = tag_ptr(ret_copy, true);
53232         return ret_ref;
53233 }
53234
53235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
53236         LDKTwelveBytes a_ref;
53237         CHECK((*env)->GetArrayLength(env, a) == 12);
53238         (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
53239         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
53240         *ret_copy = SocketAddress_onion_v2(a_ref);
53241         int64_t ret_ref = tag_ptr(ret_copy, true);
53242         return ret_ref;
53243 }
53244
53245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1onion_1v3(JNIEnv *env, jclass clz, int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
53246         LDKThirtyTwoBytes ed25519_pubkey_ref;
53247         CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
53248         (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
53249         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
53250         *ret_copy = SocketAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
53251         int64_t ret_ref = tag_ptr(ret_copy, true);
53252         return ret_ref;
53253 }
53254
53255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1hostname(JNIEnv *env, jclass clz, int64_t hostname, int16_t port) {
53256         LDKHostname hostname_conv;
53257         hostname_conv.inner = untag_ptr(hostname);
53258         hostname_conv.is_owned = ptr_is_owned(hostname);
53259         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
53260         hostname_conv = Hostname_clone(&hostname_conv);
53261         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
53262         *ret_copy = SocketAddress_hostname(hostname_conv, port);
53263         int64_t ret_ref = tag_ptr(ret_copy, true);
53264         return ret_ref;
53265 }
53266
53267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1hash(JNIEnv *env, jclass clz, int64_t o) {
53268         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
53269         int64_t ret_conv = SocketAddress_hash(o_conv);
53270         return ret_conv;
53271 }
53272
53273 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SocketAddress_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53274         LDKSocketAddress* a_conv = (LDKSocketAddress*)untag_ptr(a);
53275         LDKSocketAddress* b_conv = (LDKSocketAddress*)untag_ptr(b);
53276         jboolean ret_conv = SocketAddress_eq(a_conv, b_conv);
53277         return ret_conv;
53278 }
53279
53280 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SocketAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
53281         LDKSocketAddress* obj_conv = (LDKSocketAddress*)untag_ptr(obj);
53282         LDKCVec_u8Z ret_var = SocketAddress_write(obj_conv);
53283         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53284         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53285         CVec_u8Z_free(ret_var);
53286         return ret_arr;
53287 }
53288
53289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53290         LDKu8slice ser_ref;
53291         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53292         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53293         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
53294         *ret_conv = SocketAddress_read(ser_ref);
53295         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53296         return tag_ptr(ret_conv, true);
53297 }
53298
53299 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53300         LDKSocketAddressParseError* orig_conv = (LDKSocketAddressParseError*)untag_ptr(orig);
53301         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_clone(orig_conv));
53302         return ret_conv;
53303 }
53304
53305 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1socket_1addr_1parse(JNIEnv *env, jclass clz) {
53306         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_socket_addr_parse());
53307         return ret_conv;
53308 }
53309
53310 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1input(JNIEnv *env, jclass clz) {
53311         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_input());
53312         return ret_conv;
53313 }
53314
53315 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1port(JNIEnv *env, jclass clz) {
53316         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_port());
53317         return ret_conv;
53318 }
53319
53320 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1onion_1v3(JNIEnv *env, jclass clz) {
53321         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_onion_v3());
53322         return ret_conv;
53323 }
53324
53325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1hash(JNIEnv *env, jclass clz, int64_t o) {
53326         LDKSocketAddressParseError* o_conv = (LDKSocketAddressParseError*)untag_ptr(o);
53327         int64_t ret_conv = SocketAddressParseError_hash(o_conv);
53328         return ret_conv;
53329 }
53330
53331 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53332         LDKSocketAddressParseError* a_conv = (LDKSocketAddressParseError*)untag_ptr(a);
53333         LDKSocketAddressParseError* b_conv = (LDKSocketAddressParseError*)untag_ptr(b);
53334         jboolean ret_conv = SocketAddressParseError_eq(a_conv, b_conv);
53335         return ret_conv;
53336 }
53337
53338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_parse_1onion_1address(JNIEnv *env, jclass clz, jstring host, int16_t port) {
53339         LDKStr host_conv = java_to_owned_str(env, host);
53340         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
53341         *ret_conv = parse_onion_address(host_conv, port);
53342         return tag_ptr(ret_conv, true);
53343 }
53344
53345 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SocketAddress_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
53346         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
53347         LDKStr ret_str = SocketAddress_to_str(o_conv);
53348         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
53349         Str_free(ret_str);
53350         return ret_conv;
53351 }
53352
53353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1from_1str(JNIEnv *env, jclass clz, jstring s) {
53354         LDKStr s_conv = java_to_owned_str(env, s);
53355         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
53356         *ret_conv = SocketAddress_from_str(s_conv);
53357         return tag_ptr(ret_conv, true);
53358 }
53359
53360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
53361         if (!ptr_is_owned(this_ptr)) return;
53362         void* this_ptr_ptr = untag_ptr(this_ptr);
53363         CHECK_ACCESS(this_ptr_ptr);
53364         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
53365         FREE(untag_ptr(this_ptr));
53366         UnsignedGossipMessage_free(this_ptr_conv);
53367 }
53368
53369 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
53370         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
53371         *ret_copy = UnsignedGossipMessage_clone(arg);
53372         int64_t ret_ref = tag_ptr(ret_copy, true);
53373         return ret_ref;
53374 }
53375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53376         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
53377         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
53378         return ret_conv;
53379 }
53380
53381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53382         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
53383         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
53384         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
53385         int64_t ret_ref = tag_ptr(ret_copy, true);
53386         return ret_ref;
53387 }
53388
53389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1announcement(JNIEnv *env, jclass clz, int64_t a) {
53390         LDKUnsignedChannelAnnouncement a_conv;
53391         a_conv.inner = untag_ptr(a);
53392         a_conv.is_owned = ptr_is_owned(a);
53393         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53394         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
53395         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
53396         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
53397         int64_t ret_ref = tag_ptr(ret_copy, true);
53398         return ret_ref;
53399 }
53400
53401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1update(JNIEnv *env, jclass clz, int64_t a) {
53402         LDKUnsignedChannelUpdate a_conv;
53403         a_conv.inner = untag_ptr(a);
53404         a_conv.is_owned = ptr_is_owned(a);
53405         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53406         a_conv = UnsignedChannelUpdate_clone(&a_conv);
53407         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
53408         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
53409         int64_t ret_ref = tag_ptr(ret_copy, true);
53410         return ret_ref;
53411 }
53412
53413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1node_1announcement(JNIEnv *env, jclass clz, int64_t a) {
53414         LDKUnsignedNodeAnnouncement a_conv;
53415         a_conv.inner = untag_ptr(a);
53416         a_conv.is_owned = ptr_is_owned(a);
53417         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53418         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
53419         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
53420         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
53421         int64_t ret_ref = tag_ptr(ret_copy, true);
53422         return ret_ref;
53423 }
53424
53425 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
53426         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
53427         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
53428         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53429         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53430         CVec_u8Z_free(ret_var);
53431         return ret_arr;
53432 }
53433
53434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53435         LDKUnsignedNodeAnnouncement this_obj_conv;
53436         this_obj_conv.inner = untag_ptr(this_obj);
53437         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53439         UnsignedNodeAnnouncement_free(this_obj_conv);
53440 }
53441
53442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
53443         LDKUnsignedNodeAnnouncement this_ptr_conv;
53444         this_ptr_conv.inner = untag_ptr(this_ptr);
53445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53447         this_ptr_conv.is_owned = false;
53448         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
53449         int64_t ret_ref = 0;
53450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53452         return ret_ref;
53453 }
53454
53455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53456         LDKUnsignedNodeAnnouncement this_ptr_conv;
53457         this_ptr_conv.inner = untag_ptr(this_ptr);
53458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53460         this_ptr_conv.is_owned = false;
53461         LDKNodeFeatures val_conv;
53462         val_conv.inner = untag_ptr(val);
53463         val_conv.is_owned = ptr_is_owned(val);
53464         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53465         val_conv = NodeFeatures_clone(&val_conv);
53466         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
53467 }
53468
53469 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
53470         LDKUnsignedNodeAnnouncement this_ptr_conv;
53471         this_ptr_conv.inner = untag_ptr(this_ptr);
53472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53474         this_ptr_conv.is_owned = false;
53475         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
53476         return ret_conv;
53477 }
53478
53479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
53480         LDKUnsignedNodeAnnouncement this_ptr_conv;
53481         this_ptr_conv.inner = untag_ptr(this_ptr);
53482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53484         this_ptr_conv.is_owned = false;
53485         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
53486 }
53487
53488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53489         LDKUnsignedNodeAnnouncement this_ptr_conv;
53490         this_ptr_conv.inner = untag_ptr(this_ptr);
53491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53493         this_ptr_conv.is_owned = false;
53494         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
53495         int64_t ret_ref = 0;
53496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53498         return ret_ref;
53499 }
53500
53501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53502         LDKUnsignedNodeAnnouncement this_ptr_conv;
53503         this_ptr_conv.inner = untag_ptr(this_ptr);
53504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53506         this_ptr_conv.is_owned = false;
53507         LDKNodeId val_conv;
53508         val_conv.inner = untag_ptr(val);
53509         val_conv.is_owned = ptr_is_owned(val);
53510         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53511         val_conv = NodeId_clone(&val_conv);
53512         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
53513 }
53514
53515 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
53516         LDKUnsignedNodeAnnouncement this_ptr_conv;
53517         this_ptr_conv.inner = untag_ptr(this_ptr);
53518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53520         this_ptr_conv.is_owned = false;
53521         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
53522         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
53523         return ret_arr;
53524 }
53525
53526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53527         LDKUnsignedNodeAnnouncement this_ptr_conv;
53528         this_ptr_conv.inner = untag_ptr(this_ptr);
53529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53531         this_ptr_conv.is_owned = false;
53532         LDKThreeBytes val_ref;
53533         CHECK((*env)->GetArrayLength(env, val) == 3);
53534         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
53535         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
53536 }
53537
53538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
53539         LDKUnsignedNodeAnnouncement this_ptr_conv;
53540         this_ptr_conv.inner = untag_ptr(this_ptr);
53541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53543         this_ptr_conv.is_owned = false;
53544         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
53545         int64_t ret_ref = 0;
53546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53548         return ret_ref;
53549 }
53550
53551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53552         LDKUnsignedNodeAnnouncement this_ptr_conv;
53553         this_ptr_conv.inner = untag_ptr(this_ptr);
53554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53556         this_ptr_conv.is_owned = false;
53557         LDKNodeAlias val_conv;
53558         val_conv.inner = untag_ptr(val);
53559         val_conv.is_owned = ptr_is_owned(val);
53560         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53561         val_conv = NodeAlias_clone(&val_conv);
53562         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
53563 }
53564
53565 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
53566         LDKUnsignedNodeAnnouncement this_ptr_conv;
53567         this_ptr_conv.inner = untag_ptr(this_ptr);
53568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53570         this_ptr_conv.is_owned = false;
53571         LDKCVec_SocketAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
53572         int64_tArray ret_arr = NULL;
53573         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
53574         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
53575         for (size_t p = 0; p < ret_var.datalen; p++) {
53576                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
53577                 *ret_conv_15_copy = ret_var.data[p];
53578                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
53579                 ret_arr_ptr[p] = ret_conv_15_ref;
53580         }
53581         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
53582         FREE(ret_var.data);
53583         return ret_arr;
53584 }
53585
53586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
53587         LDKUnsignedNodeAnnouncement this_ptr_conv;
53588         this_ptr_conv.inner = untag_ptr(this_ptr);
53589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53591         this_ptr_conv.is_owned = false;
53592         LDKCVec_SocketAddressZ val_constr;
53593         val_constr.datalen = (*env)->GetArrayLength(env, val);
53594         if (val_constr.datalen > 0)
53595                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
53596         else
53597                 val_constr.data = NULL;
53598         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
53599         for (size_t p = 0; p < val_constr.datalen; p++) {
53600                 int64_t val_conv_15 = val_vals[p];
53601                 void* val_conv_15_ptr = untag_ptr(val_conv_15);
53602                 CHECK_ACCESS(val_conv_15_ptr);
53603                 LDKSocketAddress val_conv_15_conv = *(LDKSocketAddress*)(val_conv_15_ptr);
53604                 val_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(val_conv_15));
53605                 val_constr.data[p] = val_conv_15_conv;
53606         }
53607         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
53608         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
53609 }
53610
53611 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
53612         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
53613         int64_t ret_ref = 0;
53614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53616         return ret_ref;
53617 }
53618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53619         LDKUnsignedNodeAnnouncement arg_conv;
53620         arg_conv.inner = untag_ptr(arg);
53621         arg_conv.is_owned = ptr_is_owned(arg);
53622         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53623         arg_conv.is_owned = false;
53624         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
53625         return ret_conv;
53626 }
53627
53628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53629         LDKUnsignedNodeAnnouncement orig_conv;
53630         orig_conv.inner = untag_ptr(orig);
53631         orig_conv.is_owned = ptr_is_owned(orig);
53632         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53633         orig_conv.is_owned = false;
53634         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
53635         int64_t ret_ref = 0;
53636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53638         return ret_ref;
53639 }
53640
53641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1hash(JNIEnv *env, jclass clz, int64_t o) {
53642         LDKUnsignedNodeAnnouncement o_conv;
53643         o_conv.inner = untag_ptr(o);
53644         o_conv.is_owned = ptr_is_owned(o);
53645         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53646         o_conv.is_owned = false;
53647         int64_t ret_conv = UnsignedNodeAnnouncement_hash(&o_conv);
53648         return ret_conv;
53649 }
53650
53651 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53652         LDKUnsignedNodeAnnouncement a_conv;
53653         a_conv.inner = untag_ptr(a);
53654         a_conv.is_owned = ptr_is_owned(a);
53655         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53656         a_conv.is_owned = false;
53657         LDKUnsignedNodeAnnouncement b_conv;
53658         b_conv.inner = untag_ptr(b);
53659         b_conv.is_owned = ptr_is_owned(b);
53660         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53661         b_conv.is_owned = false;
53662         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
53663         return ret_conv;
53664 }
53665
53666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53667         LDKNodeAnnouncement this_obj_conv;
53668         this_obj_conv.inner = untag_ptr(this_obj);
53669         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53671         NodeAnnouncement_free(this_obj_conv);
53672 }
53673
53674 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
53675         LDKNodeAnnouncement this_ptr_conv;
53676         this_ptr_conv.inner = untag_ptr(this_ptr);
53677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53679         this_ptr_conv.is_owned = false;
53680         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
53681         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
53682         return ret_arr;
53683 }
53684
53685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53686         LDKNodeAnnouncement this_ptr_conv;
53687         this_ptr_conv.inner = untag_ptr(this_ptr);
53688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53690         this_ptr_conv.is_owned = false;
53691         LDKECDSASignature val_ref;
53692         CHECK((*env)->GetArrayLength(env, val) == 64);
53693         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
53694         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
53695 }
53696
53697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
53698         LDKNodeAnnouncement this_ptr_conv;
53699         this_ptr_conv.inner = untag_ptr(this_ptr);
53700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53702         this_ptr_conv.is_owned = false;
53703         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
53704         int64_t ret_ref = 0;
53705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53707         return ret_ref;
53708 }
53709
53710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53711         LDKNodeAnnouncement this_ptr_conv;
53712         this_ptr_conv.inner = untag_ptr(this_ptr);
53713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53715         this_ptr_conv.is_owned = false;
53716         LDKUnsignedNodeAnnouncement val_conv;
53717         val_conv.inner = untag_ptr(val);
53718         val_conv.is_owned = ptr_is_owned(val);
53719         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53720         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
53721         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
53722 }
53723
53724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
53725         LDKECDSASignature signature_arg_ref;
53726         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
53727         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
53728         LDKUnsignedNodeAnnouncement contents_arg_conv;
53729         contents_arg_conv.inner = untag_ptr(contents_arg);
53730         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
53731         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
53732         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
53733         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
53734         int64_t ret_ref = 0;
53735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53737         return ret_ref;
53738 }
53739
53740 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
53741         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
53742         int64_t ret_ref = 0;
53743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53745         return ret_ref;
53746 }
53747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53748         LDKNodeAnnouncement arg_conv;
53749         arg_conv.inner = untag_ptr(arg);
53750         arg_conv.is_owned = ptr_is_owned(arg);
53751         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53752         arg_conv.is_owned = false;
53753         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
53754         return ret_conv;
53755 }
53756
53757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53758         LDKNodeAnnouncement orig_conv;
53759         orig_conv.inner = untag_ptr(orig);
53760         orig_conv.is_owned = ptr_is_owned(orig);
53761         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53762         orig_conv.is_owned = false;
53763         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
53764         int64_t ret_ref = 0;
53765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53767         return ret_ref;
53768 }
53769
53770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1hash(JNIEnv *env, jclass clz, int64_t o) {
53771         LDKNodeAnnouncement o_conv;
53772         o_conv.inner = untag_ptr(o);
53773         o_conv.is_owned = ptr_is_owned(o);
53774         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53775         o_conv.is_owned = false;
53776         int64_t ret_conv = NodeAnnouncement_hash(&o_conv);
53777         return ret_conv;
53778 }
53779
53780 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53781         LDKNodeAnnouncement a_conv;
53782         a_conv.inner = untag_ptr(a);
53783         a_conv.is_owned = ptr_is_owned(a);
53784         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53785         a_conv.is_owned = false;
53786         LDKNodeAnnouncement b_conv;
53787         b_conv.inner = untag_ptr(b);
53788         b_conv.is_owned = ptr_is_owned(b);
53789         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53790         b_conv.is_owned = false;
53791         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
53792         return ret_conv;
53793 }
53794
53795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53796         LDKUnsignedChannelAnnouncement this_obj_conv;
53797         this_obj_conv.inner = untag_ptr(this_obj);
53798         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53800         UnsignedChannelAnnouncement_free(this_obj_conv);
53801 }
53802
53803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
53804         LDKUnsignedChannelAnnouncement this_ptr_conv;
53805         this_ptr_conv.inner = untag_ptr(this_ptr);
53806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53808         this_ptr_conv.is_owned = false;
53809         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
53810         int64_t ret_ref = 0;
53811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53813         return ret_ref;
53814 }
53815
53816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53817         LDKUnsignedChannelAnnouncement this_ptr_conv;
53818         this_ptr_conv.inner = untag_ptr(this_ptr);
53819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53821         this_ptr_conv.is_owned = false;
53822         LDKChannelFeatures val_conv;
53823         val_conv.inner = untag_ptr(val);
53824         val_conv.is_owned = ptr_is_owned(val);
53825         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53826         val_conv = ChannelFeatures_clone(&val_conv);
53827         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
53828 }
53829
53830 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
53831         LDKUnsignedChannelAnnouncement this_ptr_conv;
53832         this_ptr_conv.inner = untag_ptr(this_ptr);
53833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53835         this_ptr_conv.is_owned = false;
53836         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
53837         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
53838         return ret_arr;
53839 }
53840
53841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53842         LDKUnsignedChannelAnnouncement this_ptr_conv;
53843         this_ptr_conv.inner = untag_ptr(this_ptr);
53844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53846         this_ptr_conv.is_owned = false;
53847         LDKThirtyTwoBytes val_ref;
53848         CHECK((*env)->GetArrayLength(env, val) == 32);
53849         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
53850         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
53851 }
53852
53853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53854         LDKUnsignedChannelAnnouncement this_ptr_conv;
53855         this_ptr_conv.inner = untag_ptr(this_ptr);
53856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53858         this_ptr_conv.is_owned = false;
53859         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
53860         return ret_conv;
53861 }
53862
53863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53864         LDKUnsignedChannelAnnouncement this_ptr_conv;
53865         this_ptr_conv.inner = untag_ptr(this_ptr);
53866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53868         this_ptr_conv.is_owned = false;
53869         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
53870 }
53871
53872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
53873         LDKUnsignedChannelAnnouncement this_ptr_conv;
53874         this_ptr_conv.inner = untag_ptr(this_ptr);
53875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53877         this_ptr_conv.is_owned = false;
53878         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
53879         int64_t ret_ref = 0;
53880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53882         return ret_ref;
53883 }
53884
53885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53886         LDKUnsignedChannelAnnouncement this_ptr_conv;
53887         this_ptr_conv.inner = untag_ptr(this_ptr);
53888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53890         this_ptr_conv.is_owned = false;
53891         LDKNodeId val_conv;
53892         val_conv.inner = untag_ptr(val);
53893         val_conv.is_owned = ptr_is_owned(val);
53894         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53895         val_conv = NodeId_clone(&val_conv);
53896         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
53897 }
53898
53899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
53900         LDKUnsignedChannelAnnouncement this_ptr_conv;
53901         this_ptr_conv.inner = untag_ptr(this_ptr);
53902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53904         this_ptr_conv.is_owned = false;
53905         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
53906         int64_t ret_ref = 0;
53907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53909         return ret_ref;
53910 }
53911
53912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53913         LDKUnsignedChannelAnnouncement this_ptr_conv;
53914         this_ptr_conv.inner = untag_ptr(this_ptr);
53915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53917         this_ptr_conv.is_owned = false;
53918         LDKNodeId val_conv;
53919         val_conv.inner = untag_ptr(val);
53920         val_conv.is_owned = ptr_is_owned(val);
53921         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53922         val_conv = NodeId_clone(&val_conv);
53923         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
53924 }
53925
53926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
53927         LDKUnsignedChannelAnnouncement this_ptr_conv;
53928         this_ptr_conv.inner = untag_ptr(this_ptr);
53929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53931         this_ptr_conv.is_owned = false;
53932         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
53933         int64_t ret_ref = 0;
53934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53936         return ret_ref;
53937 }
53938
53939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53940         LDKUnsignedChannelAnnouncement this_ptr_conv;
53941         this_ptr_conv.inner = untag_ptr(this_ptr);
53942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53944         this_ptr_conv.is_owned = false;
53945         LDKNodeId val_conv;
53946         val_conv.inner = untag_ptr(val);
53947         val_conv.is_owned = ptr_is_owned(val);
53948         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53949         val_conv = NodeId_clone(&val_conv);
53950         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
53951 }
53952
53953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
53954         LDKUnsignedChannelAnnouncement this_ptr_conv;
53955         this_ptr_conv.inner = untag_ptr(this_ptr);
53956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53958         this_ptr_conv.is_owned = false;
53959         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
53960         int64_t ret_ref = 0;
53961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53963         return ret_ref;
53964 }
53965
53966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53967         LDKUnsignedChannelAnnouncement this_ptr_conv;
53968         this_ptr_conv.inner = untag_ptr(this_ptr);
53969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53971         this_ptr_conv.is_owned = false;
53972         LDKNodeId val_conv;
53973         val_conv.inner = untag_ptr(val);
53974         val_conv.is_owned = ptr_is_owned(val);
53975         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53976         val_conv = NodeId_clone(&val_conv);
53977         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
53978 }
53979
53980 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
53981         LDKUnsignedChannelAnnouncement this_ptr_conv;
53982         this_ptr_conv.inner = untag_ptr(this_ptr);
53983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53985         this_ptr_conv.is_owned = false;
53986         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_get_excess_data(&this_ptr_conv);
53987         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53988         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53989         CVec_u8Z_free(ret_var);
53990         return ret_arr;
53991 }
53992
53993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53994         LDKUnsignedChannelAnnouncement this_ptr_conv;
53995         this_ptr_conv.inner = untag_ptr(this_ptr);
53996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53998         this_ptr_conv.is_owned = false;
53999         LDKCVec_u8Z val_ref;
54000         val_ref.datalen = (*env)->GetArrayLength(env, val);
54001         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
54002         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
54003         UnsignedChannelAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
54004 }
54005
54006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1new(JNIEnv *env, jclass clz, int64_t features_arg, int8_tArray chain_hash_arg, int64_t short_channel_id_arg, int64_t node_id_1_arg, int64_t node_id_2_arg, int64_t bitcoin_key_1_arg, int64_t bitcoin_key_2_arg, int8_tArray excess_data_arg) {
54007         LDKChannelFeatures features_arg_conv;
54008         features_arg_conv.inner = untag_ptr(features_arg);
54009         features_arg_conv.is_owned = ptr_is_owned(features_arg);
54010         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
54011         features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
54012         LDKThirtyTwoBytes chain_hash_arg_ref;
54013         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
54014         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
54015         LDKNodeId node_id_1_arg_conv;
54016         node_id_1_arg_conv.inner = untag_ptr(node_id_1_arg);
54017         node_id_1_arg_conv.is_owned = ptr_is_owned(node_id_1_arg);
54018         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_1_arg_conv);
54019         node_id_1_arg_conv = NodeId_clone(&node_id_1_arg_conv);
54020         LDKNodeId node_id_2_arg_conv;
54021         node_id_2_arg_conv.inner = untag_ptr(node_id_2_arg);
54022         node_id_2_arg_conv.is_owned = ptr_is_owned(node_id_2_arg);
54023         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_2_arg_conv);
54024         node_id_2_arg_conv = NodeId_clone(&node_id_2_arg_conv);
54025         LDKNodeId bitcoin_key_1_arg_conv;
54026         bitcoin_key_1_arg_conv.inner = untag_ptr(bitcoin_key_1_arg);
54027         bitcoin_key_1_arg_conv.is_owned = ptr_is_owned(bitcoin_key_1_arg);
54028         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_1_arg_conv);
54029         bitcoin_key_1_arg_conv = NodeId_clone(&bitcoin_key_1_arg_conv);
54030         LDKNodeId bitcoin_key_2_arg_conv;
54031         bitcoin_key_2_arg_conv.inner = untag_ptr(bitcoin_key_2_arg);
54032         bitcoin_key_2_arg_conv.is_owned = ptr_is_owned(bitcoin_key_2_arg);
54033         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_2_arg_conv);
54034         bitcoin_key_2_arg_conv = NodeId_clone(&bitcoin_key_2_arg_conv);
54035         LDKCVec_u8Z excess_data_arg_ref;
54036         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
54037         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
54038         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
54039         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_new(features_arg_conv, chain_hash_arg_ref, short_channel_id_arg, node_id_1_arg_conv, node_id_2_arg_conv, bitcoin_key_1_arg_conv, bitcoin_key_2_arg_conv, excess_data_arg_ref);
54040         int64_t ret_ref = 0;
54041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54043         return ret_ref;
54044 }
54045
54046 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
54047         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
54048         int64_t ret_ref = 0;
54049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54051         return ret_ref;
54052 }
54053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54054         LDKUnsignedChannelAnnouncement arg_conv;
54055         arg_conv.inner = untag_ptr(arg);
54056         arg_conv.is_owned = ptr_is_owned(arg);
54057         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54058         arg_conv.is_owned = false;
54059         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
54060         return ret_conv;
54061 }
54062
54063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54064         LDKUnsignedChannelAnnouncement orig_conv;
54065         orig_conv.inner = untag_ptr(orig);
54066         orig_conv.is_owned = ptr_is_owned(orig);
54067         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54068         orig_conv.is_owned = false;
54069         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
54070         int64_t ret_ref = 0;
54071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54073         return ret_ref;
54074 }
54075
54076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1hash(JNIEnv *env, jclass clz, int64_t o) {
54077         LDKUnsignedChannelAnnouncement o_conv;
54078         o_conv.inner = untag_ptr(o);
54079         o_conv.is_owned = ptr_is_owned(o);
54080         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54081         o_conv.is_owned = false;
54082         int64_t ret_conv = UnsignedChannelAnnouncement_hash(&o_conv);
54083         return ret_conv;
54084 }
54085
54086 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54087         LDKUnsignedChannelAnnouncement a_conv;
54088         a_conv.inner = untag_ptr(a);
54089         a_conv.is_owned = ptr_is_owned(a);
54090         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54091         a_conv.is_owned = false;
54092         LDKUnsignedChannelAnnouncement b_conv;
54093         b_conv.inner = untag_ptr(b);
54094         b_conv.is_owned = ptr_is_owned(b);
54095         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54096         b_conv.is_owned = false;
54097         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
54098         return ret_conv;
54099 }
54100
54101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54102         LDKChannelAnnouncement this_obj_conv;
54103         this_obj_conv.inner = untag_ptr(this_obj);
54104         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54106         ChannelAnnouncement_free(this_obj_conv);
54107 }
54108
54109 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
54110         LDKChannelAnnouncement this_ptr_conv;
54111         this_ptr_conv.inner = untag_ptr(this_ptr);
54112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54114         this_ptr_conv.is_owned = false;
54115         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
54116         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
54117         return ret_arr;
54118 }
54119
54120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54121         LDKChannelAnnouncement this_ptr_conv;
54122         this_ptr_conv.inner = untag_ptr(this_ptr);
54123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54125         this_ptr_conv.is_owned = false;
54126         LDKECDSASignature val_ref;
54127         CHECK((*env)->GetArrayLength(env, val) == 64);
54128         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
54129         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
54130 }
54131
54132 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
54133         LDKChannelAnnouncement this_ptr_conv;
54134         this_ptr_conv.inner = untag_ptr(this_ptr);
54135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54137         this_ptr_conv.is_owned = false;
54138         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
54139         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
54140         return ret_arr;
54141 }
54142
54143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54144         LDKChannelAnnouncement this_ptr_conv;
54145         this_ptr_conv.inner = untag_ptr(this_ptr);
54146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54148         this_ptr_conv.is_owned = false;
54149         LDKECDSASignature val_ref;
54150         CHECK((*env)->GetArrayLength(env, val) == 64);
54151         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
54152         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
54153 }
54154
54155 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
54156         LDKChannelAnnouncement this_ptr_conv;
54157         this_ptr_conv.inner = untag_ptr(this_ptr);
54158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54160         this_ptr_conv.is_owned = false;
54161         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
54162         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
54163         return ret_arr;
54164 }
54165
54166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54167         LDKChannelAnnouncement this_ptr_conv;
54168         this_ptr_conv.inner = untag_ptr(this_ptr);
54169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54171         this_ptr_conv.is_owned = false;
54172         LDKECDSASignature val_ref;
54173         CHECK((*env)->GetArrayLength(env, val) == 64);
54174         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
54175         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
54176 }
54177
54178 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
54179         LDKChannelAnnouncement this_ptr_conv;
54180         this_ptr_conv.inner = untag_ptr(this_ptr);
54181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54183         this_ptr_conv.is_owned = false;
54184         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
54185         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
54186         return ret_arr;
54187 }
54188
54189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54190         LDKChannelAnnouncement this_ptr_conv;
54191         this_ptr_conv.inner = untag_ptr(this_ptr);
54192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54194         this_ptr_conv.is_owned = false;
54195         LDKECDSASignature val_ref;
54196         CHECK((*env)->GetArrayLength(env, val) == 64);
54197         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
54198         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
54199 }
54200
54201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
54202         LDKChannelAnnouncement this_ptr_conv;
54203         this_ptr_conv.inner = untag_ptr(this_ptr);
54204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54206         this_ptr_conv.is_owned = false;
54207         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
54208         int64_t ret_ref = 0;
54209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54211         return ret_ref;
54212 }
54213
54214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54215         LDKChannelAnnouncement this_ptr_conv;
54216         this_ptr_conv.inner = untag_ptr(this_ptr);
54217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54219         this_ptr_conv.is_owned = false;
54220         LDKUnsignedChannelAnnouncement val_conv;
54221         val_conv.inner = untag_ptr(val);
54222         val_conv.is_owned = ptr_is_owned(val);
54223         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54224         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
54225         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
54226 }
54227
54228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray node_signature_1_arg, int8_tArray node_signature_2_arg, int8_tArray bitcoin_signature_1_arg, int8_tArray bitcoin_signature_2_arg, int64_t contents_arg) {
54229         LDKECDSASignature node_signature_1_arg_ref;
54230         CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
54231         (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
54232         LDKECDSASignature node_signature_2_arg_ref;
54233         CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
54234         (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
54235         LDKECDSASignature bitcoin_signature_1_arg_ref;
54236         CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
54237         (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
54238         LDKECDSASignature bitcoin_signature_2_arg_ref;
54239         CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
54240         (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
54241         LDKUnsignedChannelAnnouncement contents_arg_conv;
54242         contents_arg_conv.inner = untag_ptr(contents_arg);
54243         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
54244         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
54245         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
54246         LDKChannelAnnouncement ret_var = ChannelAnnouncement_new(node_signature_1_arg_ref, node_signature_2_arg_ref, bitcoin_signature_1_arg_ref, bitcoin_signature_2_arg_ref, contents_arg_conv);
54247         int64_t ret_ref = 0;
54248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54250         return ret_ref;
54251 }
54252
54253 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
54254         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
54255         int64_t ret_ref = 0;
54256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54258         return ret_ref;
54259 }
54260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54261         LDKChannelAnnouncement arg_conv;
54262         arg_conv.inner = untag_ptr(arg);
54263         arg_conv.is_owned = ptr_is_owned(arg);
54264         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54265         arg_conv.is_owned = false;
54266         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
54267         return ret_conv;
54268 }
54269
54270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54271         LDKChannelAnnouncement orig_conv;
54272         orig_conv.inner = untag_ptr(orig);
54273         orig_conv.is_owned = ptr_is_owned(orig);
54274         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54275         orig_conv.is_owned = false;
54276         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
54277         int64_t ret_ref = 0;
54278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54280         return ret_ref;
54281 }
54282
54283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1hash(JNIEnv *env, jclass clz, int64_t o) {
54284         LDKChannelAnnouncement o_conv;
54285         o_conv.inner = untag_ptr(o);
54286         o_conv.is_owned = ptr_is_owned(o);
54287         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54288         o_conv.is_owned = false;
54289         int64_t ret_conv = ChannelAnnouncement_hash(&o_conv);
54290         return ret_conv;
54291 }
54292
54293 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54294         LDKChannelAnnouncement a_conv;
54295         a_conv.inner = untag_ptr(a);
54296         a_conv.is_owned = ptr_is_owned(a);
54297         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54298         a_conv.is_owned = false;
54299         LDKChannelAnnouncement b_conv;
54300         b_conv.inner = untag_ptr(b);
54301         b_conv.is_owned = ptr_is_owned(b);
54302         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54303         b_conv.is_owned = false;
54304         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
54305         return ret_conv;
54306 }
54307
54308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54309         LDKUnsignedChannelUpdate this_obj_conv;
54310         this_obj_conv.inner = untag_ptr(this_obj);
54311         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54313         UnsignedChannelUpdate_free(this_obj_conv);
54314 }
54315
54316 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
54317         LDKUnsignedChannelUpdate this_ptr_conv;
54318         this_ptr_conv.inner = untag_ptr(this_ptr);
54319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54321         this_ptr_conv.is_owned = false;
54322         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
54323         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
54324         return ret_arr;
54325 }
54326
54327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54328         LDKUnsignedChannelUpdate this_ptr_conv;
54329         this_ptr_conv.inner = untag_ptr(this_ptr);
54330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54332         this_ptr_conv.is_owned = false;
54333         LDKThirtyTwoBytes val_ref;
54334         CHECK((*env)->GetArrayLength(env, val) == 32);
54335         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
54336         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
54337 }
54338
54339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54340         LDKUnsignedChannelUpdate this_ptr_conv;
54341         this_ptr_conv.inner = untag_ptr(this_ptr);
54342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54344         this_ptr_conv.is_owned = false;
54345         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
54346         return ret_conv;
54347 }
54348
54349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54350         LDKUnsignedChannelUpdate this_ptr_conv;
54351         this_ptr_conv.inner = untag_ptr(this_ptr);
54352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54354         this_ptr_conv.is_owned = false;
54355         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
54356 }
54357
54358 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
54359         LDKUnsignedChannelUpdate this_ptr_conv;
54360         this_ptr_conv.inner = untag_ptr(this_ptr);
54361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54363         this_ptr_conv.is_owned = false;
54364         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
54365         return ret_conv;
54366 }
54367
54368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
54369         LDKUnsignedChannelUpdate this_ptr_conv;
54370         this_ptr_conv.inner = untag_ptr(this_ptr);
54371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54373         this_ptr_conv.is_owned = false;
54374         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
54375 }
54376
54377 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
54378         LDKUnsignedChannelUpdate this_ptr_conv;
54379         this_ptr_conv.inner = untag_ptr(this_ptr);
54380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54382         this_ptr_conv.is_owned = false;
54383         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
54384         return ret_conv;
54385 }
54386
54387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
54388         LDKUnsignedChannelUpdate this_ptr_conv;
54389         this_ptr_conv.inner = untag_ptr(this_ptr);
54390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54392         this_ptr_conv.is_owned = false;
54393         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
54394 }
54395
54396 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
54397         LDKUnsignedChannelUpdate this_ptr_conv;
54398         this_ptr_conv.inner = untag_ptr(this_ptr);
54399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54401         this_ptr_conv.is_owned = false;
54402         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
54403         return ret_conv;
54404 }
54405
54406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
54407         LDKUnsignedChannelUpdate this_ptr_conv;
54408         this_ptr_conv.inner = untag_ptr(this_ptr);
54409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54411         this_ptr_conv.is_owned = false;
54412         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
54413 }
54414
54415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
54416         LDKUnsignedChannelUpdate this_ptr_conv;
54417         this_ptr_conv.inner = untag_ptr(this_ptr);
54418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54420         this_ptr_conv.is_owned = false;
54421         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
54422         return ret_conv;
54423 }
54424
54425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54426         LDKUnsignedChannelUpdate this_ptr_conv;
54427         this_ptr_conv.inner = untag_ptr(this_ptr);
54428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54430         this_ptr_conv.is_owned = false;
54431         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
54432 }
54433
54434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
54435         LDKUnsignedChannelUpdate this_ptr_conv;
54436         this_ptr_conv.inner = untag_ptr(this_ptr);
54437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54439         this_ptr_conv.is_owned = false;
54440         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
54441         return ret_conv;
54442 }
54443
54444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54445         LDKUnsignedChannelUpdate this_ptr_conv;
54446         this_ptr_conv.inner = untag_ptr(this_ptr);
54447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54449         this_ptr_conv.is_owned = false;
54450         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
54451 }
54452
54453 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
54454         LDKUnsignedChannelUpdate this_ptr_conv;
54455         this_ptr_conv.inner = untag_ptr(this_ptr);
54456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54458         this_ptr_conv.is_owned = false;
54459         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
54460         return ret_conv;
54461 }
54462
54463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
54464         LDKUnsignedChannelUpdate this_ptr_conv;
54465         this_ptr_conv.inner = untag_ptr(this_ptr);
54466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54468         this_ptr_conv.is_owned = false;
54469         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
54470 }
54471
54472 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
54473         LDKUnsignedChannelUpdate this_ptr_conv;
54474         this_ptr_conv.inner = untag_ptr(this_ptr);
54475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54477         this_ptr_conv.is_owned = false;
54478         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
54479         return ret_conv;
54480 }
54481
54482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
54483         LDKUnsignedChannelUpdate this_ptr_conv;
54484         this_ptr_conv.inner = untag_ptr(this_ptr);
54485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54487         this_ptr_conv.is_owned = false;
54488         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
54489 }
54490
54491 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
54492         LDKUnsignedChannelUpdate this_ptr_conv;
54493         this_ptr_conv.inner = untag_ptr(this_ptr);
54494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54496         this_ptr_conv.is_owned = false;
54497         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
54498         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54499         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54500         CVec_u8Z_free(ret_var);
54501         return ret_arr;
54502 }
54503
54504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54505         LDKUnsignedChannelUpdate this_ptr_conv;
54506         this_ptr_conv.inner = untag_ptr(this_ptr);
54507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54509         this_ptr_conv.is_owned = false;
54510         LDKCVec_u8Z val_ref;
54511         val_ref.datalen = (*env)->GetArrayLength(env, val);
54512         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
54513         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
54514         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
54515 }
54516
54517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int64_t short_channel_id_arg, int32_t timestamp_arg, int8_t flags_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int8_tArray excess_data_arg) {
54518         LDKThirtyTwoBytes chain_hash_arg_ref;
54519         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
54520         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
54521         LDKCVec_u8Z excess_data_arg_ref;
54522         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
54523         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
54524         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
54525         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_new(chain_hash_arg_ref, short_channel_id_arg, timestamp_arg, flags_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fee_base_msat_arg, fee_proportional_millionths_arg, excess_data_arg_ref);
54526         int64_t ret_ref = 0;
54527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54529         return ret_ref;
54530 }
54531
54532 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
54533         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
54534         int64_t ret_ref = 0;
54535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54537         return ret_ref;
54538 }
54539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54540         LDKUnsignedChannelUpdate arg_conv;
54541         arg_conv.inner = untag_ptr(arg);
54542         arg_conv.is_owned = ptr_is_owned(arg);
54543         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54544         arg_conv.is_owned = false;
54545         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
54546         return ret_conv;
54547 }
54548
54549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54550         LDKUnsignedChannelUpdate orig_conv;
54551         orig_conv.inner = untag_ptr(orig);
54552         orig_conv.is_owned = ptr_is_owned(orig);
54553         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54554         orig_conv.is_owned = false;
54555         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
54556         int64_t ret_ref = 0;
54557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54559         return ret_ref;
54560 }
54561
54562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1hash(JNIEnv *env, jclass clz, int64_t o) {
54563         LDKUnsignedChannelUpdate o_conv;
54564         o_conv.inner = untag_ptr(o);
54565         o_conv.is_owned = ptr_is_owned(o);
54566         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54567         o_conv.is_owned = false;
54568         int64_t ret_conv = UnsignedChannelUpdate_hash(&o_conv);
54569         return ret_conv;
54570 }
54571
54572 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54573         LDKUnsignedChannelUpdate a_conv;
54574         a_conv.inner = untag_ptr(a);
54575         a_conv.is_owned = ptr_is_owned(a);
54576         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54577         a_conv.is_owned = false;
54578         LDKUnsignedChannelUpdate b_conv;
54579         b_conv.inner = untag_ptr(b);
54580         b_conv.is_owned = ptr_is_owned(b);
54581         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54582         b_conv.is_owned = false;
54583         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
54584         return ret_conv;
54585 }
54586
54587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54588         LDKChannelUpdate this_obj_conv;
54589         this_obj_conv.inner = untag_ptr(this_obj);
54590         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54592         ChannelUpdate_free(this_obj_conv);
54593 }
54594
54595 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
54596         LDKChannelUpdate this_ptr_conv;
54597         this_ptr_conv.inner = untag_ptr(this_ptr);
54598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54600         this_ptr_conv.is_owned = false;
54601         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
54602         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
54603         return ret_arr;
54604 }
54605
54606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54607         LDKChannelUpdate this_ptr_conv;
54608         this_ptr_conv.inner = untag_ptr(this_ptr);
54609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54611         this_ptr_conv.is_owned = false;
54612         LDKECDSASignature val_ref;
54613         CHECK((*env)->GetArrayLength(env, val) == 64);
54614         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
54615         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
54616 }
54617
54618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
54619         LDKChannelUpdate this_ptr_conv;
54620         this_ptr_conv.inner = untag_ptr(this_ptr);
54621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54623         this_ptr_conv.is_owned = false;
54624         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
54625         int64_t ret_ref = 0;
54626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54628         return ret_ref;
54629 }
54630
54631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54632         LDKChannelUpdate this_ptr_conv;
54633         this_ptr_conv.inner = untag_ptr(this_ptr);
54634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54636         this_ptr_conv.is_owned = false;
54637         LDKUnsignedChannelUpdate val_conv;
54638         val_conv.inner = untag_ptr(val);
54639         val_conv.is_owned = ptr_is_owned(val);
54640         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54641         val_conv = UnsignedChannelUpdate_clone(&val_conv);
54642         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
54643 }
54644
54645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
54646         LDKECDSASignature signature_arg_ref;
54647         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
54648         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
54649         LDKUnsignedChannelUpdate contents_arg_conv;
54650         contents_arg_conv.inner = untag_ptr(contents_arg);
54651         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
54652         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
54653         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
54654         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
54655         int64_t ret_ref = 0;
54656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54658         return ret_ref;
54659 }
54660
54661 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
54662         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
54663         int64_t ret_ref = 0;
54664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54666         return ret_ref;
54667 }
54668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54669         LDKChannelUpdate arg_conv;
54670         arg_conv.inner = untag_ptr(arg);
54671         arg_conv.is_owned = ptr_is_owned(arg);
54672         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54673         arg_conv.is_owned = false;
54674         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
54675         return ret_conv;
54676 }
54677
54678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54679         LDKChannelUpdate orig_conv;
54680         orig_conv.inner = untag_ptr(orig);
54681         orig_conv.is_owned = ptr_is_owned(orig);
54682         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54683         orig_conv.is_owned = false;
54684         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
54685         int64_t ret_ref = 0;
54686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54688         return ret_ref;
54689 }
54690
54691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1hash(JNIEnv *env, jclass clz, int64_t o) {
54692         LDKChannelUpdate o_conv;
54693         o_conv.inner = untag_ptr(o);
54694         o_conv.is_owned = ptr_is_owned(o);
54695         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54696         o_conv.is_owned = false;
54697         int64_t ret_conv = ChannelUpdate_hash(&o_conv);
54698         return ret_conv;
54699 }
54700
54701 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54702         LDKChannelUpdate a_conv;
54703         a_conv.inner = untag_ptr(a);
54704         a_conv.is_owned = ptr_is_owned(a);
54705         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54706         a_conv.is_owned = false;
54707         LDKChannelUpdate b_conv;
54708         b_conv.inner = untag_ptr(b);
54709         b_conv.is_owned = ptr_is_owned(b);
54710         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54711         b_conv.is_owned = false;
54712         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
54713         return ret_conv;
54714 }
54715
54716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54717         LDKQueryChannelRange this_obj_conv;
54718         this_obj_conv.inner = untag_ptr(this_obj);
54719         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54721         QueryChannelRange_free(this_obj_conv);
54722 }
54723
54724 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
54725         LDKQueryChannelRange this_ptr_conv;
54726         this_ptr_conv.inner = untag_ptr(this_ptr);
54727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54729         this_ptr_conv.is_owned = false;
54730         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
54731         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
54732         return ret_arr;
54733 }
54734
54735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54736         LDKQueryChannelRange this_ptr_conv;
54737         this_ptr_conv.inner = untag_ptr(this_ptr);
54738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54740         this_ptr_conv.is_owned = false;
54741         LDKThirtyTwoBytes val_ref;
54742         CHECK((*env)->GetArrayLength(env, val) == 32);
54743         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
54744         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
54745 }
54746
54747 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
54748         LDKQueryChannelRange this_ptr_conv;
54749         this_ptr_conv.inner = untag_ptr(this_ptr);
54750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54752         this_ptr_conv.is_owned = false;
54753         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
54754         return ret_conv;
54755 }
54756
54757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
54758         LDKQueryChannelRange this_ptr_conv;
54759         this_ptr_conv.inner = untag_ptr(this_ptr);
54760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54762         this_ptr_conv.is_owned = false;
54763         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
54764 }
54765
54766 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
54767         LDKQueryChannelRange this_ptr_conv;
54768         this_ptr_conv.inner = untag_ptr(this_ptr);
54769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54771         this_ptr_conv.is_owned = false;
54772         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
54773         return ret_conv;
54774 }
54775
54776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
54777         LDKQueryChannelRange this_ptr_conv;
54778         this_ptr_conv.inner = untag_ptr(this_ptr);
54779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54781         this_ptr_conv.is_owned = false;
54782         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
54783 }
54784
54785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
54786         LDKThirtyTwoBytes chain_hash_arg_ref;
54787         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
54788         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
54789         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
54790         int64_t ret_ref = 0;
54791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54793         return ret_ref;
54794 }
54795
54796 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
54797         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
54798         int64_t ret_ref = 0;
54799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54801         return ret_ref;
54802 }
54803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54804         LDKQueryChannelRange arg_conv;
54805         arg_conv.inner = untag_ptr(arg);
54806         arg_conv.is_owned = ptr_is_owned(arg);
54807         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54808         arg_conv.is_owned = false;
54809         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
54810         return ret_conv;
54811 }
54812
54813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54814         LDKQueryChannelRange orig_conv;
54815         orig_conv.inner = untag_ptr(orig);
54816         orig_conv.is_owned = ptr_is_owned(orig);
54817         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54818         orig_conv.is_owned = false;
54819         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
54820         int64_t ret_ref = 0;
54821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54823         return ret_ref;
54824 }
54825
54826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1hash(JNIEnv *env, jclass clz, int64_t o) {
54827         LDKQueryChannelRange o_conv;
54828         o_conv.inner = untag_ptr(o);
54829         o_conv.is_owned = ptr_is_owned(o);
54830         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54831         o_conv.is_owned = false;
54832         int64_t ret_conv = QueryChannelRange_hash(&o_conv);
54833         return ret_conv;
54834 }
54835
54836 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54837         LDKQueryChannelRange a_conv;
54838         a_conv.inner = untag_ptr(a);
54839         a_conv.is_owned = ptr_is_owned(a);
54840         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54841         a_conv.is_owned = false;
54842         LDKQueryChannelRange b_conv;
54843         b_conv.inner = untag_ptr(b);
54844         b_conv.is_owned = ptr_is_owned(b);
54845         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54846         b_conv.is_owned = false;
54847         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
54848         return ret_conv;
54849 }
54850
54851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54852         LDKReplyChannelRange this_obj_conv;
54853         this_obj_conv.inner = untag_ptr(this_obj);
54854         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54856         ReplyChannelRange_free(this_obj_conv);
54857 }
54858
54859 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
54860         LDKReplyChannelRange this_ptr_conv;
54861         this_ptr_conv.inner = untag_ptr(this_ptr);
54862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54864         this_ptr_conv.is_owned = false;
54865         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
54866         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
54867         return ret_arr;
54868 }
54869
54870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54871         LDKReplyChannelRange this_ptr_conv;
54872         this_ptr_conv.inner = untag_ptr(this_ptr);
54873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54875         this_ptr_conv.is_owned = false;
54876         LDKThirtyTwoBytes val_ref;
54877         CHECK((*env)->GetArrayLength(env, val) == 32);
54878         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
54879         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
54880 }
54881
54882 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
54883         LDKReplyChannelRange this_ptr_conv;
54884         this_ptr_conv.inner = untag_ptr(this_ptr);
54885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54887         this_ptr_conv.is_owned = false;
54888         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
54889         return ret_conv;
54890 }
54891
54892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
54893         LDKReplyChannelRange this_ptr_conv;
54894         this_ptr_conv.inner = untag_ptr(this_ptr);
54895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54897         this_ptr_conv.is_owned = false;
54898         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
54899 }
54900
54901 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
54902         LDKReplyChannelRange this_ptr_conv;
54903         this_ptr_conv.inner = untag_ptr(this_ptr);
54904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54906         this_ptr_conv.is_owned = false;
54907         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
54908         return ret_conv;
54909 }
54910
54911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
54912         LDKReplyChannelRange this_ptr_conv;
54913         this_ptr_conv.inner = untag_ptr(this_ptr);
54914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54916         this_ptr_conv.is_owned = false;
54917         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
54918 }
54919
54920 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
54921         LDKReplyChannelRange this_ptr_conv;
54922         this_ptr_conv.inner = untag_ptr(this_ptr);
54923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54925         this_ptr_conv.is_owned = false;
54926         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
54927         return ret_conv;
54928 }
54929
54930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
54931         LDKReplyChannelRange this_ptr_conv;
54932         this_ptr_conv.inner = untag_ptr(this_ptr);
54933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54935         this_ptr_conv.is_owned = false;
54936         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
54937 }
54938
54939 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
54940         LDKReplyChannelRange this_ptr_conv;
54941         this_ptr_conv.inner = untag_ptr(this_ptr);
54942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54944         this_ptr_conv.is_owned = false;
54945         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
54946         int64_tArray ret_arr = NULL;
54947         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
54948         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
54949         for (size_t g = 0; g < ret_var.datalen; g++) {
54950                 int64_t ret_conv_6_conv = ret_var.data[g];
54951                 ret_arr_ptr[g] = ret_conv_6_conv;
54952         }
54953         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
54954         FREE(ret_var.data);
54955         return ret_arr;
54956 }
54957
54958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
54959         LDKReplyChannelRange this_ptr_conv;
54960         this_ptr_conv.inner = untag_ptr(this_ptr);
54961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54963         this_ptr_conv.is_owned = false;
54964         LDKCVec_u64Z val_constr;
54965         val_constr.datalen = (*env)->GetArrayLength(env, val);
54966         if (val_constr.datalen > 0)
54967                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
54968         else
54969                 val_constr.data = NULL;
54970         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
54971         for (size_t g = 0; g < val_constr.datalen; g++) {
54972                 int64_t val_conv_6 = val_vals[g];
54973                 val_constr.data[g] = val_conv_6;
54974         }
54975         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
54976         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
54977 }
54978
54979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg, jboolean sync_complete_arg, int64_tArray short_channel_ids_arg) {
54980         LDKThirtyTwoBytes chain_hash_arg_ref;
54981         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
54982         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
54983         LDKCVec_u64Z short_channel_ids_arg_constr;
54984         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
54985         if (short_channel_ids_arg_constr.datalen > 0)
54986                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
54987         else
54988                 short_channel_ids_arg_constr.data = NULL;
54989         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
54990         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
54991                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
54992                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
54993         }
54994         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
54995         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
54996         int64_t ret_ref = 0;
54997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54999         return ret_ref;
55000 }
55001
55002 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
55003         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
55004         int64_t ret_ref = 0;
55005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55007         return ret_ref;
55008 }
55009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55010         LDKReplyChannelRange arg_conv;
55011         arg_conv.inner = untag_ptr(arg);
55012         arg_conv.is_owned = ptr_is_owned(arg);
55013         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55014         arg_conv.is_owned = false;
55015         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
55016         return ret_conv;
55017 }
55018
55019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55020         LDKReplyChannelRange orig_conv;
55021         orig_conv.inner = untag_ptr(orig);
55022         orig_conv.is_owned = ptr_is_owned(orig);
55023         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55024         orig_conv.is_owned = false;
55025         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
55026         int64_t ret_ref = 0;
55027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55029         return ret_ref;
55030 }
55031
55032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1hash(JNIEnv *env, jclass clz, int64_t o) {
55033         LDKReplyChannelRange o_conv;
55034         o_conv.inner = untag_ptr(o);
55035         o_conv.is_owned = ptr_is_owned(o);
55036         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55037         o_conv.is_owned = false;
55038         int64_t ret_conv = ReplyChannelRange_hash(&o_conv);
55039         return ret_conv;
55040 }
55041
55042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55043         LDKReplyChannelRange a_conv;
55044         a_conv.inner = untag_ptr(a);
55045         a_conv.is_owned = ptr_is_owned(a);
55046         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55047         a_conv.is_owned = false;
55048         LDKReplyChannelRange b_conv;
55049         b_conv.inner = untag_ptr(b);
55050         b_conv.is_owned = ptr_is_owned(b);
55051         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55052         b_conv.is_owned = false;
55053         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
55054         return ret_conv;
55055 }
55056
55057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55058         LDKQueryShortChannelIds this_obj_conv;
55059         this_obj_conv.inner = untag_ptr(this_obj);
55060         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55062         QueryShortChannelIds_free(this_obj_conv);
55063 }
55064
55065 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
55066         LDKQueryShortChannelIds this_ptr_conv;
55067         this_ptr_conv.inner = untag_ptr(this_ptr);
55068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55070         this_ptr_conv.is_owned = false;
55071         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
55072         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
55073         return ret_arr;
55074 }
55075
55076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
55077         LDKQueryShortChannelIds this_ptr_conv;
55078         this_ptr_conv.inner = untag_ptr(this_ptr);
55079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55081         this_ptr_conv.is_owned = false;
55082         LDKThirtyTwoBytes val_ref;
55083         CHECK((*env)->GetArrayLength(env, val) == 32);
55084         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
55085         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
55086 }
55087
55088 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
55089         LDKQueryShortChannelIds this_ptr_conv;
55090         this_ptr_conv.inner = untag_ptr(this_ptr);
55091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55093         this_ptr_conv.is_owned = false;
55094         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
55095         int64_tArray ret_arr = NULL;
55096         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
55097         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
55098         for (size_t g = 0; g < ret_var.datalen; g++) {
55099                 int64_t ret_conv_6_conv = ret_var.data[g];
55100                 ret_arr_ptr[g] = ret_conv_6_conv;
55101         }
55102         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
55103         FREE(ret_var.data);
55104         return ret_arr;
55105 }
55106
55107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
55108         LDKQueryShortChannelIds this_ptr_conv;
55109         this_ptr_conv.inner = untag_ptr(this_ptr);
55110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55112         this_ptr_conv.is_owned = false;
55113         LDKCVec_u64Z val_constr;
55114         val_constr.datalen = (*env)->GetArrayLength(env, val);
55115         if (val_constr.datalen > 0)
55116                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
55117         else
55118                 val_constr.data = NULL;
55119         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
55120         for (size_t g = 0; g < val_constr.datalen; g++) {
55121                 int64_t val_conv_6 = val_vals[g];
55122                 val_constr.data[g] = val_conv_6;
55123         }
55124         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
55125         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
55126 }
55127
55128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
55129         LDKThirtyTwoBytes chain_hash_arg_ref;
55130         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
55131         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
55132         LDKCVec_u64Z short_channel_ids_arg_constr;
55133         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
55134         if (short_channel_ids_arg_constr.datalen > 0)
55135                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
55136         else
55137                 short_channel_ids_arg_constr.data = NULL;
55138         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
55139         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
55140                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
55141                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
55142         }
55143         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
55144         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
55145         int64_t ret_ref = 0;
55146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55148         return ret_ref;
55149 }
55150
55151 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
55152         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
55153         int64_t ret_ref = 0;
55154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55156         return ret_ref;
55157 }
55158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55159         LDKQueryShortChannelIds arg_conv;
55160         arg_conv.inner = untag_ptr(arg);
55161         arg_conv.is_owned = ptr_is_owned(arg);
55162         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55163         arg_conv.is_owned = false;
55164         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
55165         return ret_conv;
55166 }
55167
55168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55169         LDKQueryShortChannelIds orig_conv;
55170         orig_conv.inner = untag_ptr(orig);
55171         orig_conv.is_owned = ptr_is_owned(orig);
55172         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55173         orig_conv.is_owned = false;
55174         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
55175         int64_t ret_ref = 0;
55176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55178         return ret_ref;
55179 }
55180
55181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1hash(JNIEnv *env, jclass clz, int64_t o) {
55182         LDKQueryShortChannelIds o_conv;
55183         o_conv.inner = untag_ptr(o);
55184         o_conv.is_owned = ptr_is_owned(o);
55185         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55186         o_conv.is_owned = false;
55187         int64_t ret_conv = QueryShortChannelIds_hash(&o_conv);
55188         return ret_conv;
55189 }
55190
55191 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55192         LDKQueryShortChannelIds a_conv;
55193         a_conv.inner = untag_ptr(a);
55194         a_conv.is_owned = ptr_is_owned(a);
55195         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55196         a_conv.is_owned = false;
55197         LDKQueryShortChannelIds b_conv;
55198         b_conv.inner = untag_ptr(b);
55199         b_conv.is_owned = ptr_is_owned(b);
55200         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55201         b_conv.is_owned = false;
55202         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
55203         return ret_conv;
55204 }
55205
55206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55207         LDKReplyShortChannelIdsEnd this_obj_conv;
55208         this_obj_conv.inner = untag_ptr(this_obj);
55209         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55211         ReplyShortChannelIdsEnd_free(this_obj_conv);
55212 }
55213
55214 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
55215         LDKReplyShortChannelIdsEnd this_ptr_conv;
55216         this_ptr_conv.inner = untag_ptr(this_ptr);
55217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55219         this_ptr_conv.is_owned = false;
55220         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
55221         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
55222         return ret_arr;
55223 }
55224
55225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
55226         LDKReplyShortChannelIdsEnd this_ptr_conv;
55227         this_ptr_conv.inner = untag_ptr(this_ptr);
55228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55230         this_ptr_conv.is_owned = false;
55231         LDKThirtyTwoBytes val_ref;
55232         CHECK((*env)->GetArrayLength(env, val) == 32);
55233         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
55234         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
55235 }
55236
55237 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
55238         LDKReplyShortChannelIdsEnd this_ptr_conv;
55239         this_ptr_conv.inner = untag_ptr(this_ptr);
55240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55242         this_ptr_conv.is_owned = false;
55243         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
55244         return ret_conv;
55245 }
55246
55247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
55248         LDKReplyShortChannelIdsEnd this_ptr_conv;
55249         this_ptr_conv.inner = untag_ptr(this_ptr);
55250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55252         this_ptr_conv.is_owned = false;
55253         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
55254 }
55255
55256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
55257         LDKThirtyTwoBytes chain_hash_arg_ref;
55258         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
55259         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
55260         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
55261         int64_t ret_ref = 0;
55262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55264         return ret_ref;
55265 }
55266
55267 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
55268         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
55269         int64_t ret_ref = 0;
55270         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55271         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55272         return ret_ref;
55273 }
55274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55275         LDKReplyShortChannelIdsEnd arg_conv;
55276         arg_conv.inner = untag_ptr(arg);
55277         arg_conv.is_owned = ptr_is_owned(arg);
55278         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55279         arg_conv.is_owned = false;
55280         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
55281         return ret_conv;
55282 }
55283
55284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55285         LDKReplyShortChannelIdsEnd orig_conv;
55286         orig_conv.inner = untag_ptr(orig);
55287         orig_conv.is_owned = ptr_is_owned(orig);
55288         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55289         orig_conv.is_owned = false;
55290         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
55291         int64_t ret_ref = 0;
55292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55294         return ret_ref;
55295 }
55296
55297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1hash(JNIEnv *env, jclass clz, int64_t o) {
55298         LDKReplyShortChannelIdsEnd o_conv;
55299         o_conv.inner = untag_ptr(o);
55300         o_conv.is_owned = ptr_is_owned(o);
55301         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55302         o_conv.is_owned = false;
55303         int64_t ret_conv = ReplyShortChannelIdsEnd_hash(&o_conv);
55304         return ret_conv;
55305 }
55306
55307 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55308         LDKReplyShortChannelIdsEnd a_conv;
55309         a_conv.inner = untag_ptr(a);
55310         a_conv.is_owned = ptr_is_owned(a);
55311         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55312         a_conv.is_owned = false;
55313         LDKReplyShortChannelIdsEnd b_conv;
55314         b_conv.inner = untag_ptr(b);
55315         b_conv.is_owned = ptr_is_owned(b);
55316         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55317         b_conv.is_owned = false;
55318         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
55319         return ret_conv;
55320 }
55321
55322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55323         LDKGossipTimestampFilter this_obj_conv;
55324         this_obj_conv.inner = untag_ptr(this_obj);
55325         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55327         GossipTimestampFilter_free(this_obj_conv);
55328 }
55329
55330 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
55331         LDKGossipTimestampFilter this_ptr_conv;
55332         this_ptr_conv.inner = untag_ptr(this_ptr);
55333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55335         this_ptr_conv.is_owned = false;
55336         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
55337         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
55338         return ret_arr;
55339 }
55340
55341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
55342         LDKGossipTimestampFilter this_ptr_conv;
55343         this_ptr_conv.inner = untag_ptr(this_ptr);
55344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55346         this_ptr_conv.is_owned = false;
55347         LDKThirtyTwoBytes val_ref;
55348         CHECK((*env)->GetArrayLength(env, val) == 32);
55349         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
55350         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
55351 }
55352
55353 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
55354         LDKGossipTimestampFilter this_ptr_conv;
55355         this_ptr_conv.inner = untag_ptr(this_ptr);
55356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55358         this_ptr_conv.is_owned = false;
55359         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
55360         return ret_conv;
55361 }
55362
55363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
55364         LDKGossipTimestampFilter this_ptr_conv;
55365         this_ptr_conv.inner = untag_ptr(this_ptr);
55366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55368         this_ptr_conv.is_owned = false;
55369         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
55370 }
55371
55372 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
55373         LDKGossipTimestampFilter this_ptr_conv;
55374         this_ptr_conv.inner = untag_ptr(this_ptr);
55375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55377         this_ptr_conv.is_owned = false;
55378         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
55379         return ret_conv;
55380 }
55381
55382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
55383         LDKGossipTimestampFilter this_ptr_conv;
55384         this_ptr_conv.inner = untag_ptr(this_ptr);
55385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55387         this_ptr_conv.is_owned = false;
55388         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
55389 }
55390
55391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
55392         LDKThirtyTwoBytes chain_hash_arg_ref;
55393         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
55394         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
55395         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
55396         int64_t ret_ref = 0;
55397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55399         return ret_ref;
55400 }
55401
55402 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
55403         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
55404         int64_t ret_ref = 0;
55405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55407         return ret_ref;
55408 }
55409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55410         LDKGossipTimestampFilter arg_conv;
55411         arg_conv.inner = untag_ptr(arg);
55412         arg_conv.is_owned = ptr_is_owned(arg);
55413         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55414         arg_conv.is_owned = false;
55415         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
55416         return ret_conv;
55417 }
55418
55419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55420         LDKGossipTimestampFilter orig_conv;
55421         orig_conv.inner = untag_ptr(orig);
55422         orig_conv.is_owned = ptr_is_owned(orig);
55423         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55424         orig_conv.is_owned = false;
55425         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
55426         int64_t ret_ref = 0;
55427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55429         return ret_ref;
55430 }
55431
55432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1hash(JNIEnv *env, jclass clz, int64_t o) {
55433         LDKGossipTimestampFilter o_conv;
55434         o_conv.inner = untag_ptr(o);
55435         o_conv.is_owned = ptr_is_owned(o);
55436         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55437         o_conv.is_owned = false;
55438         int64_t ret_conv = GossipTimestampFilter_hash(&o_conv);
55439         return ret_conv;
55440 }
55441
55442 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55443         LDKGossipTimestampFilter a_conv;
55444         a_conv.inner = untag_ptr(a);
55445         a_conv.is_owned = ptr_is_owned(a);
55446         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55447         a_conv.is_owned = false;
55448         LDKGossipTimestampFilter b_conv;
55449         b_conv.inner = untag_ptr(b);
55450         b_conv.is_owned = ptr_is_owned(b);
55451         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55452         b_conv.is_owned = false;
55453         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
55454         return ret_conv;
55455 }
55456
55457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
55458         if (!ptr_is_owned(this_ptr)) return;
55459         void* this_ptr_ptr = untag_ptr(this_ptr);
55460         CHECK_ACCESS(this_ptr_ptr);
55461         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
55462         FREE(untag_ptr(this_ptr));
55463         ErrorAction_free(this_ptr_conv);
55464 }
55465
55466 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
55467         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55468         *ret_copy = ErrorAction_clone(arg);
55469         int64_t ret_ref = tag_ptr(ret_copy, true);
55470         return ret_ref;
55471 }
55472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55473         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
55474         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
55475         return ret_conv;
55476 }
55477
55478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55479         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
55480         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55481         *ret_copy = ErrorAction_clone(orig_conv);
55482         int64_t ret_ref = tag_ptr(ret_copy, true);
55483         return ret_ref;
55484 }
55485
55486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
55487         LDKErrorMessage msg_conv;
55488         msg_conv.inner = untag_ptr(msg);
55489         msg_conv.is_owned = ptr_is_owned(msg);
55490         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
55491         msg_conv = ErrorMessage_clone(&msg_conv);
55492         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55493         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
55494         int64_t ret_ref = tag_ptr(ret_copy, true);
55495         return ret_ref;
55496 }
55497
55498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer_1with_1warning(JNIEnv *env, jclass clz, int64_t msg) {
55499         LDKWarningMessage msg_conv;
55500         msg_conv.inner = untag_ptr(msg);
55501         msg_conv.is_owned = ptr_is_owned(msg);
55502         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
55503         msg_conv = WarningMessage_clone(&msg_conv);
55504         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55505         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
55506         int64_t ret_ref = tag_ptr(ret_copy, true);
55507         return ret_ref;
55508 }
55509
55510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
55511         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55512         *ret_copy = ErrorAction_ignore_error();
55513         int64_t ret_ref = tag_ptr(ret_copy, true);
55514         return ret_ref;
55515 }
55516
55517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
55518         LDKLevel a_conv = LDKLevel_from_java(env, a);
55519         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55520         *ret_copy = ErrorAction_ignore_and_log(a_conv);
55521         int64_t ret_ref = tag_ptr(ret_copy, true);
55522         return ret_ref;
55523 }
55524
55525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
55526         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55527         *ret_copy = ErrorAction_ignore_duplicate_gossip();
55528         int64_t ret_ref = tag_ptr(ret_copy, true);
55529         return ret_ref;
55530 }
55531
55532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
55533         LDKErrorMessage msg_conv;
55534         msg_conv.inner = untag_ptr(msg);
55535         msg_conv.is_owned = ptr_is_owned(msg);
55536         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
55537         msg_conv = ErrorMessage_clone(&msg_conv);
55538         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55539         *ret_copy = ErrorAction_send_error_message(msg_conv);
55540         int64_t ret_ref = tag_ptr(ret_copy, true);
55541         return ret_ref;
55542 }
55543
55544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
55545         LDKWarningMessage msg_conv;
55546         msg_conv.inner = untag_ptr(msg);
55547         msg_conv.is_owned = ptr_is_owned(msg);
55548         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
55549         msg_conv = WarningMessage_clone(&msg_conv);
55550         LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
55551         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55552         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
55553         int64_t ret_ref = tag_ptr(ret_copy, true);
55554         return ret_ref;
55555 }
55556
55557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1hash(JNIEnv *env, jclass clz, int64_t o) {
55558         LDKErrorAction* o_conv = (LDKErrorAction*)untag_ptr(o);
55559         int64_t ret_conv = ErrorAction_hash(o_conv);
55560         return ret_conv;
55561 }
55562
55563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55564         LDKLightningError this_obj_conv;
55565         this_obj_conv.inner = untag_ptr(this_obj);
55566         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55568         LightningError_free(this_obj_conv);
55569 }
55570
55571 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
55572         LDKLightningError this_ptr_conv;
55573         this_ptr_conv.inner = untag_ptr(this_ptr);
55574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55576         this_ptr_conv.is_owned = false;
55577         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
55578         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
55579         Str_free(ret_str);
55580         return ret_conv;
55581 }
55582
55583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
55584         LDKLightningError this_ptr_conv;
55585         this_ptr_conv.inner = untag_ptr(this_ptr);
55586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55588         this_ptr_conv.is_owned = false;
55589         LDKStr val_conv = java_to_owned_str(env, val);
55590         LightningError_set_err(&this_ptr_conv, val_conv);
55591 }
55592
55593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
55594         LDKLightningError this_ptr_conv;
55595         this_ptr_conv.inner = untag_ptr(this_ptr);
55596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55598         this_ptr_conv.is_owned = false;
55599         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55600         *ret_copy = LightningError_get_action(&this_ptr_conv);
55601         int64_t ret_ref = tag_ptr(ret_copy, true);
55602         return ret_ref;
55603 }
55604
55605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55606         LDKLightningError this_ptr_conv;
55607         this_ptr_conv.inner = untag_ptr(this_ptr);
55608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55610         this_ptr_conv.is_owned = false;
55611         void* val_ptr = untag_ptr(val);
55612         CHECK_ACCESS(val_ptr);
55613         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
55614         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
55615         LightningError_set_action(&this_ptr_conv, val_conv);
55616 }
55617
55618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
55619         LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
55620         void* action_arg_ptr = untag_ptr(action_arg);
55621         CHECK_ACCESS(action_arg_ptr);
55622         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
55623         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
55624         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
55625         int64_t ret_ref = 0;
55626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55628         return ret_ref;
55629 }
55630
55631 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
55632         LDKLightningError ret_var = LightningError_clone(arg);
55633         int64_t ret_ref = 0;
55634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55636         return ret_ref;
55637 }
55638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55639         LDKLightningError arg_conv;
55640         arg_conv.inner = untag_ptr(arg);
55641         arg_conv.is_owned = ptr_is_owned(arg);
55642         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55643         arg_conv.is_owned = false;
55644         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
55645         return ret_conv;
55646 }
55647
55648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55649         LDKLightningError orig_conv;
55650         orig_conv.inner = untag_ptr(orig);
55651         orig_conv.is_owned = ptr_is_owned(orig);
55652         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55653         orig_conv.is_owned = false;
55654         LDKLightningError ret_var = LightningError_clone(&orig_conv);
55655         int64_t ret_ref = 0;
55656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55658         return ret_ref;
55659 }
55660
55661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55662         LDKCommitmentUpdate this_obj_conv;
55663         this_obj_conv.inner = untag_ptr(this_obj);
55664         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55666         CommitmentUpdate_free(this_obj_conv);
55667 }
55668
55669 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
55670         LDKCommitmentUpdate this_ptr_conv;
55671         this_ptr_conv.inner = untag_ptr(this_ptr);
55672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55674         this_ptr_conv.is_owned = false;
55675         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
55676         int64_tArray ret_arr = NULL;
55677         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
55678         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
55679         for (size_t p = 0; p < ret_var.datalen; p++) {
55680                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
55681                 int64_t ret_conv_15_ref = 0;
55682                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
55683                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
55684                 ret_arr_ptr[p] = ret_conv_15_ref;
55685         }
55686         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
55687         FREE(ret_var.data);
55688         return ret_arr;
55689 }
55690
55691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
55692         LDKCommitmentUpdate this_ptr_conv;
55693         this_ptr_conv.inner = untag_ptr(this_ptr);
55694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55696         this_ptr_conv.is_owned = false;
55697         LDKCVec_UpdateAddHTLCZ val_constr;
55698         val_constr.datalen = (*env)->GetArrayLength(env, val);
55699         if (val_constr.datalen > 0)
55700                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
55701         else
55702                 val_constr.data = NULL;
55703         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
55704         for (size_t p = 0; p < val_constr.datalen; p++) {
55705                 int64_t val_conv_15 = val_vals[p];
55706                 LDKUpdateAddHTLC val_conv_15_conv;
55707                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
55708                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
55709                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
55710                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
55711                 val_constr.data[p] = val_conv_15_conv;
55712         }
55713         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
55714         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
55715 }
55716
55717 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
55718         LDKCommitmentUpdate this_ptr_conv;
55719         this_ptr_conv.inner = untag_ptr(this_ptr);
55720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55722         this_ptr_conv.is_owned = false;
55723         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
55724         int64_tArray ret_arr = NULL;
55725         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
55726         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
55727         for (size_t t = 0; t < ret_var.datalen; t++) {
55728                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
55729                 int64_t ret_conv_19_ref = 0;
55730                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
55731                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
55732                 ret_arr_ptr[t] = ret_conv_19_ref;
55733         }
55734         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
55735         FREE(ret_var.data);
55736         return ret_arr;
55737 }
55738
55739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
55740         LDKCommitmentUpdate this_ptr_conv;
55741         this_ptr_conv.inner = untag_ptr(this_ptr);
55742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55744         this_ptr_conv.is_owned = false;
55745         LDKCVec_UpdateFulfillHTLCZ val_constr;
55746         val_constr.datalen = (*env)->GetArrayLength(env, val);
55747         if (val_constr.datalen > 0)
55748                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
55749         else
55750                 val_constr.data = NULL;
55751         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
55752         for (size_t t = 0; t < val_constr.datalen; t++) {
55753                 int64_t val_conv_19 = val_vals[t];
55754                 LDKUpdateFulfillHTLC val_conv_19_conv;
55755                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
55756                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
55757                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
55758                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
55759                 val_constr.data[t] = val_conv_19_conv;
55760         }
55761         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
55762         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
55763 }
55764
55765 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
55766         LDKCommitmentUpdate this_ptr_conv;
55767         this_ptr_conv.inner = untag_ptr(this_ptr);
55768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55770         this_ptr_conv.is_owned = false;
55771         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
55772         int64_tArray ret_arr = NULL;
55773         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
55774         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
55775         for (size_t q = 0; q < ret_var.datalen; q++) {
55776                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
55777                 int64_t ret_conv_16_ref = 0;
55778                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
55779                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
55780                 ret_arr_ptr[q] = ret_conv_16_ref;
55781         }
55782         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
55783         FREE(ret_var.data);
55784         return ret_arr;
55785 }
55786
55787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
55788         LDKCommitmentUpdate this_ptr_conv;
55789         this_ptr_conv.inner = untag_ptr(this_ptr);
55790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55792         this_ptr_conv.is_owned = false;
55793         LDKCVec_UpdateFailHTLCZ val_constr;
55794         val_constr.datalen = (*env)->GetArrayLength(env, val);
55795         if (val_constr.datalen > 0)
55796                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
55797         else
55798                 val_constr.data = NULL;
55799         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
55800         for (size_t q = 0; q < val_constr.datalen; q++) {
55801                 int64_t val_conv_16 = val_vals[q];
55802                 LDKUpdateFailHTLC val_conv_16_conv;
55803                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
55804                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
55805                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
55806                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
55807                 val_constr.data[q] = val_conv_16_conv;
55808         }
55809         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
55810         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
55811 }
55812
55813 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
55814         LDKCommitmentUpdate this_ptr_conv;
55815         this_ptr_conv.inner = untag_ptr(this_ptr);
55816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55818         this_ptr_conv.is_owned = false;
55819         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
55820         int64_tArray ret_arr = NULL;
55821         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
55822         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
55823         for (size_t z = 0; z < ret_var.datalen; z++) {
55824                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
55825                 int64_t ret_conv_25_ref = 0;
55826                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
55827                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
55828                 ret_arr_ptr[z] = ret_conv_25_ref;
55829         }
55830         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
55831         FREE(ret_var.data);
55832         return ret_arr;
55833 }
55834
55835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
55836         LDKCommitmentUpdate this_ptr_conv;
55837         this_ptr_conv.inner = untag_ptr(this_ptr);
55838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55840         this_ptr_conv.is_owned = false;
55841         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
55842         val_constr.datalen = (*env)->GetArrayLength(env, val);
55843         if (val_constr.datalen > 0)
55844                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
55845         else
55846                 val_constr.data = NULL;
55847         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
55848         for (size_t z = 0; z < val_constr.datalen; z++) {
55849                 int64_t val_conv_25 = val_vals[z];
55850                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
55851                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
55852                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
55853                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
55854                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
55855                 val_constr.data[z] = val_conv_25_conv;
55856         }
55857         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
55858         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
55859 }
55860
55861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
55862         LDKCommitmentUpdate this_ptr_conv;
55863         this_ptr_conv.inner = untag_ptr(this_ptr);
55864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55866         this_ptr_conv.is_owned = false;
55867         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
55868         int64_t ret_ref = 0;
55869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55871         return ret_ref;
55872 }
55873
55874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55875         LDKCommitmentUpdate this_ptr_conv;
55876         this_ptr_conv.inner = untag_ptr(this_ptr);
55877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55879         this_ptr_conv.is_owned = false;
55880         LDKUpdateFee val_conv;
55881         val_conv.inner = untag_ptr(val);
55882         val_conv.is_owned = ptr_is_owned(val);
55883         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55884         val_conv = UpdateFee_clone(&val_conv);
55885         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
55886 }
55887
55888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
55889         LDKCommitmentUpdate this_ptr_conv;
55890         this_ptr_conv.inner = untag_ptr(this_ptr);
55891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55893         this_ptr_conv.is_owned = false;
55894         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
55895         int64_t ret_ref = 0;
55896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55898         return ret_ref;
55899 }
55900
55901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55902         LDKCommitmentUpdate this_ptr_conv;
55903         this_ptr_conv.inner = untag_ptr(this_ptr);
55904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55906         this_ptr_conv.is_owned = false;
55907         LDKCommitmentSigned val_conv;
55908         val_conv.inner = untag_ptr(val);
55909         val_conv.is_owned = ptr_is_owned(val);
55910         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55911         val_conv = CommitmentSigned_clone(&val_conv);
55912         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
55913 }
55914
55915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1new(JNIEnv *env, jclass clz, int64_tArray update_add_htlcs_arg, int64_tArray update_fulfill_htlcs_arg, int64_tArray update_fail_htlcs_arg, int64_tArray update_fail_malformed_htlcs_arg, int64_t update_fee_arg, int64_t commitment_signed_arg) {
55916         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
55917         update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
55918         if (update_add_htlcs_arg_constr.datalen > 0)
55919                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
55920         else
55921                 update_add_htlcs_arg_constr.data = NULL;
55922         int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
55923         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
55924                 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
55925                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
55926                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
55927                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
55928                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
55929                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
55930                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
55931         }
55932         (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
55933         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
55934         update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
55935         if (update_fulfill_htlcs_arg_constr.datalen > 0)
55936                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
55937         else
55938                 update_fulfill_htlcs_arg_constr.data = NULL;
55939         int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
55940         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
55941                 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
55942                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
55943                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
55944                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
55945                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
55946                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
55947                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
55948         }
55949         (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
55950         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
55951         update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
55952         if (update_fail_htlcs_arg_constr.datalen > 0)
55953                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
55954         else
55955                 update_fail_htlcs_arg_constr.data = NULL;
55956         int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
55957         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
55958                 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
55959                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
55960                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
55961                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
55962                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
55963                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
55964                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
55965         }
55966         (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
55967         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
55968         update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
55969         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
55970                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
55971         else
55972                 update_fail_malformed_htlcs_arg_constr.data = NULL;
55973         int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
55974         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
55975                 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
55976                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
55977                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
55978                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
55979                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
55980                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
55981                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
55982         }
55983         (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
55984         LDKUpdateFee update_fee_arg_conv;
55985         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
55986         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
55987         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
55988         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
55989         LDKCommitmentSigned commitment_signed_arg_conv;
55990         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
55991         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
55992         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
55993         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
55994         LDKCommitmentUpdate ret_var = CommitmentUpdate_new(update_add_htlcs_arg_constr, update_fulfill_htlcs_arg_constr, update_fail_htlcs_arg_constr, update_fail_malformed_htlcs_arg_constr, update_fee_arg_conv, commitment_signed_arg_conv);
55995         int64_t ret_ref = 0;
55996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55998         return ret_ref;
55999 }
56000
56001 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
56002         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
56003         int64_t ret_ref = 0;
56004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56006         return ret_ref;
56007 }
56008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56009         LDKCommitmentUpdate arg_conv;
56010         arg_conv.inner = untag_ptr(arg);
56011         arg_conv.is_owned = ptr_is_owned(arg);
56012         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56013         arg_conv.is_owned = false;
56014         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
56015         return ret_conv;
56016 }
56017
56018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56019         LDKCommitmentUpdate orig_conv;
56020         orig_conv.inner = untag_ptr(orig);
56021         orig_conv.is_owned = ptr_is_owned(orig);
56022         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56023         orig_conv.is_owned = false;
56024         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
56025         int64_t ret_ref = 0;
56026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56028         return ret_ref;
56029 }
56030
56031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1hash(JNIEnv *env, jclass clz, int64_t o) {
56032         LDKCommitmentUpdate o_conv;
56033         o_conv.inner = untag_ptr(o);
56034         o_conv.is_owned = ptr_is_owned(o);
56035         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56036         o_conv.is_owned = false;
56037         int64_t ret_conv = CommitmentUpdate_hash(&o_conv);
56038         return ret_conv;
56039 }
56040
56041 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56042         LDKCommitmentUpdate a_conv;
56043         a_conv.inner = untag_ptr(a);
56044         a_conv.is_owned = ptr_is_owned(a);
56045         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56046         a_conv.is_owned = false;
56047         LDKCommitmentUpdate b_conv;
56048         b_conv.inner = untag_ptr(b);
56049         b_conv.is_owned = ptr_is_owned(b);
56050         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56051         b_conv.is_owned = false;
56052         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
56053         return ret_conv;
56054 }
56055
56056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
56057         if (!ptr_is_owned(this_ptr)) return;
56058         void* this_ptr_ptr = untag_ptr(this_ptr);
56059         CHECK_ACCESS(this_ptr_ptr);
56060         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
56061         FREE(untag_ptr(this_ptr));
56062         ChannelMessageHandler_free(this_ptr_conv);
56063 }
56064
56065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
56066         if (!ptr_is_owned(this_ptr)) return;
56067         void* this_ptr_ptr = untag_ptr(this_ptr);
56068         CHECK_ACCESS(this_ptr_ptr);
56069         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
56070         FREE(untag_ptr(this_ptr));
56071         RoutingMessageHandler_free(this_ptr_conv);
56072 }
56073
56074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
56075         if (!ptr_is_owned(this_ptr)) return;
56076         void* this_ptr_ptr = untag_ptr(this_ptr);
56077         CHECK_ACCESS(this_ptr_ptr);
56078         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
56079         FREE(untag_ptr(this_ptr));
56080         OnionMessageHandler_free(this_ptr_conv);
56081 }
56082
56083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56084         LDKFinalOnionHopData this_obj_conv;
56085         this_obj_conv.inner = untag_ptr(this_obj);
56086         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56088         FinalOnionHopData_free(this_obj_conv);
56089 }
56090
56091 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
56092         LDKFinalOnionHopData this_ptr_conv;
56093         this_ptr_conv.inner = untag_ptr(this_ptr);
56094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56096         this_ptr_conv.is_owned = false;
56097         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
56098         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FinalOnionHopData_get_payment_secret(&this_ptr_conv));
56099         return ret_arr;
56100 }
56101
56102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
56103         LDKFinalOnionHopData this_ptr_conv;
56104         this_ptr_conv.inner = untag_ptr(this_ptr);
56105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56107         this_ptr_conv.is_owned = false;
56108         LDKThirtyTwoBytes val_ref;
56109         CHECK((*env)->GetArrayLength(env, val) == 32);
56110         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
56111         FinalOnionHopData_set_payment_secret(&this_ptr_conv, val_ref);
56112 }
56113
56114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1get_1total_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
56115         LDKFinalOnionHopData this_ptr_conv;
56116         this_ptr_conv.inner = untag_ptr(this_ptr);
56117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56119         this_ptr_conv.is_owned = false;
56120         int64_t ret_conv = FinalOnionHopData_get_total_msat(&this_ptr_conv);
56121         return ret_conv;
56122 }
56123
56124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1set_1total_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56125         LDKFinalOnionHopData this_ptr_conv;
56126         this_ptr_conv.inner = untag_ptr(this_ptr);
56127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56129         this_ptr_conv.is_owned = false;
56130         FinalOnionHopData_set_total_msat(&this_ptr_conv, val);
56131 }
56132
56133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1new(JNIEnv *env, jclass clz, int8_tArray payment_secret_arg, int64_t total_msat_arg) {
56134         LDKThirtyTwoBytes payment_secret_arg_ref;
56135         CHECK((*env)->GetArrayLength(env, payment_secret_arg) == 32);
56136         (*env)->GetByteArrayRegion(env, payment_secret_arg, 0, 32, payment_secret_arg_ref.data);
56137         LDKFinalOnionHopData ret_var = FinalOnionHopData_new(payment_secret_arg_ref, total_msat_arg);
56138         int64_t ret_ref = 0;
56139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56141         return ret_ref;
56142 }
56143
56144 static inline uint64_t FinalOnionHopData_clone_ptr(LDKFinalOnionHopData *NONNULL_PTR arg) {
56145         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(arg);
56146         int64_t ret_ref = 0;
56147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56149         return ret_ref;
56150 }
56151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56152         LDKFinalOnionHopData arg_conv;
56153         arg_conv.inner = untag_ptr(arg);
56154         arg_conv.is_owned = ptr_is_owned(arg);
56155         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56156         arg_conv.is_owned = false;
56157         int64_t ret_conv = FinalOnionHopData_clone_ptr(&arg_conv);
56158         return ret_conv;
56159 }
56160
56161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56162         LDKFinalOnionHopData orig_conv;
56163         orig_conv.inner = untag_ptr(orig);
56164         orig_conv.is_owned = ptr_is_owned(orig);
56165         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56166         orig_conv.is_owned = false;
56167         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(&orig_conv);
56168         int64_t ret_ref = 0;
56169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56171         return ret_ref;
56172 }
56173
56174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionPacket_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56175         LDKOnionPacket this_obj_conv;
56176         this_obj_conv.inner = untag_ptr(this_obj);
56177         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56179         OnionPacket_free(this_obj_conv);
56180 }
56181
56182 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1get_1version(JNIEnv *env, jclass clz, int64_t this_ptr) {
56183         LDKOnionPacket this_ptr_conv;
56184         this_ptr_conv.inner = untag_ptr(this_ptr);
56185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56187         this_ptr_conv.is_owned = false;
56188         int8_t ret_conv = OnionPacket_get_version(&this_ptr_conv);
56189         return ret_conv;
56190 }
56191
56192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionPacket_1set_1version(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
56193         LDKOnionPacket this_ptr_conv;
56194         this_ptr_conv.inner = untag_ptr(this_ptr);
56195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56197         this_ptr_conv.is_owned = false;
56198         OnionPacket_set_version(&this_ptr_conv, val);
56199 }
56200
56201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1get_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
56202         LDKOnionPacket this_ptr_conv;
56203         this_ptr_conv.inner = untag_ptr(this_ptr);
56204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56206         this_ptr_conv.is_owned = false;
56207         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
56208         *ret_conv = OnionPacket_get_public_key(&this_ptr_conv);
56209         return tag_ptr(ret_conv, true);
56210 }
56211
56212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionPacket_1set_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56213         LDKOnionPacket this_ptr_conv;
56214         this_ptr_conv.inner = untag_ptr(this_ptr);
56215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56217         this_ptr_conv.is_owned = false;
56218         void* val_ptr = untag_ptr(val);
56219         CHECK_ACCESS(val_ptr);
56220         LDKCResult_PublicKeySecp256k1ErrorZ val_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(val_ptr);
56221         val_conv = CResult_PublicKeySecp256k1ErrorZ_clone((LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(val));
56222         OnionPacket_set_public_key(&this_ptr_conv, val_conv);
56223 }
56224
56225 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionPacket_1get_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr) {
56226         LDKOnionPacket this_ptr_conv;
56227         this_ptr_conv.inner = untag_ptr(this_ptr);
56228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56230         this_ptr_conv.is_owned = false;
56231         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
56232         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OnionPacket_get_hmac(&this_ptr_conv));
56233         return ret_arr;
56234 }
56235
56236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionPacket_1set_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
56237         LDKOnionPacket this_ptr_conv;
56238         this_ptr_conv.inner = untag_ptr(this_ptr);
56239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56241         this_ptr_conv.is_owned = false;
56242         LDKThirtyTwoBytes val_ref;
56243         CHECK((*env)->GetArrayLength(env, val) == 32);
56244         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
56245         OnionPacket_set_hmac(&this_ptr_conv, val_ref);
56246 }
56247
56248 static inline uint64_t OnionPacket_clone_ptr(LDKOnionPacket *NONNULL_PTR arg) {
56249         LDKOnionPacket ret_var = OnionPacket_clone(arg);
56250         int64_t ret_ref = 0;
56251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56253         return ret_ref;
56254 }
56255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56256         LDKOnionPacket arg_conv;
56257         arg_conv.inner = untag_ptr(arg);
56258         arg_conv.is_owned = ptr_is_owned(arg);
56259         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56260         arg_conv.is_owned = false;
56261         int64_t ret_conv = OnionPacket_clone_ptr(&arg_conv);
56262         return ret_conv;
56263 }
56264
56265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56266         LDKOnionPacket orig_conv;
56267         orig_conv.inner = untag_ptr(orig);
56268         orig_conv.is_owned = ptr_is_owned(orig);
56269         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56270         orig_conv.is_owned = false;
56271         LDKOnionPacket ret_var = OnionPacket_clone(&orig_conv);
56272         int64_t ret_ref = 0;
56273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56275         return ret_ref;
56276 }
56277
56278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1hash(JNIEnv *env, jclass clz, int64_t o) {
56279         LDKOnionPacket o_conv;
56280         o_conv.inner = untag_ptr(o);
56281         o_conv.is_owned = ptr_is_owned(o);
56282         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56283         o_conv.is_owned = false;
56284         int64_t ret_conv = OnionPacket_hash(&o_conv);
56285         return ret_conv;
56286 }
56287
56288 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OnionPacket_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56289         LDKOnionPacket a_conv;
56290         a_conv.inner = untag_ptr(a);
56291         a_conv.is_owned = ptr_is_owned(a);
56292         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56293         a_conv.is_owned = false;
56294         LDKOnionPacket b_conv;
56295         b_conv.inner = untag_ptr(b);
56296         b_conv.is_owned = ptr_is_owned(b);
56297         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56298         b_conv.is_owned = false;
56299         jboolean ret_conv = OnionPacket_eq(&a_conv, &b_conv);
56300         return ret_conv;
56301 }
56302
56303 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
56304         LDKAcceptChannel obj_conv;
56305         obj_conv.inner = untag_ptr(obj);
56306         obj_conv.is_owned = ptr_is_owned(obj);
56307         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56308         obj_conv.is_owned = false;
56309         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
56310         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56311         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56312         CVec_u8Z_free(ret_var);
56313         return ret_arr;
56314 }
56315
56316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56317         LDKu8slice ser_ref;
56318         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56319         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56320         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
56321         *ret_conv = AcceptChannel_read(ser_ref);
56322         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56323         return tag_ptr(ret_conv, true);
56324 }
56325
56326 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1write(JNIEnv *env, jclass clz, int64_t obj) {
56327         LDKAcceptChannelV2 obj_conv;
56328         obj_conv.inner = untag_ptr(obj);
56329         obj_conv.is_owned = ptr_is_owned(obj);
56330         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56331         obj_conv.is_owned = false;
56332         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
56333         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56334         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56335         CVec_u8Z_free(ret_var);
56336         return ret_arr;
56337 }
56338
56339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56340         LDKu8slice ser_ref;
56341         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56342         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56343         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
56344         *ret_conv = AcceptChannelV2_read(ser_ref);
56345         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56346         return tag_ptr(ret_conv, true);
56347 }
56348
56349 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Stfu_1write(JNIEnv *env, jclass clz, int64_t obj) {
56350         LDKStfu obj_conv;
56351         obj_conv.inner = untag_ptr(obj);
56352         obj_conv.is_owned = ptr_is_owned(obj);
56353         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56354         obj_conv.is_owned = false;
56355         LDKCVec_u8Z ret_var = Stfu_write(&obj_conv);
56356         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56357         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56358         CVec_u8Z_free(ret_var);
56359         return ret_arr;
56360 }
56361
56362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Stfu_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56363         LDKu8slice ser_ref;
56364         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56365         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56366         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
56367         *ret_conv = Stfu_read(ser_ref);
56368         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56369         return tag_ptr(ret_conv, true);
56370 }
56371
56372 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Splice_1write(JNIEnv *env, jclass clz, int64_t obj) {
56373         LDKSplice obj_conv;
56374         obj_conv.inner = untag_ptr(obj);
56375         obj_conv.is_owned = ptr_is_owned(obj);
56376         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56377         obj_conv.is_owned = false;
56378         LDKCVec_u8Z ret_var = Splice_write(&obj_conv);
56379         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56380         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56381         CVec_u8Z_free(ret_var);
56382         return ret_arr;
56383 }
56384
56385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56386         LDKu8slice ser_ref;
56387         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56388         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56389         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
56390         *ret_conv = Splice_read(ser_ref);
56391         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56392         return tag_ptr(ret_conv, true);
56393 }
56394
56395 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceAck_1write(JNIEnv *env, jclass clz, int64_t obj) {
56396         LDKSpliceAck obj_conv;
56397         obj_conv.inner = untag_ptr(obj);
56398         obj_conv.is_owned = ptr_is_owned(obj);
56399         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56400         obj_conv.is_owned = false;
56401         LDKCVec_u8Z ret_var = SpliceAck_write(&obj_conv);
56402         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56403         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56404         CVec_u8Z_free(ret_var);
56405         return ret_arr;
56406 }
56407
56408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56409         LDKu8slice ser_ref;
56410         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56411         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56412         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
56413         *ret_conv = SpliceAck_read(ser_ref);
56414         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56415         return tag_ptr(ret_conv, true);
56416 }
56417
56418 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
56419         LDKSpliceLocked obj_conv;
56420         obj_conv.inner = untag_ptr(obj);
56421         obj_conv.is_owned = ptr_is_owned(obj);
56422         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56423         obj_conv.is_owned = false;
56424         LDKCVec_u8Z ret_var = SpliceLocked_write(&obj_conv);
56425         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56426         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56427         CVec_u8Z_free(ret_var);
56428         return ret_arr;
56429 }
56430
56431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56432         LDKu8slice ser_ref;
56433         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56434         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56435         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
56436         *ret_conv = SpliceLocked_read(ser_ref);
56437         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56438         return tag_ptr(ret_conv, true);
56439 }
56440
56441 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddInput_1write(JNIEnv *env, jclass clz, int64_t obj) {
56442         LDKTxAddInput obj_conv;
56443         obj_conv.inner = untag_ptr(obj);
56444         obj_conv.is_owned = ptr_is_owned(obj);
56445         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56446         obj_conv.is_owned = false;
56447         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
56448         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56449         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56450         CVec_u8Z_free(ret_var);
56451         return ret_arr;
56452 }
56453
56454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56455         LDKu8slice ser_ref;
56456         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56457         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56458         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
56459         *ret_conv = TxAddInput_read(ser_ref);
56460         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56461         return tag_ptr(ret_conv, true);
56462 }
56463
56464 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
56465         LDKTxAddOutput obj_conv;
56466         obj_conv.inner = untag_ptr(obj);
56467         obj_conv.is_owned = ptr_is_owned(obj);
56468         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56469         obj_conv.is_owned = false;
56470         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
56471         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56472         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56473         CVec_u8Z_free(ret_var);
56474         return ret_arr;
56475 }
56476
56477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56478         LDKu8slice ser_ref;
56479         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56480         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56481         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
56482         *ret_conv = TxAddOutput_read(ser_ref);
56483         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56484         return tag_ptr(ret_conv, true);
56485 }
56486
56487 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1write(JNIEnv *env, jclass clz, int64_t obj) {
56488         LDKTxRemoveInput obj_conv;
56489         obj_conv.inner = untag_ptr(obj);
56490         obj_conv.is_owned = ptr_is_owned(obj);
56491         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56492         obj_conv.is_owned = false;
56493         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
56494         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56495         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56496         CVec_u8Z_free(ret_var);
56497         return ret_arr;
56498 }
56499
56500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56501         LDKu8slice ser_ref;
56502         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56503         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56504         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
56505         *ret_conv = TxRemoveInput_read(ser_ref);
56506         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56507         return tag_ptr(ret_conv, true);
56508 }
56509
56510 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
56511         LDKTxRemoveOutput obj_conv;
56512         obj_conv.inner = untag_ptr(obj);
56513         obj_conv.is_owned = ptr_is_owned(obj);
56514         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56515         obj_conv.is_owned = false;
56516         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
56517         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56518         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56519         CVec_u8Z_free(ret_var);
56520         return ret_arr;
56521 }
56522
56523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56524         LDKu8slice ser_ref;
56525         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56526         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56527         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
56528         *ret_conv = TxRemoveOutput_read(ser_ref);
56529         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56530         return tag_ptr(ret_conv, true);
56531 }
56532
56533 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxComplete_1write(JNIEnv *env, jclass clz, int64_t obj) {
56534         LDKTxComplete obj_conv;
56535         obj_conv.inner = untag_ptr(obj);
56536         obj_conv.is_owned = ptr_is_owned(obj);
56537         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56538         obj_conv.is_owned = false;
56539         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
56540         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56541         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56542         CVec_u8Z_free(ret_var);
56543         return ret_arr;
56544 }
56545
56546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56547         LDKu8slice ser_ref;
56548         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56549         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56550         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
56551         *ret_conv = TxComplete_read(ser_ref);
56552         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56553         return tag_ptr(ret_conv, true);
56554 }
56555
56556 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
56557         LDKTxSignatures obj_conv;
56558         obj_conv.inner = untag_ptr(obj);
56559         obj_conv.is_owned = ptr_is_owned(obj);
56560         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56561         obj_conv.is_owned = false;
56562         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
56563         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56564         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56565         CVec_u8Z_free(ret_var);
56566         return ret_arr;
56567 }
56568
56569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56570         LDKu8slice ser_ref;
56571         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56572         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56573         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
56574         *ret_conv = TxSignatures_read(ser_ref);
56575         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56576         return tag_ptr(ret_conv, true);
56577 }
56578
56579 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1write(JNIEnv *env, jclass clz, int64_t obj) {
56580         LDKTxInitRbf obj_conv;
56581         obj_conv.inner = untag_ptr(obj);
56582         obj_conv.is_owned = ptr_is_owned(obj);
56583         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56584         obj_conv.is_owned = false;
56585         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
56586         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56587         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56588         CVec_u8Z_free(ret_var);
56589         return ret_arr;
56590 }
56591
56592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56593         LDKu8slice ser_ref;
56594         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56595         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56596         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
56597         *ret_conv = TxInitRbf_read(ser_ref);
56598         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56599         return tag_ptr(ret_conv, true);
56600 }
56601
56602 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1write(JNIEnv *env, jclass clz, int64_t obj) {
56603         LDKTxAckRbf obj_conv;
56604         obj_conv.inner = untag_ptr(obj);
56605         obj_conv.is_owned = ptr_is_owned(obj);
56606         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56607         obj_conv.is_owned = false;
56608         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
56609         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56610         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56611         CVec_u8Z_free(ret_var);
56612         return ret_arr;
56613 }
56614
56615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56616         LDKu8slice ser_ref;
56617         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56618         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56619         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
56620         *ret_conv = TxAckRbf_read(ser_ref);
56621         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56622         return tag_ptr(ret_conv, true);
56623 }
56624
56625 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1write(JNIEnv *env, jclass clz, int64_t obj) {
56626         LDKTxAbort obj_conv;
56627         obj_conv.inner = untag_ptr(obj);
56628         obj_conv.is_owned = ptr_is_owned(obj);
56629         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56630         obj_conv.is_owned = false;
56631         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
56632         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56633         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56634         CVec_u8Z_free(ret_var);
56635         return ret_arr;
56636 }
56637
56638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56639         LDKu8slice ser_ref;
56640         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56641         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56642         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
56643         *ret_conv = TxAbort_read(ser_ref);
56644         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56645         return tag_ptr(ret_conv, true);
56646 }
56647
56648 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
56649         LDKAnnouncementSignatures obj_conv;
56650         obj_conv.inner = untag_ptr(obj);
56651         obj_conv.is_owned = ptr_is_owned(obj);
56652         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56653         obj_conv.is_owned = false;
56654         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
56655         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56656         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56657         CVec_u8Z_free(ret_var);
56658         return ret_arr;
56659 }
56660
56661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56662         LDKu8slice ser_ref;
56663         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56664         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56665         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
56666         *ret_conv = AnnouncementSignatures_read(ser_ref);
56667         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56668         return tag_ptr(ret_conv, true);
56669 }
56670
56671 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
56672         LDKChannelReestablish obj_conv;
56673         obj_conv.inner = untag_ptr(obj);
56674         obj_conv.is_owned = ptr_is_owned(obj);
56675         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56676         obj_conv.is_owned = false;
56677         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
56678         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56679         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56680         CVec_u8Z_free(ret_var);
56681         return ret_arr;
56682 }
56683
56684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56685         LDKu8slice ser_ref;
56686         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56687         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56688         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
56689         *ret_conv = ChannelReestablish_read(ser_ref);
56690         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56691         return tag_ptr(ret_conv, true);
56692 }
56693
56694 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
56695         LDKClosingSigned obj_conv;
56696         obj_conv.inner = untag_ptr(obj);
56697         obj_conv.is_owned = ptr_is_owned(obj);
56698         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56699         obj_conv.is_owned = false;
56700         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
56701         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56702         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56703         CVec_u8Z_free(ret_var);
56704         return ret_arr;
56705 }
56706
56707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56708         LDKu8slice ser_ref;
56709         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56710         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56711         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
56712         *ret_conv = ClosingSigned_read(ser_ref);
56713         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56714         return tag_ptr(ret_conv, true);
56715 }
56716
56717 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
56718         LDKClosingSignedFeeRange obj_conv;
56719         obj_conv.inner = untag_ptr(obj);
56720         obj_conv.is_owned = ptr_is_owned(obj);
56721         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56722         obj_conv.is_owned = false;
56723         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
56724         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56725         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56726         CVec_u8Z_free(ret_var);
56727         return ret_arr;
56728 }
56729
56730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56731         LDKu8slice ser_ref;
56732         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56733         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56734         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
56735         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
56736         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56737         return tag_ptr(ret_conv, true);
56738 }
56739
56740 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
56741         LDKCommitmentSigned obj_conv;
56742         obj_conv.inner = untag_ptr(obj);
56743         obj_conv.is_owned = ptr_is_owned(obj);
56744         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56745         obj_conv.is_owned = false;
56746         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
56747         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56748         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56749         CVec_u8Z_free(ret_var);
56750         return ret_arr;
56751 }
56752
56753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56754         LDKu8slice ser_ref;
56755         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56756         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56757         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
56758         *ret_conv = CommitmentSigned_read(ser_ref);
56759         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56760         return tag_ptr(ret_conv, true);
56761 }
56762
56763 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
56764         LDKFundingCreated obj_conv;
56765         obj_conv.inner = untag_ptr(obj);
56766         obj_conv.is_owned = ptr_is_owned(obj);
56767         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56768         obj_conv.is_owned = false;
56769         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
56770         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56771         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56772         CVec_u8Z_free(ret_var);
56773         return ret_arr;
56774 }
56775
56776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56777         LDKu8slice ser_ref;
56778         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56779         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56780         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
56781         *ret_conv = FundingCreated_read(ser_ref);
56782         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56783         return tag_ptr(ret_conv, true);
56784 }
56785
56786 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
56787         LDKFundingSigned obj_conv;
56788         obj_conv.inner = untag_ptr(obj);
56789         obj_conv.is_owned = ptr_is_owned(obj);
56790         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56791         obj_conv.is_owned = false;
56792         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
56793         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56794         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56795         CVec_u8Z_free(ret_var);
56796         return ret_arr;
56797 }
56798
56799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56800         LDKu8slice ser_ref;
56801         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56802         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56803         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
56804         *ret_conv = FundingSigned_read(ser_ref);
56805         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56806         return tag_ptr(ret_conv, true);
56807 }
56808
56809 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1write(JNIEnv *env, jclass clz, int64_t obj) {
56810         LDKChannelReady obj_conv;
56811         obj_conv.inner = untag_ptr(obj);
56812         obj_conv.is_owned = ptr_is_owned(obj);
56813         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56814         obj_conv.is_owned = false;
56815         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
56816         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56817         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56818         CVec_u8Z_free(ret_var);
56819         return ret_arr;
56820 }
56821
56822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56823         LDKu8slice ser_ref;
56824         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56825         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56826         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
56827         *ret_conv = ChannelReady_read(ser_ref);
56828         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56829         return tag_ptr(ret_conv, true);
56830 }
56831
56832 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
56833         LDKInit obj_conv;
56834         obj_conv.inner = untag_ptr(obj);
56835         obj_conv.is_owned = ptr_is_owned(obj);
56836         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56837         obj_conv.is_owned = false;
56838         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
56839         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56840         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56841         CVec_u8Z_free(ret_var);
56842         return ret_arr;
56843 }
56844
56845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56846         LDKu8slice ser_ref;
56847         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56848         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56849         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
56850         *ret_conv = Init_read(ser_ref);
56851         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56852         return tag_ptr(ret_conv, true);
56853 }
56854
56855 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
56856         LDKOpenChannel obj_conv;
56857         obj_conv.inner = untag_ptr(obj);
56858         obj_conv.is_owned = ptr_is_owned(obj);
56859         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56860         obj_conv.is_owned = false;
56861         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
56862         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56863         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56864         CVec_u8Z_free(ret_var);
56865         return ret_arr;
56866 }
56867
56868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56869         LDKu8slice ser_ref;
56870         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56871         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56872         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
56873         *ret_conv = OpenChannel_read(ser_ref);
56874         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56875         return tag_ptr(ret_conv, true);
56876 }
56877
56878 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1write(JNIEnv *env, jclass clz, int64_t obj) {
56879         LDKOpenChannelV2 obj_conv;
56880         obj_conv.inner = untag_ptr(obj);
56881         obj_conv.is_owned = ptr_is_owned(obj);
56882         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56883         obj_conv.is_owned = false;
56884         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
56885         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56886         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56887         CVec_u8Z_free(ret_var);
56888         return ret_arr;
56889 }
56890
56891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56892         LDKu8slice ser_ref;
56893         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56894         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56895         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
56896         *ret_conv = OpenChannelV2_read(ser_ref);
56897         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56898         return tag_ptr(ret_conv, true);
56899 }
56900
56901 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
56902         LDKRevokeAndACK obj_conv;
56903         obj_conv.inner = untag_ptr(obj);
56904         obj_conv.is_owned = ptr_is_owned(obj);
56905         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56906         obj_conv.is_owned = false;
56907         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
56908         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56909         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56910         CVec_u8Z_free(ret_var);
56911         return ret_arr;
56912 }
56913
56914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56915         LDKu8slice ser_ref;
56916         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56917         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56918         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
56919         *ret_conv = RevokeAndACK_read(ser_ref);
56920         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56921         return tag_ptr(ret_conv, true);
56922 }
56923
56924 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
56925         LDKShutdown obj_conv;
56926         obj_conv.inner = untag_ptr(obj);
56927         obj_conv.is_owned = ptr_is_owned(obj);
56928         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56929         obj_conv.is_owned = false;
56930         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
56931         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56932         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56933         CVec_u8Z_free(ret_var);
56934         return ret_arr;
56935 }
56936
56937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56938         LDKu8slice ser_ref;
56939         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56940         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56941         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
56942         *ret_conv = Shutdown_read(ser_ref);
56943         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56944         return tag_ptr(ret_conv, true);
56945 }
56946
56947 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
56948         LDKUpdateFailHTLC obj_conv;
56949         obj_conv.inner = untag_ptr(obj);
56950         obj_conv.is_owned = ptr_is_owned(obj);
56951         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56952         obj_conv.is_owned = false;
56953         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
56954         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56955         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56956         CVec_u8Z_free(ret_var);
56957         return ret_arr;
56958 }
56959
56960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56961         LDKu8slice ser_ref;
56962         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56963         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56964         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
56965         *ret_conv = UpdateFailHTLC_read(ser_ref);
56966         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56967         return tag_ptr(ret_conv, true);
56968 }
56969
56970 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
56971         LDKUpdateFailMalformedHTLC obj_conv;
56972         obj_conv.inner = untag_ptr(obj);
56973         obj_conv.is_owned = ptr_is_owned(obj);
56974         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56975         obj_conv.is_owned = false;
56976         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
56977         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56978         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56979         CVec_u8Z_free(ret_var);
56980         return ret_arr;
56981 }
56982
56983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56984         LDKu8slice ser_ref;
56985         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56986         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56987         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
56988         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
56989         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56990         return tag_ptr(ret_conv, true);
56991 }
56992
56993 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
56994         LDKUpdateFee obj_conv;
56995         obj_conv.inner = untag_ptr(obj);
56996         obj_conv.is_owned = ptr_is_owned(obj);
56997         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56998         obj_conv.is_owned = false;
56999         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
57000         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57001         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57002         CVec_u8Z_free(ret_var);
57003         return ret_arr;
57004 }
57005
57006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57007         LDKu8slice ser_ref;
57008         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57009         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57010         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
57011         *ret_conv = UpdateFee_read(ser_ref);
57012         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57013         return tag_ptr(ret_conv, true);
57014 }
57015
57016 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
57017         LDKUpdateFulfillHTLC obj_conv;
57018         obj_conv.inner = untag_ptr(obj);
57019         obj_conv.is_owned = ptr_is_owned(obj);
57020         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57021         obj_conv.is_owned = false;
57022         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
57023         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57024         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57025         CVec_u8Z_free(ret_var);
57026         return ret_arr;
57027 }
57028
57029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57030         LDKu8slice ser_ref;
57031         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57032         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57033         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
57034         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
57035         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57036         return tag_ptr(ret_conv, true);
57037 }
57038
57039 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionPacket_1write(JNIEnv *env, jclass clz, int64_t obj) {
57040         LDKOnionPacket obj_conv;
57041         obj_conv.inner = untag_ptr(obj);
57042         obj_conv.is_owned = ptr_is_owned(obj);
57043         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57044         obj_conv.is_owned = false;
57045         LDKCVec_u8Z ret_var = OnionPacket_write(&obj_conv);
57046         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57047         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57048         CVec_u8Z_free(ret_var);
57049         return ret_arr;
57050 }
57051
57052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57053         LDKu8slice ser_ref;
57054         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57055         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57056         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
57057         *ret_conv = OnionPacket_read(ser_ref);
57058         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57059         return tag_ptr(ret_conv, true);
57060 }
57061
57062 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
57063         LDKUpdateAddHTLC obj_conv;
57064         obj_conv.inner = untag_ptr(obj);
57065         obj_conv.is_owned = ptr_is_owned(obj);
57066         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57067         obj_conv.is_owned = false;
57068         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
57069         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57070         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57071         CVec_u8Z_free(ret_var);
57072         return ret_arr;
57073 }
57074
57075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57076         LDKu8slice ser_ref;
57077         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57078         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57079         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
57080         *ret_conv = UpdateAddHTLC_read(ser_ref);
57081         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57082         return tag_ptr(ret_conv, true);
57083 }
57084
57085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57086         LDKu8slice ser_ref;
57087         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57088         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57089         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
57090         *ret_conv = OnionMessage_read(ser_ref);
57091         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57092         return tag_ptr(ret_conv, true);
57093 }
57094
57095 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
57096         LDKOnionMessage obj_conv;
57097         obj_conv.inner = untag_ptr(obj);
57098         obj_conv.is_owned = ptr_is_owned(obj);
57099         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57100         obj_conv.is_owned = false;
57101         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
57102         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57103         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57104         CVec_u8Z_free(ret_var);
57105         return ret_arr;
57106 }
57107
57108 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1write(JNIEnv *env, jclass clz, int64_t obj) {
57109         LDKFinalOnionHopData obj_conv;
57110         obj_conv.inner = untag_ptr(obj);
57111         obj_conv.is_owned = ptr_is_owned(obj);
57112         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57113         obj_conv.is_owned = false;
57114         LDKCVec_u8Z ret_var = FinalOnionHopData_write(&obj_conv);
57115         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57116         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57117         CVec_u8Z_free(ret_var);
57118         return ret_arr;
57119 }
57120
57121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57122         LDKu8slice ser_ref;
57123         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57124         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57125         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
57126         *ret_conv = FinalOnionHopData_read(ser_ref);
57127         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57128         return tag_ptr(ret_conv, true);
57129 }
57130
57131 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
57132         LDKPing obj_conv;
57133         obj_conv.inner = untag_ptr(obj);
57134         obj_conv.is_owned = ptr_is_owned(obj);
57135         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57136         obj_conv.is_owned = false;
57137         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
57138         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57139         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57140         CVec_u8Z_free(ret_var);
57141         return ret_arr;
57142 }
57143
57144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57145         LDKu8slice ser_ref;
57146         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57147         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57148         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
57149         *ret_conv = Ping_read(ser_ref);
57150         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57151         return tag_ptr(ret_conv, true);
57152 }
57153
57154 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
57155         LDKPong obj_conv;
57156         obj_conv.inner = untag_ptr(obj);
57157         obj_conv.is_owned = ptr_is_owned(obj);
57158         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57159         obj_conv.is_owned = false;
57160         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
57161         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57162         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57163         CVec_u8Z_free(ret_var);
57164         return ret_arr;
57165 }
57166
57167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57168         LDKu8slice ser_ref;
57169         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57170         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57171         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
57172         *ret_conv = Pong_read(ser_ref);
57173         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57174         return tag_ptr(ret_conv, true);
57175 }
57176
57177 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
57178         LDKUnsignedChannelAnnouncement obj_conv;
57179         obj_conv.inner = untag_ptr(obj);
57180         obj_conv.is_owned = ptr_is_owned(obj);
57181         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57182         obj_conv.is_owned = false;
57183         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
57184         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57185         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57186         CVec_u8Z_free(ret_var);
57187         return ret_arr;
57188 }
57189
57190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57191         LDKu8slice ser_ref;
57192         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57193         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57194         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
57195         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
57196         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57197         return tag_ptr(ret_conv, true);
57198 }
57199
57200 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
57201         LDKChannelAnnouncement obj_conv;
57202         obj_conv.inner = untag_ptr(obj);
57203         obj_conv.is_owned = ptr_is_owned(obj);
57204         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57205         obj_conv.is_owned = false;
57206         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
57207         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57208         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57209         CVec_u8Z_free(ret_var);
57210         return ret_arr;
57211 }
57212
57213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57214         LDKu8slice ser_ref;
57215         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57216         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57217         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
57218         *ret_conv = ChannelAnnouncement_read(ser_ref);
57219         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57220         return tag_ptr(ret_conv, true);
57221 }
57222
57223 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
57224         LDKUnsignedChannelUpdate obj_conv;
57225         obj_conv.inner = untag_ptr(obj);
57226         obj_conv.is_owned = ptr_is_owned(obj);
57227         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57228         obj_conv.is_owned = false;
57229         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
57230         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57231         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57232         CVec_u8Z_free(ret_var);
57233         return ret_arr;
57234 }
57235
57236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57237         LDKu8slice ser_ref;
57238         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57239         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57240         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
57241         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
57242         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57243         return tag_ptr(ret_conv, true);
57244 }
57245
57246 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
57247         LDKChannelUpdate obj_conv;
57248         obj_conv.inner = untag_ptr(obj);
57249         obj_conv.is_owned = ptr_is_owned(obj);
57250         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57251         obj_conv.is_owned = false;
57252         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
57253         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57254         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57255         CVec_u8Z_free(ret_var);
57256         return ret_arr;
57257 }
57258
57259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57260         LDKu8slice ser_ref;
57261         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57262         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57263         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
57264         *ret_conv = ChannelUpdate_read(ser_ref);
57265         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57266         return tag_ptr(ret_conv, true);
57267 }
57268
57269 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
57270         LDKErrorMessage obj_conv;
57271         obj_conv.inner = untag_ptr(obj);
57272         obj_conv.is_owned = ptr_is_owned(obj);
57273         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57274         obj_conv.is_owned = false;
57275         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
57276         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57277         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57278         CVec_u8Z_free(ret_var);
57279         return ret_arr;
57280 }
57281
57282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57283         LDKu8slice ser_ref;
57284         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57285         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57286         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
57287         *ret_conv = ErrorMessage_read(ser_ref);
57288         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57289         return tag_ptr(ret_conv, true);
57290 }
57291
57292 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
57293         LDKWarningMessage obj_conv;
57294         obj_conv.inner = untag_ptr(obj);
57295         obj_conv.is_owned = ptr_is_owned(obj);
57296         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57297         obj_conv.is_owned = false;
57298         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
57299         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57300         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57301         CVec_u8Z_free(ret_var);
57302         return ret_arr;
57303 }
57304
57305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57306         LDKu8slice ser_ref;
57307         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57308         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57309         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
57310         *ret_conv = WarningMessage_read(ser_ref);
57311         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57312         return tag_ptr(ret_conv, true);
57313 }
57314
57315 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
57316         LDKUnsignedNodeAnnouncement obj_conv;
57317         obj_conv.inner = untag_ptr(obj);
57318         obj_conv.is_owned = ptr_is_owned(obj);
57319         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57320         obj_conv.is_owned = false;
57321         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
57322         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57323         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57324         CVec_u8Z_free(ret_var);
57325         return ret_arr;
57326 }
57327
57328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57329         LDKu8slice ser_ref;
57330         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57331         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57332         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
57333         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
57334         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57335         return tag_ptr(ret_conv, true);
57336 }
57337
57338 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
57339         LDKNodeAnnouncement obj_conv;
57340         obj_conv.inner = untag_ptr(obj);
57341         obj_conv.is_owned = ptr_is_owned(obj);
57342         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57343         obj_conv.is_owned = false;
57344         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
57345         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57346         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57347         CVec_u8Z_free(ret_var);
57348         return ret_arr;
57349 }
57350
57351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57352         LDKu8slice ser_ref;
57353         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57354         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57355         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
57356         *ret_conv = NodeAnnouncement_read(ser_ref);
57357         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57358         return tag_ptr(ret_conv, true);
57359 }
57360
57361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57362         LDKu8slice ser_ref;
57363         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57364         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57365         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
57366         *ret_conv = QueryShortChannelIds_read(ser_ref);
57367         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57368         return tag_ptr(ret_conv, true);
57369 }
57370
57371 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
57372         LDKQueryShortChannelIds obj_conv;
57373         obj_conv.inner = untag_ptr(obj);
57374         obj_conv.is_owned = ptr_is_owned(obj);
57375         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57376         obj_conv.is_owned = false;
57377         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
57378         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57379         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57380         CVec_u8Z_free(ret_var);
57381         return ret_arr;
57382 }
57383
57384 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
57385         LDKReplyShortChannelIdsEnd obj_conv;
57386         obj_conv.inner = untag_ptr(obj);
57387         obj_conv.is_owned = ptr_is_owned(obj);
57388         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57389         obj_conv.is_owned = false;
57390         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
57391         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57392         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57393         CVec_u8Z_free(ret_var);
57394         return ret_arr;
57395 }
57396
57397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57398         LDKu8slice ser_ref;
57399         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57400         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57401         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
57402         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
57403         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57404         return tag_ptr(ret_conv, true);
57405 }
57406
57407 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
57408         LDKQueryChannelRange this_arg_conv;
57409         this_arg_conv.inner = untag_ptr(this_arg);
57410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57412         this_arg_conv.is_owned = false;
57413         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
57414         return ret_conv;
57415 }
57416
57417 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
57418         LDKQueryChannelRange obj_conv;
57419         obj_conv.inner = untag_ptr(obj);
57420         obj_conv.is_owned = ptr_is_owned(obj);
57421         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57422         obj_conv.is_owned = false;
57423         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
57424         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57425         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57426         CVec_u8Z_free(ret_var);
57427         return ret_arr;
57428 }
57429
57430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57431         LDKu8slice ser_ref;
57432         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57433         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57434         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
57435         *ret_conv = QueryChannelRange_read(ser_ref);
57436         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57437         return tag_ptr(ret_conv, true);
57438 }
57439
57440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57441         LDKu8slice ser_ref;
57442         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57443         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57444         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
57445         *ret_conv = ReplyChannelRange_read(ser_ref);
57446         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57447         return tag_ptr(ret_conv, true);
57448 }
57449
57450 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
57451         LDKReplyChannelRange obj_conv;
57452         obj_conv.inner = untag_ptr(obj);
57453         obj_conv.is_owned = ptr_is_owned(obj);
57454         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57455         obj_conv.is_owned = false;
57456         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
57457         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57458         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57459         CVec_u8Z_free(ret_var);
57460         return ret_arr;
57461 }
57462
57463 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
57464         LDKGossipTimestampFilter obj_conv;
57465         obj_conv.inner = untag_ptr(obj);
57466         obj_conv.is_owned = ptr_is_owned(obj);
57467         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57468         obj_conv.is_owned = false;
57469         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
57470         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57471         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57472         CVec_u8Z_free(ret_var);
57473         return ret_arr;
57474 }
57475
57476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57477         LDKu8slice ser_ref;
57478         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57479         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57480         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
57481         *ret_conv = GossipTimestampFilter_read(ser_ref);
57482         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57483         return tag_ptr(ret_conv, true);
57484 }
57485
57486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
57487         if (!ptr_is_owned(this_ptr)) return;
57488         void* this_ptr_ptr = untag_ptr(this_ptr);
57489         CHECK_ACCESS(this_ptr_ptr);
57490         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
57491         FREE(untag_ptr(this_ptr));
57492         CustomMessageHandler_free(this_ptr_conv);
57493 }
57494
57495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57496         LDKIgnoringMessageHandler this_obj_conv;
57497         this_obj_conv.inner = untag_ptr(this_obj);
57498         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57500         IgnoringMessageHandler_free(this_obj_conv);
57501 }
57502
57503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
57504         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
57505         int64_t ret_ref = 0;
57506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57508         return ret_ref;
57509 }
57510
57511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
57512         LDKIgnoringMessageHandler this_arg_conv;
57513         this_arg_conv.inner = untag_ptr(this_arg);
57514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57516         this_arg_conv.is_owned = false;
57517         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
57518         *ret_ret = IgnoringMessageHandler_as_EventsProvider(&this_arg_conv);
57519         return tag_ptr(ret_ret, true);
57520 }
57521
57522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
57523         LDKIgnoringMessageHandler this_arg_conv;
57524         this_arg_conv.inner = untag_ptr(this_arg);
57525         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57527         this_arg_conv.is_owned = false;
57528         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
57529         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
57530         return tag_ptr(ret_ret, true);
57531 }
57532
57533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
57534         LDKIgnoringMessageHandler this_arg_conv;
57535         this_arg_conv.inner = untag_ptr(this_arg);
57536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57538         this_arg_conv.is_owned = false;
57539         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
57540         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
57541         return tag_ptr(ret_ret, true);
57542 }
57543
57544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
57545         LDKIgnoringMessageHandler this_arg_conv;
57546         this_arg_conv.inner = untag_ptr(this_arg);
57547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57549         this_arg_conv.is_owned = false;
57550         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
57551         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
57552         return tag_ptr(ret_ret, true);
57553 }
57554
57555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OffersMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
57556         LDKIgnoringMessageHandler this_arg_conv;
57557         this_arg_conv.inner = untag_ptr(this_arg);
57558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57560         this_arg_conv.is_owned = false;
57561         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
57562         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
57563         return tag_ptr(ret_ret, true);
57564 }
57565
57566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomOnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
57567         LDKIgnoringMessageHandler this_arg_conv;
57568         this_arg_conv.inner = untag_ptr(this_arg);
57569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57571         this_arg_conv.is_owned = false;
57572         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
57573         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
57574         return tag_ptr(ret_ret, true);
57575 }
57576
57577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
57578         LDKIgnoringMessageHandler this_arg_conv;
57579         this_arg_conv.inner = untag_ptr(this_arg);
57580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57582         this_arg_conv.is_owned = false;
57583         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
57584         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
57585         return tag_ptr(ret_ret, true);
57586 }
57587
57588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
57589         LDKIgnoringMessageHandler this_arg_conv;
57590         this_arg_conv.inner = untag_ptr(this_arg);
57591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57593         this_arg_conv.is_owned = false;
57594         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
57595         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
57596         return tag_ptr(ret_ret, true);
57597 }
57598
57599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57600         LDKErroringMessageHandler this_obj_conv;
57601         this_obj_conv.inner = untag_ptr(this_obj);
57602         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57604         ErroringMessageHandler_free(this_obj_conv);
57605 }
57606
57607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
57608         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
57609         int64_t ret_ref = 0;
57610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57612         return ret_ref;
57613 }
57614
57615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
57616         LDKErroringMessageHandler this_arg_conv;
57617         this_arg_conv.inner = untag_ptr(this_arg);
57618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57620         this_arg_conv.is_owned = false;
57621         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
57622         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
57623         return tag_ptr(ret_ret, true);
57624 }
57625
57626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
57627         LDKErroringMessageHandler this_arg_conv;
57628         this_arg_conv.inner = untag_ptr(this_arg);
57629         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57631         this_arg_conv.is_owned = false;
57632         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
57633         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
57634         return tag_ptr(ret_ret, true);
57635 }
57636
57637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57638         LDKMessageHandler this_obj_conv;
57639         this_obj_conv.inner = untag_ptr(this_obj);
57640         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57642         MessageHandler_free(this_obj_conv);
57643 }
57644
57645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
57646         LDKMessageHandler this_ptr_conv;
57647         this_ptr_conv.inner = untag_ptr(this_ptr);
57648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57650         this_ptr_conv.is_owned = false;
57651         // WARNING: This object doesn't live past this scope, needs clone!
57652         int64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
57653         return ret_ret;
57654 }
57655
57656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57657         LDKMessageHandler this_ptr_conv;
57658         this_ptr_conv.inner = untag_ptr(this_ptr);
57659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57661         this_ptr_conv.is_owned = false;
57662         void* val_ptr = untag_ptr(val);
57663         CHECK_ACCESS(val_ptr);
57664         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
57665         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
57666                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57667                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
57668         }
57669         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
57670 }
57671
57672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
57673         LDKMessageHandler this_ptr_conv;
57674         this_ptr_conv.inner = untag_ptr(this_ptr);
57675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57677         this_ptr_conv.is_owned = false;
57678         // WARNING: This object doesn't live past this scope, needs clone!
57679         int64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
57680         return ret_ret;
57681 }
57682
57683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57684         LDKMessageHandler this_ptr_conv;
57685         this_ptr_conv.inner = untag_ptr(this_ptr);
57686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57688         this_ptr_conv.is_owned = false;
57689         void* val_ptr = untag_ptr(val);
57690         CHECK_ACCESS(val_ptr);
57691         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
57692         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
57693                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57694                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
57695         }
57696         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
57697 }
57698
57699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
57700         LDKMessageHandler this_ptr_conv;
57701         this_ptr_conv.inner = untag_ptr(this_ptr);
57702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57704         this_ptr_conv.is_owned = false;
57705         // WARNING: This object doesn't live past this scope, needs clone!
57706         int64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
57707         return ret_ret;
57708 }
57709
57710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57711         LDKMessageHandler this_ptr_conv;
57712         this_ptr_conv.inner = untag_ptr(this_ptr);
57713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57715         this_ptr_conv.is_owned = false;
57716         void* val_ptr = untag_ptr(val);
57717         CHECK_ACCESS(val_ptr);
57718         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
57719         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
57720                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57721                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
57722         }
57723         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
57724 }
57725
57726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1custom_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
57727         LDKMessageHandler this_ptr_conv;
57728         this_ptr_conv.inner = untag_ptr(this_ptr);
57729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57731         this_ptr_conv.is_owned = false;
57732         // WARNING: This object doesn't live past this scope, needs clone!
57733         int64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
57734         return ret_ret;
57735 }
57736
57737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1custom_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57738         LDKMessageHandler this_ptr_conv;
57739         this_ptr_conv.inner = untag_ptr(this_ptr);
57740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57742         this_ptr_conv.is_owned = false;
57743         void* val_ptr = untag_ptr(val);
57744         CHECK_ACCESS(val_ptr);
57745         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
57746         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
57747                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57748                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
57749         }
57750         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
57751 }
57752
57753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv *env, jclass clz, int64_t chan_handler_arg, int64_t route_handler_arg, int64_t onion_message_handler_arg, int64_t custom_message_handler_arg) {
57754         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
57755         CHECK_ACCESS(chan_handler_arg_ptr);
57756         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
57757         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
57758                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57759                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
57760         }
57761         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
57762         CHECK_ACCESS(route_handler_arg_ptr);
57763         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
57764         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
57765                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57766                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
57767         }
57768         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
57769         CHECK_ACCESS(onion_message_handler_arg_ptr);
57770         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
57771         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
57772                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57773                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
57774         }
57775         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
57776         CHECK_ACCESS(custom_message_handler_arg_ptr);
57777         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
57778         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
57779                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57780                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
57781         }
57782         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
57783         int64_t ret_ref = 0;
57784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57786         return ret_ref;
57787 }
57788
57789 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
57790         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
57791         *ret_ret = SocketDescriptor_clone(arg);
57792         return tag_ptr(ret_ret, true);
57793 }
57794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57795         void* arg_ptr = untag_ptr(arg);
57796         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
57797         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
57798         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
57799         return ret_conv;
57800 }
57801
57802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57803         void* orig_ptr = untag_ptr(orig);
57804         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
57805         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
57806         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
57807         *ret_ret = SocketDescriptor_clone(orig_conv);
57808         return tag_ptr(ret_ret, true);
57809 }
57810
57811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
57812         if (!ptr_is_owned(this_ptr)) return;
57813         void* this_ptr_ptr = untag_ptr(this_ptr);
57814         CHECK_ACCESS(this_ptr_ptr);
57815         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
57816         FREE(untag_ptr(this_ptr));
57817         SocketDescriptor_free(this_ptr_conv);
57818 }
57819
57820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57821         LDKPeerHandleError this_obj_conv;
57822         this_obj_conv.inner = untag_ptr(this_obj);
57823         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57825         PeerHandleError_free(this_obj_conv);
57826 }
57827
57828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz) {
57829         LDKPeerHandleError ret_var = PeerHandleError_new();
57830         int64_t ret_ref = 0;
57831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57833         return ret_ref;
57834 }
57835
57836 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
57837         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
57838         int64_t ret_ref = 0;
57839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57841         return ret_ref;
57842 }
57843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57844         LDKPeerHandleError arg_conv;
57845         arg_conv.inner = untag_ptr(arg);
57846         arg_conv.is_owned = ptr_is_owned(arg);
57847         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57848         arg_conv.is_owned = false;
57849         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
57850         return ret_conv;
57851 }
57852
57853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57854         LDKPeerHandleError orig_conv;
57855         orig_conv.inner = untag_ptr(orig);
57856         orig_conv.is_owned = ptr_is_owned(orig);
57857         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57858         orig_conv.is_owned = false;
57859         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
57860         int64_t ret_ref = 0;
57861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57863         return ret_ref;
57864 }
57865
57866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57867         LDKPeerManager this_obj_conv;
57868         this_obj_conv.inner = untag_ptr(this_obj);
57869         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57871         PeerManager_free(this_obj_conv);
57872 }
57873
57874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *env, jclass clz, int64_t message_handler, int32_t current_time, int8_tArray ephemeral_random_data, int64_t logger, int64_t node_signer) {
57875         LDKMessageHandler message_handler_conv;
57876         message_handler_conv.inner = untag_ptr(message_handler);
57877         message_handler_conv.is_owned = ptr_is_owned(message_handler);
57878         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
57879         // WARNING: we need a move here but no clone is available for LDKMessageHandler
57880         
57881         uint8_t ephemeral_random_data_arr[32];
57882         CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
57883         (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
57884         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
57885         void* logger_ptr = untag_ptr(logger);
57886         CHECK_ACCESS(logger_ptr);
57887         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
57888         if (logger_conv.free == LDKLogger_JCalls_free) {
57889                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57890                 LDKLogger_JCalls_cloned(&logger_conv);
57891         }
57892         void* node_signer_ptr = untag_ptr(node_signer);
57893         CHECK_ACCESS(node_signer_ptr);
57894         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
57895         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
57896                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57897                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
57898         }
57899         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
57900         int64_t ret_ref = 0;
57901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57903         return ret_ref;
57904 }
57905
57906 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
57907         LDKPeerManager this_arg_conv;
57908         this_arg_conv.inner = untag_ptr(this_arg);
57909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57911         this_arg_conv.is_owned = false;
57912         LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
57913         int64_tArray ret_arr = NULL;
57914         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
57915         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
57916         for (size_t r = 0; r < ret_var.datalen; r++) {
57917                 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ* ret_conv_43_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_SocketAddressZZ), "LDKC2Tuple_PublicKeyCOption_SocketAddressZZ");
57918                 *ret_conv_43_conv = ret_var.data[r];
57919                 ret_arr_ptr[r] = tag_ptr(ret_conv_43_conv, true);
57920         }
57921         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
57922         FREE(ret_var.data);
57923         return ret_arr;
57924 }
57925
57926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1outbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t descriptor, int64_t remote_network_address) {
57927         LDKPeerManager this_arg_conv;
57928         this_arg_conv.inner = untag_ptr(this_arg);
57929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57931         this_arg_conv.is_owned = false;
57932         LDKPublicKey their_node_id_ref;
57933         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
57934         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
57935         void* descriptor_ptr = untag_ptr(descriptor);
57936         CHECK_ACCESS(descriptor_ptr);
57937         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
57938         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
57939                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57940                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
57941         }
57942         void* remote_network_address_ptr = untag_ptr(remote_network_address);
57943         CHECK_ACCESS(remote_network_address_ptr);
57944         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
57945         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
57946         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
57947         return tag_ptr(ret_conv, true);
57948 }
57949
57950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor, int64_t remote_network_address) {
57951         LDKPeerManager this_arg_conv;
57952         this_arg_conv.inner = untag_ptr(this_arg);
57953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57955         this_arg_conv.is_owned = false;
57956         void* descriptor_ptr = untag_ptr(descriptor);
57957         CHECK_ACCESS(descriptor_ptr);
57958         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
57959         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
57960                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57961                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
57962         }
57963         void* remote_network_address_ptr = untag_ptr(remote_network_address);
57964         CHECK_ACCESS(remote_network_address_ptr);
57965         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
57966         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
57967         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
57968         return tag_ptr(ret_conv, true);
57969 }
57970
57971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
57972         LDKPeerManager this_arg_conv;
57973         this_arg_conv.inner = untag_ptr(this_arg);
57974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57976         this_arg_conv.is_owned = false;
57977         void* descriptor_ptr = untag_ptr(descriptor);
57978         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
57979         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
57980         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
57981         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
57982         return tag_ptr(ret_conv, true);
57983 }
57984
57985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t peer_descriptor, int8_tArray data) {
57986         LDKPeerManager this_arg_conv;
57987         this_arg_conv.inner = untag_ptr(this_arg);
57988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57990         this_arg_conv.is_owned = false;
57991         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
57992         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
57993         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
57994         LDKu8slice data_ref;
57995         data_ref.datalen = (*env)->GetArrayLength(env, data);
57996         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
57997         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
57998         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
57999         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
58000         return tag_ptr(ret_conv, true);
58001 }
58002
58003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
58004         LDKPeerManager this_arg_conv;
58005         this_arg_conv.inner = untag_ptr(this_arg);
58006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58008         this_arg_conv.is_owned = false;
58009         PeerManager_process_events(&this_arg_conv);
58010 }
58011
58012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
58013         LDKPeerManager this_arg_conv;
58014         this_arg_conv.inner = untag_ptr(this_arg);
58015         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58017         this_arg_conv.is_owned = false;
58018         void* descriptor_ptr = untag_ptr(descriptor);
58019         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
58020         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
58021         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
58022 }
58023
58024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1by_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray node_id) {
58025         LDKPeerManager this_arg_conv;
58026         this_arg_conv.inner = untag_ptr(this_arg);
58027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58029         this_arg_conv.is_owned = false;
58030         LDKPublicKey node_id_ref;
58031         CHECK((*env)->GetArrayLength(env, node_id) == 33);
58032         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
58033         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
58034 }
58035
58036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
58037         LDKPeerManager this_arg_conv;
58038         this_arg_conv.inner = untag_ptr(this_arg);
58039         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58041         this_arg_conv.is_owned = false;
58042         PeerManager_disconnect_all_peers(&this_arg_conv);
58043 }
58044
58045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
58046         LDKPeerManager this_arg_conv;
58047         this_arg_conv.inner = untag_ptr(this_arg);
58048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58050         this_arg_conv.is_owned = false;
58051         PeerManager_timer_tick_occurred(&this_arg_conv);
58052 }
58053
58054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray rgb, int8_tArray alias, int64_tArray addresses) {
58055         LDKPeerManager this_arg_conv;
58056         this_arg_conv.inner = untag_ptr(this_arg);
58057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58059         this_arg_conv.is_owned = false;
58060         LDKThreeBytes rgb_ref;
58061         CHECK((*env)->GetArrayLength(env, rgb) == 3);
58062         (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
58063         LDKThirtyTwoBytes alias_ref;
58064         CHECK((*env)->GetArrayLength(env, alias) == 32);
58065         (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
58066         LDKCVec_SocketAddressZ addresses_constr;
58067         addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
58068         if (addresses_constr.datalen > 0)
58069                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
58070         else
58071                 addresses_constr.data = NULL;
58072         int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
58073         for (size_t p = 0; p < addresses_constr.datalen; p++) {
58074                 int64_t addresses_conv_15 = addresses_vals[p];
58075                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
58076                 CHECK_ACCESS(addresses_conv_15_ptr);
58077                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
58078                 addresses_constr.data[p] = addresses_conv_15_conv;
58079         }
58080         (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
58081         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
58082 }
58083
58084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, int64_t channel_type_features) {
58085         LDKChannelTypeFeatures channel_type_features_conv;
58086         channel_type_features_conv.inner = untag_ptr(channel_type_features);
58087         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
58088         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
58089         channel_type_features_conv.is_owned = false;
58090         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
58091         return ret_conv;
58092 }
58093
58094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, int64_t channel_type_features) {
58095         LDKChannelTypeFeatures channel_type_features_conv;
58096         channel_type_features_conv.inner = untag_ptr(channel_type_features);
58097         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
58098         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
58099         channel_type_features_conv.is_owned = false;
58100         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
58101         return ret_conv;
58102 }
58103
58104 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58105         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
58106         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_clone(orig_conv));
58107         return ret_conv;
58108 }
58109
58110 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1timeout(JNIEnv *env, jclass clz) {
58111         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_timeout());
58112         return ret_conv;
58113 }
58114
58115 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1preimage(JNIEnv *env, jclass clz) {
58116         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_preimage());
58117         return ret_conv;
58118 }
58119
58120 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1timeout(JNIEnv *env, jclass clz) {
58121         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_timeout());
58122         return ret_conv;
58123 }
58124
58125 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1preimage(JNIEnv *env, jclass clz) {
58126         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_preimage());
58127         return ret_conv;
58128 }
58129
58130 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1revocation(JNIEnv *env, jclass clz) {
58131         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_revocation());
58132         return ret_conv;
58133 }
58134
58135 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58136         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
58137         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
58138         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
58139         return ret_conv;
58140 }
58141
58142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1from_1witness(JNIEnv *env, jclass clz, int8_tArray witness) {
58143         LDKWitness witness_ref;
58144         witness_ref.datalen = (*env)->GetArrayLength(env, witness);
58145         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
58146         (*env)->GetByteArrayRegion(env, witness, 0, witness_ref.datalen, witness_ref.data);
58147         witness_ref.data_is_owned = true;
58148         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
58149         *ret_copy = HTLCClaim_from_witness(witness_ref);
58150         int64_t ret_ref = tag_ptr(ret_copy, true);
58151         return ret_ref;
58152 }
58153
58154 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
58155         uint8_t commitment_seed_arr[32];
58156         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
58157         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
58158         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
58159         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58160         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
58161         return ret_arr;
58162 }
58163
58164 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1closing_1transaction(JNIEnv *env, jclass clz, int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, int64_t funding_outpoint) {
58165         LDKCVec_u8Z to_holder_script_ref;
58166         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
58167         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
58168         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
58169         LDKCVec_u8Z to_counterparty_script_ref;
58170         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
58171         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
58172         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
58173         LDKOutPoint funding_outpoint_conv;
58174         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
58175         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
58176         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
58177         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
58178         LDKTransaction ret_var = build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
58179         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58180         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58181         Transaction_free(ret_var);
58182         return ret_arr;
58183 }
58184
58185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58186         LDKCounterpartyCommitmentSecrets this_obj_conv;
58187         this_obj_conv.inner = untag_ptr(this_obj);
58188         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58190         CounterpartyCommitmentSecrets_free(this_obj_conv);
58191 }
58192
58193 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
58194         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
58195         int64_t ret_ref = 0;
58196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58198         return ret_ref;
58199 }
58200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58201         LDKCounterpartyCommitmentSecrets arg_conv;
58202         arg_conv.inner = untag_ptr(arg);
58203         arg_conv.is_owned = ptr_is_owned(arg);
58204         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58205         arg_conv.is_owned = false;
58206         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
58207         return ret_conv;
58208 }
58209
58210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58211         LDKCounterpartyCommitmentSecrets orig_conv;
58212         orig_conv.inner = untag_ptr(orig);
58213         orig_conv.is_owned = ptr_is_owned(orig);
58214         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58215         orig_conv.is_owned = false;
58216         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
58217         int64_t ret_ref = 0;
58218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58220         return ret_ref;
58221 }
58222
58223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
58224         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
58225         int64_t ret_ref = 0;
58226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58228         return ret_ref;
58229 }
58230
58231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
58232         LDKCounterpartyCommitmentSecrets this_arg_conv;
58233         this_arg_conv.inner = untag_ptr(this_arg);
58234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58236         this_arg_conv.is_owned = false;
58237         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
58238         return ret_conv;
58239 }
58240
58241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1provide_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) {
58242         LDKCounterpartyCommitmentSecrets this_arg_conv;
58243         this_arg_conv.inner = untag_ptr(this_arg);
58244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58246         this_arg_conv.is_owned = false;
58247         LDKThirtyTwoBytes secret_ref;
58248         CHECK((*env)->GetArrayLength(env, secret) == 32);
58249         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
58250         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
58251         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
58252         return tag_ptr(ret_conv, true);
58253 }
58254
58255 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
58256         LDKCounterpartyCommitmentSecrets this_arg_conv;
58257         this_arg_conv.inner = untag_ptr(this_arg);
58258         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58260         this_arg_conv.is_owned = false;
58261         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58262         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
58263         return ret_arr;
58264 }
58265
58266 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
58267         LDKCounterpartyCommitmentSecrets obj_conv;
58268         obj_conv.inner = untag_ptr(obj);
58269         obj_conv.is_owned = ptr_is_owned(obj);
58270         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58271         obj_conv.is_owned = false;
58272         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
58273         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58274         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58275         CVec_u8Z_free(ret_var);
58276         return ret_arr;
58277 }
58278
58279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
58280         LDKu8slice ser_ref;
58281         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58282         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58283         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
58284         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
58285         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58286         return tag_ptr(ret_conv, true);
58287 }
58288
58289 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray base_secret) {
58290         LDKPublicKey per_commitment_point_ref;
58291         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
58292         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
58293         uint8_t base_secret_arr[32];
58294         CHECK((*env)->GetArrayLength(env, base_secret) == 32);
58295         (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
58296         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
58297         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58298         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes);
58299         return ret_arr;
58300 }
58301
58302 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_derive_1private_1revocation_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
58303         uint8_t per_commitment_secret_arr[32];
58304         CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
58305         (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
58306         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
58307         uint8_t countersignatory_revocation_base_secret_arr[32];
58308         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
58309         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
58310         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
58311         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58312         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes);
58313         return ret_arr;
58314 }
58315
58316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58317         LDKTxCreationKeys this_obj_conv;
58318         this_obj_conv.inner = untag_ptr(this_obj);
58319         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58321         TxCreationKeys_free(this_obj_conv);
58322 }
58323
58324 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
58325         LDKTxCreationKeys this_ptr_conv;
58326         this_ptr_conv.inner = untag_ptr(this_ptr);
58327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58329         this_ptr_conv.is_owned = false;
58330         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
58331         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
58332         return ret_arr;
58333 }
58334
58335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58336         LDKTxCreationKeys this_ptr_conv;
58337         this_ptr_conv.inner = untag_ptr(this_ptr);
58338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58340         this_ptr_conv.is_owned = false;
58341         LDKPublicKey val_ref;
58342         CHECK((*env)->GetArrayLength(env, val) == 33);
58343         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
58344         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
58345 }
58346
58347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
58348         LDKTxCreationKeys this_ptr_conv;
58349         this_ptr_conv.inner = untag_ptr(this_ptr);
58350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58352         this_ptr_conv.is_owned = false;
58353         LDKRevocationKey ret_var = TxCreationKeys_get_revocation_key(&this_ptr_conv);
58354         int64_t ret_ref = 0;
58355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58357         return ret_ref;
58358 }
58359
58360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58361         LDKTxCreationKeys this_ptr_conv;
58362         this_ptr_conv.inner = untag_ptr(this_ptr);
58363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58365         this_ptr_conv.is_owned = false;
58366         LDKRevocationKey val_conv;
58367         val_conv.inner = untag_ptr(val);
58368         val_conv.is_owned = ptr_is_owned(val);
58369         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58370         val_conv = RevocationKey_clone(&val_conv);
58371         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_conv);
58372 }
58373
58374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
58375         LDKTxCreationKeys this_ptr_conv;
58376         this_ptr_conv.inner = untag_ptr(this_ptr);
58377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58379         this_ptr_conv.is_owned = false;
58380         LDKHtlcKey ret_var = TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv);
58381         int64_t ret_ref = 0;
58382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58384         return ret_ref;
58385 }
58386
58387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58388         LDKTxCreationKeys this_ptr_conv;
58389         this_ptr_conv.inner = untag_ptr(this_ptr);
58390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58392         this_ptr_conv.is_owned = false;
58393         LDKHtlcKey val_conv;
58394         val_conv.inner = untag_ptr(val);
58395         val_conv.is_owned = ptr_is_owned(val);
58396         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58397         val_conv = HtlcKey_clone(&val_conv);
58398         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_conv);
58399 }
58400
58401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
58402         LDKTxCreationKeys this_ptr_conv;
58403         this_ptr_conv.inner = untag_ptr(this_ptr);
58404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58406         this_ptr_conv.is_owned = false;
58407         LDKHtlcKey ret_var = TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv);
58408         int64_t ret_ref = 0;
58409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58411         return ret_ref;
58412 }
58413
58414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58415         LDKTxCreationKeys this_ptr_conv;
58416         this_ptr_conv.inner = untag_ptr(this_ptr);
58417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58419         this_ptr_conv.is_owned = false;
58420         LDKHtlcKey val_conv;
58421         val_conv.inner = untag_ptr(val);
58422         val_conv.is_owned = ptr_is_owned(val);
58423         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58424         val_conv = HtlcKey_clone(&val_conv);
58425         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_conv);
58426 }
58427
58428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
58429         LDKTxCreationKeys this_ptr_conv;
58430         this_ptr_conv.inner = untag_ptr(this_ptr);
58431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58433         this_ptr_conv.is_owned = false;
58434         LDKDelayedPaymentKey ret_var = TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv);
58435         int64_t ret_ref = 0;
58436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58438         return ret_ref;
58439 }
58440
58441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58442         LDKTxCreationKeys this_ptr_conv;
58443         this_ptr_conv.inner = untag_ptr(this_ptr);
58444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58446         this_ptr_conv.is_owned = false;
58447         LDKDelayedPaymentKey val_conv;
58448         val_conv.inner = untag_ptr(val);
58449         val_conv.is_owned = ptr_is_owned(val);
58450         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58451         val_conv = DelayedPaymentKey_clone(&val_conv);
58452         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_conv);
58453 }
58454
58455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1new(JNIEnv *env, jclass clz, int8_tArray per_commitment_point_arg, int64_t revocation_key_arg, int64_t broadcaster_htlc_key_arg, int64_t countersignatory_htlc_key_arg, int64_t broadcaster_delayed_payment_key_arg) {
58456         LDKPublicKey per_commitment_point_arg_ref;
58457         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
58458         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
58459         LDKRevocationKey revocation_key_arg_conv;
58460         revocation_key_arg_conv.inner = untag_ptr(revocation_key_arg);
58461         revocation_key_arg_conv.is_owned = ptr_is_owned(revocation_key_arg);
58462         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_arg_conv);
58463         revocation_key_arg_conv = RevocationKey_clone(&revocation_key_arg_conv);
58464         LDKHtlcKey broadcaster_htlc_key_arg_conv;
58465         broadcaster_htlc_key_arg_conv.inner = untag_ptr(broadcaster_htlc_key_arg);
58466         broadcaster_htlc_key_arg_conv.is_owned = ptr_is_owned(broadcaster_htlc_key_arg);
58467         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_key_arg_conv);
58468         broadcaster_htlc_key_arg_conv = HtlcKey_clone(&broadcaster_htlc_key_arg_conv);
58469         LDKHtlcKey countersignatory_htlc_key_arg_conv;
58470         countersignatory_htlc_key_arg_conv.inner = untag_ptr(countersignatory_htlc_key_arg);
58471         countersignatory_htlc_key_arg_conv.is_owned = ptr_is_owned(countersignatory_htlc_key_arg);
58472         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_key_arg_conv);
58473         countersignatory_htlc_key_arg_conv = HtlcKey_clone(&countersignatory_htlc_key_arg_conv);
58474         LDKDelayedPaymentKey broadcaster_delayed_payment_key_arg_conv;
58475         broadcaster_delayed_payment_key_arg_conv.inner = untag_ptr(broadcaster_delayed_payment_key_arg);
58476         broadcaster_delayed_payment_key_arg_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key_arg);
58477         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_arg_conv);
58478         broadcaster_delayed_payment_key_arg_conv = DelayedPaymentKey_clone(&broadcaster_delayed_payment_key_arg_conv);
58479         LDKTxCreationKeys ret_var = TxCreationKeys_new(per_commitment_point_arg_ref, revocation_key_arg_conv, broadcaster_htlc_key_arg_conv, countersignatory_htlc_key_arg_conv, broadcaster_delayed_payment_key_arg_conv);
58480         int64_t ret_ref = 0;
58481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58483         return ret_ref;
58484 }
58485
58486 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58487         LDKTxCreationKeys a_conv;
58488         a_conv.inner = untag_ptr(a);
58489         a_conv.is_owned = ptr_is_owned(a);
58490         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58491         a_conv.is_owned = false;
58492         LDKTxCreationKeys b_conv;
58493         b_conv.inner = untag_ptr(b);
58494         b_conv.is_owned = ptr_is_owned(b);
58495         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58496         b_conv.is_owned = false;
58497         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
58498         return ret_conv;
58499 }
58500
58501 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
58502         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
58503         int64_t ret_ref = 0;
58504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58506         return ret_ref;
58507 }
58508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58509         LDKTxCreationKeys arg_conv;
58510         arg_conv.inner = untag_ptr(arg);
58511         arg_conv.is_owned = ptr_is_owned(arg);
58512         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58513         arg_conv.is_owned = false;
58514         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
58515         return ret_conv;
58516 }
58517
58518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58519         LDKTxCreationKeys orig_conv;
58520         orig_conv.inner = untag_ptr(orig);
58521         orig_conv.is_owned = ptr_is_owned(orig);
58522         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58523         orig_conv.is_owned = false;
58524         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
58525         int64_t ret_ref = 0;
58526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58528         return ret_ref;
58529 }
58530
58531 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
58532         LDKTxCreationKeys obj_conv;
58533         obj_conv.inner = untag_ptr(obj);
58534         obj_conv.is_owned = ptr_is_owned(obj);
58535         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58536         obj_conv.is_owned = false;
58537         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
58538         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58539         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58540         CVec_u8Z_free(ret_var);
58541         return ret_arr;
58542 }
58543
58544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
58545         LDKu8slice ser_ref;
58546         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58547         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58548         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
58549         *ret_conv = TxCreationKeys_read(ser_ref);
58550         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58551         return tag_ptr(ret_conv, true);
58552 }
58553
58554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58555         LDKChannelPublicKeys this_obj_conv;
58556         this_obj_conv.inner = untag_ptr(this_obj);
58557         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58559         ChannelPublicKeys_free(this_obj_conv);
58560 }
58561
58562 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
58563         LDKChannelPublicKeys this_ptr_conv;
58564         this_ptr_conv.inner = untag_ptr(this_ptr);
58565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58567         this_ptr_conv.is_owned = false;
58568         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
58569         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
58570         return ret_arr;
58571 }
58572
58573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58574         LDKChannelPublicKeys this_ptr_conv;
58575         this_ptr_conv.inner = untag_ptr(this_ptr);
58576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58578         this_ptr_conv.is_owned = false;
58579         LDKPublicKey val_ref;
58580         CHECK((*env)->GetArrayLength(env, val) == 33);
58581         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
58582         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
58583 }
58584
58585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
58586         LDKChannelPublicKeys this_ptr_conv;
58587         this_ptr_conv.inner = untag_ptr(this_ptr);
58588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58590         this_ptr_conv.is_owned = false;
58591         LDKRevocationBasepoint ret_var = ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv);
58592         int64_t ret_ref = 0;
58593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58595         return ret_ref;
58596 }
58597
58598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58599         LDKChannelPublicKeys this_ptr_conv;
58600         this_ptr_conv.inner = untag_ptr(this_ptr);
58601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58603         this_ptr_conv.is_owned = false;
58604         LDKRevocationBasepoint val_conv;
58605         val_conv.inner = untag_ptr(val);
58606         val_conv.is_owned = ptr_is_owned(val);
58607         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58608         val_conv = RevocationBasepoint_clone(&val_conv);
58609         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_conv);
58610 }
58611
58612 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
58613         LDKChannelPublicKeys this_ptr_conv;
58614         this_ptr_conv.inner = untag_ptr(this_ptr);
58615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58617         this_ptr_conv.is_owned = false;
58618         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
58619         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
58620         return ret_arr;
58621 }
58622
58623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58624         LDKChannelPublicKeys this_ptr_conv;
58625         this_ptr_conv.inner = untag_ptr(this_ptr);
58626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58628         this_ptr_conv.is_owned = false;
58629         LDKPublicKey val_ref;
58630         CHECK((*env)->GetArrayLength(env, val) == 33);
58631         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
58632         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
58633 }
58634
58635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
58636         LDKChannelPublicKeys this_ptr_conv;
58637         this_ptr_conv.inner = untag_ptr(this_ptr);
58638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58640         this_ptr_conv.is_owned = false;
58641         LDKDelayedPaymentBasepoint ret_var = ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv);
58642         int64_t ret_ref = 0;
58643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58645         return ret_ref;
58646 }
58647
58648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58649         LDKChannelPublicKeys this_ptr_conv;
58650         this_ptr_conv.inner = untag_ptr(this_ptr);
58651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58653         this_ptr_conv.is_owned = false;
58654         LDKDelayedPaymentBasepoint val_conv;
58655         val_conv.inner = untag_ptr(val);
58656         val_conv.is_owned = ptr_is_owned(val);
58657         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58658         val_conv = DelayedPaymentBasepoint_clone(&val_conv);
58659         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_conv);
58660 }
58661
58662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
58663         LDKChannelPublicKeys this_ptr_conv;
58664         this_ptr_conv.inner = untag_ptr(this_ptr);
58665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58667         this_ptr_conv.is_owned = false;
58668         LDKHtlcBasepoint ret_var = ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv);
58669         int64_t ret_ref = 0;
58670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58672         return ret_ref;
58673 }
58674
58675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58676         LDKChannelPublicKeys this_ptr_conv;
58677         this_ptr_conv.inner = untag_ptr(this_ptr);
58678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58680         this_ptr_conv.is_owned = false;
58681         LDKHtlcBasepoint val_conv;
58682         val_conv.inner = untag_ptr(val);
58683         val_conv.is_owned = ptr_is_owned(val);
58684         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58685         val_conv = HtlcBasepoint_clone(&val_conv);
58686         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_conv);
58687 }
58688
58689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1new(JNIEnv *env, jclass clz, int8_tArray funding_pubkey_arg, int64_t revocation_basepoint_arg, int8_tArray payment_point_arg, int64_t delayed_payment_basepoint_arg, int64_t htlc_basepoint_arg) {
58690         LDKPublicKey funding_pubkey_arg_ref;
58691         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
58692         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
58693         LDKRevocationBasepoint revocation_basepoint_arg_conv;
58694         revocation_basepoint_arg_conv.inner = untag_ptr(revocation_basepoint_arg);
58695         revocation_basepoint_arg_conv.is_owned = ptr_is_owned(revocation_basepoint_arg);
58696         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_basepoint_arg_conv);
58697         revocation_basepoint_arg_conv = RevocationBasepoint_clone(&revocation_basepoint_arg_conv);
58698         LDKPublicKey payment_point_arg_ref;
58699         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
58700         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
58701         LDKDelayedPaymentBasepoint delayed_payment_basepoint_arg_conv;
58702         delayed_payment_basepoint_arg_conv.inner = untag_ptr(delayed_payment_basepoint_arg);
58703         delayed_payment_basepoint_arg_conv.is_owned = ptr_is_owned(delayed_payment_basepoint_arg);
58704         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_basepoint_arg_conv);
58705         delayed_payment_basepoint_arg_conv = DelayedPaymentBasepoint_clone(&delayed_payment_basepoint_arg_conv);
58706         LDKHtlcBasepoint htlc_basepoint_arg_conv;
58707         htlc_basepoint_arg_conv.inner = untag_ptr(htlc_basepoint_arg);
58708         htlc_basepoint_arg_conv.is_owned = ptr_is_owned(htlc_basepoint_arg);
58709         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_basepoint_arg_conv);
58710         htlc_basepoint_arg_conv = HtlcBasepoint_clone(&htlc_basepoint_arg_conv);
58711         LDKChannelPublicKeys ret_var = ChannelPublicKeys_new(funding_pubkey_arg_ref, revocation_basepoint_arg_conv, payment_point_arg_ref, delayed_payment_basepoint_arg_conv, htlc_basepoint_arg_conv);
58712         int64_t ret_ref = 0;
58713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58715         return ret_ref;
58716 }
58717
58718 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
58719         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
58720         int64_t ret_ref = 0;
58721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58723         return ret_ref;
58724 }
58725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58726         LDKChannelPublicKeys arg_conv;
58727         arg_conv.inner = untag_ptr(arg);
58728         arg_conv.is_owned = ptr_is_owned(arg);
58729         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58730         arg_conv.is_owned = false;
58731         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
58732         return ret_conv;
58733 }
58734
58735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58736         LDKChannelPublicKeys orig_conv;
58737         orig_conv.inner = untag_ptr(orig);
58738         orig_conv.is_owned = ptr_is_owned(orig);
58739         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58740         orig_conv.is_owned = false;
58741         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
58742         int64_t ret_ref = 0;
58743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58745         return ret_ref;
58746 }
58747
58748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1hash(JNIEnv *env, jclass clz, int64_t o) {
58749         LDKChannelPublicKeys o_conv;
58750         o_conv.inner = untag_ptr(o);
58751         o_conv.is_owned = ptr_is_owned(o);
58752         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58753         o_conv.is_owned = false;
58754         int64_t ret_conv = ChannelPublicKeys_hash(&o_conv);
58755         return ret_conv;
58756 }
58757
58758 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58759         LDKChannelPublicKeys a_conv;
58760         a_conv.inner = untag_ptr(a);
58761         a_conv.is_owned = ptr_is_owned(a);
58762         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58763         a_conv.is_owned = false;
58764         LDKChannelPublicKeys b_conv;
58765         b_conv.inner = untag_ptr(b);
58766         b_conv.is_owned = ptr_is_owned(b);
58767         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58768         b_conv.is_owned = false;
58769         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
58770         return ret_conv;
58771 }
58772
58773 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
58774         LDKChannelPublicKeys obj_conv;
58775         obj_conv.inner = untag_ptr(obj);
58776         obj_conv.is_owned = ptr_is_owned(obj);
58777         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58778         obj_conv.is_owned = false;
58779         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
58780         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58781         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58782         CVec_u8Z_free(ret_var);
58783         return ret_arr;
58784 }
58785
58786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
58787         LDKu8slice ser_ref;
58788         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58789         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58790         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
58791         *ret_conv = ChannelPublicKeys_read(ser_ref);
58792         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58793         return tag_ptr(ret_conv, true);
58794 }
58795
58796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1derive_1new(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int64_t broadcaster_delayed_payment_base, int64_t broadcaster_htlc_base, int64_t countersignatory_revocation_base, int64_t countersignatory_htlc_base) {
58797         LDKPublicKey per_commitment_point_ref;
58798         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
58799         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
58800         LDKDelayedPaymentBasepoint broadcaster_delayed_payment_base_conv;
58801         broadcaster_delayed_payment_base_conv.inner = untag_ptr(broadcaster_delayed_payment_base);
58802         broadcaster_delayed_payment_base_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_base);
58803         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_base_conv);
58804         broadcaster_delayed_payment_base_conv.is_owned = false;
58805         LDKHtlcBasepoint broadcaster_htlc_base_conv;
58806         broadcaster_htlc_base_conv.inner = untag_ptr(broadcaster_htlc_base);
58807         broadcaster_htlc_base_conv.is_owned = ptr_is_owned(broadcaster_htlc_base);
58808         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_base_conv);
58809         broadcaster_htlc_base_conv.is_owned = false;
58810         LDKRevocationBasepoint countersignatory_revocation_base_conv;
58811         countersignatory_revocation_base_conv.inner = untag_ptr(countersignatory_revocation_base);
58812         countersignatory_revocation_base_conv.is_owned = ptr_is_owned(countersignatory_revocation_base);
58813         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_revocation_base_conv);
58814         countersignatory_revocation_base_conv.is_owned = false;
58815         LDKHtlcBasepoint countersignatory_htlc_base_conv;
58816         countersignatory_htlc_base_conv.inner = untag_ptr(countersignatory_htlc_base);
58817         countersignatory_htlc_base_conv.is_owned = ptr_is_owned(countersignatory_htlc_base);
58818         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_base_conv);
58819         countersignatory_htlc_base_conv.is_owned = false;
58820         LDKTxCreationKeys ret_var = TxCreationKeys_derive_new(per_commitment_point_ref, &broadcaster_delayed_payment_base_conv, &broadcaster_htlc_base_conv, &countersignatory_revocation_base_conv, &countersignatory_htlc_base_conv);
58821         int64_t ret_ref = 0;
58822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58824         return ret_ref;
58825 }
58826
58827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1from_1channel_1static_1keys(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int64_t broadcaster_keys, int64_t countersignatory_keys) {
58828         LDKPublicKey per_commitment_point_ref;
58829         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
58830         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
58831         LDKChannelPublicKeys broadcaster_keys_conv;
58832         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
58833         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
58834         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
58835         broadcaster_keys_conv.is_owned = false;
58836         LDKChannelPublicKeys countersignatory_keys_conv;
58837         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
58838         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
58839         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
58840         countersignatory_keys_conv.is_owned = false;
58841         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
58842         int64_t ret_ref = 0;
58843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58845         return ret_ref;
58846 }
58847
58848 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeemscript(JNIEnv *env, jclass clz, int64_t revocation_key, int16_t contest_delay, int64_t broadcaster_delayed_payment_key) {
58849         LDKRevocationKey revocation_key_conv;
58850         revocation_key_conv.inner = untag_ptr(revocation_key);
58851         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
58852         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
58853         revocation_key_conv.is_owned = false;
58854         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
58855         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
58856         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
58857         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
58858         broadcaster_delayed_payment_key_conv.is_owned = false;
58859         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(&revocation_key_conv, contest_delay, &broadcaster_delayed_payment_key_conv);
58860         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58861         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58862         CVec_u8Z_free(ret_var);
58863         return ret_arr;
58864 }
58865
58866 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1counterparty_1payment_1script(JNIEnv *env, jclass clz, int64_t channel_type_features, int8_tArray payment_key) {
58867         LDKChannelTypeFeatures channel_type_features_conv;
58868         channel_type_features_conv.inner = untag_ptr(channel_type_features);
58869         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
58870         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
58871         channel_type_features_conv.is_owned = false;
58872         LDKPublicKey payment_key_ref;
58873         CHECK((*env)->GetArrayLength(env, payment_key) == 33);
58874         (*env)->GetByteArrayRegion(env, payment_key, 0, 33, payment_key_ref.compressed_form);
58875         LDKCVec_u8Z ret_var = get_counterparty_payment_script(&channel_type_features_conv, payment_key_ref);
58876         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58877         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58878         CVec_u8Z_free(ret_var);
58879         return ret_arr;
58880 }
58881
58882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58883         LDKHTLCOutputInCommitment this_obj_conv;
58884         this_obj_conv.inner = untag_ptr(this_obj);
58885         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58887         HTLCOutputInCommitment_free(this_obj_conv);
58888 }
58889
58890 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
58891         LDKHTLCOutputInCommitment this_ptr_conv;
58892         this_ptr_conv.inner = untag_ptr(this_ptr);
58893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58895         this_ptr_conv.is_owned = false;
58896         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
58897         return ret_conv;
58898 }
58899
58900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
58901         LDKHTLCOutputInCommitment this_ptr_conv;
58902         this_ptr_conv.inner = untag_ptr(this_ptr);
58903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58905         this_ptr_conv.is_owned = false;
58906         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
58907 }
58908
58909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
58910         LDKHTLCOutputInCommitment this_ptr_conv;
58911         this_ptr_conv.inner = untag_ptr(this_ptr);
58912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58914         this_ptr_conv.is_owned = false;
58915         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
58916         return ret_conv;
58917 }
58918
58919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58920         LDKHTLCOutputInCommitment this_ptr_conv;
58921         this_ptr_conv.inner = untag_ptr(this_ptr);
58922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58924         this_ptr_conv.is_owned = false;
58925         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
58926 }
58927
58928 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
58929         LDKHTLCOutputInCommitment this_ptr_conv;
58930         this_ptr_conv.inner = untag_ptr(this_ptr);
58931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58933         this_ptr_conv.is_owned = false;
58934         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
58935         return ret_conv;
58936 }
58937
58938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58939         LDKHTLCOutputInCommitment this_ptr_conv;
58940         this_ptr_conv.inner = untag_ptr(this_ptr);
58941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58943         this_ptr_conv.is_owned = false;
58944         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
58945 }
58946
58947 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
58948         LDKHTLCOutputInCommitment this_ptr_conv;
58949         this_ptr_conv.inner = untag_ptr(this_ptr);
58950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58952         this_ptr_conv.is_owned = false;
58953         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58954         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
58955         return ret_arr;
58956 }
58957
58958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58959         LDKHTLCOutputInCommitment this_ptr_conv;
58960         this_ptr_conv.inner = untag_ptr(this_ptr);
58961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58963         this_ptr_conv.is_owned = false;
58964         LDKThirtyTwoBytes val_ref;
58965         CHECK((*env)->GetArrayLength(env, val) == 32);
58966         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
58967         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
58968 }
58969
58970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
58971         LDKHTLCOutputInCommitment this_ptr_conv;
58972         this_ptr_conv.inner = untag_ptr(this_ptr);
58973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58975         this_ptr_conv.is_owned = false;
58976         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
58977         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
58978         int64_t ret_ref = tag_ptr(ret_copy, true);
58979         return ret_ref;
58980 }
58981
58982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58983         LDKHTLCOutputInCommitment this_ptr_conv;
58984         this_ptr_conv.inner = untag_ptr(this_ptr);
58985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58987         this_ptr_conv.is_owned = false;
58988         void* val_ptr = untag_ptr(val);
58989         CHECK_ACCESS(val_ptr);
58990         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
58991         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
58992         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
58993 }
58994
58995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1new(JNIEnv *env, jclass clz, jboolean offered_arg, int64_t amount_msat_arg, int32_t cltv_expiry_arg, int8_tArray payment_hash_arg, int64_t transaction_output_index_arg) {
58996         LDKThirtyTwoBytes payment_hash_arg_ref;
58997         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
58998         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
58999         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
59000         CHECK_ACCESS(transaction_output_index_arg_ptr);
59001         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
59002         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
59003         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
59004         int64_t ret_ref = 0;
59005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59007         return ret_ref;
59008 }
59009
59010 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
59011         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
59012         int64_t ret_ref = 0;
59013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59015         return ret_ref;
59016 }
59017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59018         LDKHTLCOutputInCommitment arg_conv;
59019         arg_conv.inner = untag_ptr(arg);
59020         arg_conv.is_owned = ptr_is_owned(arg);
59021         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59022         arg_conv.is_owned = false;
59023         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
59024         return ret_conv;
59025 }
59026
59027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59028         LDKHTLCOutputInCommitment orig_conv;
59029         orig_conv.inner = untag_ptr(orig);
59030         orig_conv.is_owned = ptr_is_owned(orig);
59031         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59032         orig_conv.is_owned = false;
59033         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
59034         int64_t ret_ref = 0;
59035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59037         return ret_ref;
59038 }
59039
59040 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59041         LDKHTLCOutputInCommitment a_conv;
59042         a_conv.inner = untag_ptr(a);
59043         a_conv.is_owned = ptr_is_owned(a);
59044         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59045         a_conv.is_owned = false;
59046         LDKHTLCOutputInCommitment b_conv;
59047         b_conv.inner = untag_ptr(b);
59048         b_conv.is_owned = ptr_is_owned(b);
59049         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59050         b_conv.is_owned = false;
59051         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
59052         return ret_conv;
59053 }
59054
59055 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
59056         LDKHTLCOutputInCommitment obj_conv;
59057         obj_conv.inner = untag_ptr(obj);
59058         obj_conv.is_owned = ptr_is_owned(obj);
59059         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59060         obj_conv.is_owned = false;
59061         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
59062         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59063         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59064         CVec_u8Z_free(ret_var);
59065         return ret_arr;
59066 }
59067
59068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
59069         LDKu8slice ser_ref;
59070         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
59071         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
59072         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
59073         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
59074         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
59075         return tag_ptr(ret_conv, true);
59076 }
59077
59078 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t channel_type_features, int64_t keys) {
59079         LDKHTLCOutputInCommitment htlc_conv;
59080         htlc_conv.inner = untag_ptr(htlc);
59081         htlc_conv.is_owned = ptr_is_owned(htlc);
59082         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
59083         htlc_conv.is_owned = false;
59084         LDKChannelTypeFeatures channel_type_features_conv;
59085         channel_type_features_conv.inner = untag_ptr(channel_type_features);
59086         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
59087         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
59088         channel_type_features_conv.is_owned = false;
59089         LDKTxCreationKeys keys_conv;
59090         keys_conv.inner = untag_ptr(keys);
59091         keys_conv.is_owned = ptr_is_owned(keys);
59092         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
59093         keys_conv.is_owned = false;
59094         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
59095         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59096         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59097         CVec_u8Z_free(ret_var);
59098         return ret_arr;
59099 }
59100
59101 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
59102         LDKPublicKey broadcaster_ref;
59103         CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
59104         (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
59105         LDKPublicKey countersignatory_ref;
59106         CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
59107         (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
59108         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
59109         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59110         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59111         CVec_u8Z_free(ret_var);
59112         return ret_arr;
59113 }
59114
59115 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv *env, jclass clz, int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, int64_t htlc, int64_t channel_type_features, int64_t broadcaster_delayed_payment_key, int64_t revocation_key) {
59116         uint8_t commitment_txid_arr[32];
59117         CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
59118         (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
59119         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
59120         LDKHTLCOutputInCommitment htlc_conv;
59121         htlc_conv.inner = untag_ptr(htlc);
59122         htlc_conv.is_owned = ptr_is_owned(htlc);
59123         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
59124         htlc_conv.is_owned = false;
59125         LDKChannelTypeFeatures channel_type_features_conv;
59126         channel_type_features_conv.inner = untag_ptr(channel_type_features);
59127         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
59128         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
59129         channel_type_features_conv.is_owned = false;
59130         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
59131         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
59132         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
59133         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
59134         broadcaster_delayed_payment_key_conv.is_owned = false;
59135         LDKRevocationKey revocation_key_conv;
59136         revocation_key_conv.inner = untag_ptr(revocation_key);
59137         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
59138         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
59139         revocation_key_conv.is_owned = false;
59140         LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, &channel_type_features_conv, &broadcaster_delayed_payment_key_conv, &revocation_key_conv);
59141         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59142         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59143         Transaction_free(ret_var);
59144         return ret_arr;
59145 }
59146
59147 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1input_1witness(JNIEnv *env, jclass clz, int8_tArray local_sig, int8_tArray remote_sig, int64_t preimage, int8_tArray redeem_script, int64_t channel_type_features) {
59148         LDKECDSASignature local_sig_ref;
59149         CHECK((*env)->GetArrayLength(env, local_sig) == 64);
59150         (*env)->GetByteArrayRegion(env, local_sig, 0, 64, local_sig_ref.compact_form);
59151         LDKECDSASignature remote_sig_ref;
59152         CHECK((*env)->GetArrayLength(env, remote_sig) == 64);
59153         (*env)->GetByteArrayRegion(env, remote_sig, 0, 64, remote_sig_ref.compact_form);
59154         void* preimage_ptr = untag_ptr(preimage);
59155         CHECK_ACCESS(preimage_ptr);
59156         LDKCOption_ThirtyTwoBytesZ preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_ptr);
59157         preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage));
59158         LDKu8slice redeem_script_ref;
59159         redeem_script_ref.datalen = (*env)->GetArrayLength(env, redeem_script);
59160         redeem_script_ref.data = (*env)->GetByteArrayElements (env, redeem_script, NULL);
59161         LDKChannelTypeFeatures channel_type_features_conv;
59162         channel_type_features_conv.inner = untag_ptr(channel_type_features);
59163         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
59164         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
59165         channel_type_features_conv.is_owned = false;
59166         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
59167         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59168         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59169         Witness_free(ret_var);
59170         (*env)->ReleaseByteArrayElements(env, redeem_script, (int8_t*)redeem_script_ref.data, 0);
59171         return ret_arr;
59172 }
59173
59174 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1to_1countersignatory_1with_1anchors_1redeemscript(JNIEnv *env, jclass clz, int8_tArray payment_point) {
59175         LDKPublicKey payment_point_ref;
59176         CHECK((*env)->GetArrayLength(env, payment_point) == 33);
59177         (*env)->GetByteArrayRegion(env, payment_point, 0, 33, payment_point_ref.compressed_form);
59178         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
59179         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59180         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59181         CVec_u8Z_free(ret_var);
59182         return ret_arr;
59183 }
59184
59185 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
59186         LDKPublicKey funding_pubkey_ref;
59187         CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
59188         (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
59189         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
59190         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59191         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59192         CVec_u8Z_free(ret_var);
59193         return ret_arr;
59194 }
59195
59196 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1anchor_1input_1witness(JNIEnv *env, jclass clz, int8_tArray funding_key, int8_tArray funding_sig) {
59197         LDKPublicKey funding_key_ref;
59198         CHECK((*env)->GetArrayLength(env, funding_key) == 33);
59199         (*env)->GetByteArrayRegion(env, funding_key, 0, 33, funding_key_ref.compressed_form);
59200         LDKECDSASignature funding_sig_ref;
59201         CHECK((*env)->GetArrayLength(env, funding_sig) == 64);
59202         (*env)->GetByteArrayRegion(env, funding_sig, 0, 64, funding_sig_ref.compact_form);
59203         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
59204         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59205         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59206         Witness_free(ret_var);
59207         return ret_arr;
59208 }
59209
59210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59211         LDKChannelTransactionParameters this_obj_conv;
59212         this_obj_conv.inner = untag_ptr(this_obj);
59213         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59215         ChannelTransactionParameters_free(this_obj_conv);
59216 }
59217
59218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
59219         LDKChannelTransactionParameters this_ptr_conv;
59220         this_ptr_conv.inner = untag_ptr(this_ptr);
59221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59223         this_ptr_conv.is_owned = false;
59224         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
59225         int64_t ret_ref = 0;
59226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59228         return ret_ref;
59229 }
59230
59231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59232         LDKChannelTransactionParameters this_ptr_conv;
59233         this_ptr_conv.inner = untag_ptr(this_ptr);
59234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59236         this_ptr_conv.is_owned = false;
59237         LDKChannelPublicKeys val_conv;
59238         val_conv.inner = untag_ptr(val);
59239         val_conv.is_owned = ptr_is_owned(val);
59240         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59241         val_conv = ChannelPublicKeys_clone(&val_conv);
59242         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
59243 }
59244
59245 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
59246         LDKChannelTransactionParameters this_ptr_conv;
59247         this_ptr_conv.inner = untag_ptr(this_ptr);
59248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59250         this_ptr_conv.is_owned = false;
59251         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
59252         return ret_conv;
59253 }
59254
59255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
59256         LDKChannelTransactionParameters this_ptr_conv;
59257         this_ptr_conv.inner = untag_ptr(this_ptr);
59258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59260         this_ptr_conv.is_owned = false;
59261         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
59262 }
59263
59264 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
59265         LDKChannelTransactionParameters this_ptr_conv;
59266         this_ptr_conv.inner = untag_ptr(this_ptr);
59267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59269         this_ptr_conv.is_owned = false;
59270         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
59271         return ret_conv;
59272 }
59273
59274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
59275         LDKChannelTransactionParameters this_ptr_conv;
59276         this_ptr_conv.inner = untag_ptr(this_ptr);
59277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59279         this_ptr_conv.is_owned = false;
59280         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
59281 }
59282
59283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
59284         LDKChannelTransactionParameters this_ptr_conv;
59285         this_ptr_conv.inner = untag_ptr(this_ptr);
59286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59288         this_ptr_conv.is_owned = false;
59289         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
59290         int64_t ret_ref = 0;
59291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59293         return ret_ref;
59294 }
59295
59296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59297         LDKChannelTransactionParameters this_ptr_conv;
59298         this_ptr_conv.inner = untag_ptr(this_ptr);
59299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59301         this_ptr_conv.is_owned = false;
59302         LDKCounterpartyChannelTransactionParameters val_conv;
59303         val_conv.inner = untag_ptr(val);
59304         val_conv.is_owned = ptr_is_owned(val);
59305         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59306         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
59307         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
59308 }
59309
59310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
59311         LDKChannelTransactionParameters this_ptr_conv;
59312         this_ptr_conv.inner = untag_ptr(this_ptr);
59313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59315         this_ptr_conv.is_owned = false;
59316         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
59317         int64_t ret_ref = 0;
59318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59320         return ret_ref;
59321 }
59322
59323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59324         LDKChannelTransactionParameters this_ptr_conv;
59325         this_ptr_conv.inner = untag_ptr(this_ptr);
59326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59328         this_ptr_conv.is_owned = false;
59329         LDKOutPoint val_conv;
59330         val_conv.inner = untag_ptr(val);
59331         val_conv.is_owned = ptr_is_owned(val);
59332         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59333         val_conv = OutPoint_clone(&val_conv);
59334         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
59335 }
59336
59337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
59338         LDKChannelTransactionParameters this_ptr_conv;
59339         this_ptr_conv.inner = untag_ptr(this_ptr);
59340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59342         this_ptr_conv.is_owned = false;
59343         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
59344         int64_t ret_ref = 0;
59345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59347         return ret_ref;
59348 }
59349
59350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59351         LDKChannelTransactionParameters this_ptr_conv;
59352         this_ptr_conv.inner = untag_ptr(this_ptr);
59353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59355         this_ptr_conv.is_owned = false;
59356         LDKChannelTypeFeatures val_conv;
59357         val_conv.inner = untag_ptr(val);
59358         val_conv.is_owned = ptr_is_owned(val);
59359         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59360         val_conv = ChannelTypeFeatures_clone(&val_conv);
59361         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
59362 }
59363
59364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1new(JNIEnv *env, jclass clz, int64_t holder_pubkeys_arg, int16_t holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, int64_t counterparty_parameters_arg, int64_t funding_outpoint_arg, int64_t channel_type_features_arg) {
59365         LDKChannelPublicKeys holder_pubkeys_arg_conv;
59366         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
59367         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
59368         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
59369         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
59370         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
59371         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
59372         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
59373         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
59374         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
59375         LDKOutPoint funding_outpoint_arg_conv;
59376         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
59377         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
59378         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
59379         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
59380         LDKChannelTypeFeatures channel_type_features_arg_conv;
59381         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
59382         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
59383         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
59384         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
59385         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_new(holder_pubkeys_arg_conv, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg_conv, funding_outpoint_arg_conv, channel_type_features_arg_conv);
59386         int64_t ret_ref = 0;
59387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59389         return ret_ref;
59390 }
59391
59392 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
59393         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
59394         int64_t ret_ref = 0;
59395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59397         return ret_ref;
59398 }
59399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59400         LDKChannelTransactionParameters arg_conv;
59401         arg_conv.inner = untag_ptr(arg);
59402         arg_conv.is_owned = ptr_is_owned(arg);
59403         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59404         arg_conv.is_owned = false;
59405         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
59406         return ret_conv;
59407 }
59408
59409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59410         LDKChannelTransactionParameters orig_conv;
59411         orig_conv.inner = untag_ptr(orig);
59412         orig_conv.is_owned = ptr_is_owned(orig);
59413         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59414         orig_conv.is_owned = false;
59415         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
59416         int64_t ret_ref = 0;
59417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59419         return ret_ref;
59420 }
59421
59422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
59423         LDKChannelTransactionParameters o_conv;
59424         o_conv.inner = untag_ptr(o);
59425         o_conv.is_owned = ptr_is_owned(o);
59426         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59427         o_conv.is_owned = false;
59428         int64_t ret_conv = ChannelTransactionParameters_hash(&o_conv);
59429         return ret_conv;
59430 }
59431
59432 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59433         LDKChannelTransactionParameters a_conv;
59434         a_conv.inner = untag_ptr(a);
59435         a_conv.is_owned = ptr_is_owned(a);
59436         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59437         a_conv.is_owned = false;
59438         LDKChannelTransactionParameters b_conv;
59439         b_conv.inner = untag_ptr(b);
59440         b_conv.is_owned = ptr_is_owned(b);
59441         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59442         b_conv.is_owned = false;
59443         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
59444         return ret_conv;
59445 }
59446
59447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59448         LDKCounterpartyChannelTransactionParameters this_obj_conv;
59449         this_obj_conv.inner = untag_ptr(this_obj);
59450         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59452         CounterpartyChannelTransactionParameters_free(this_obj_conv);
59453 }
59454
59455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
59456         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
59457         this_ptr_conv.inner = untag_ptr(this_ptr);
59458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59460         this_ptr_conv.is_owned = false;
59461         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
59462         int64_t ret_ref = 0;
59463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59465         return ret_ref;
59466 }
59467
59468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59469         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
59470         this_ptr_conv.inner = untag_ptr(this_ptr);
59471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59473         this_ptr_conv.is_owned = false;
59474         LDKChannelPublicKeys val_conv;
59475         val_conv.inner = untag_ptr(val);
59476         val_conv.is_owned = ptr_is_owned(val);
59477         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59478         val_conv = ChannelPublicKeys_clone(&val_conv);
59479         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
59480 }
59481
59482 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
59483         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
59484         this_ptr_conv.inner = untag_ptr(this_ptr);
59485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59487         this_ptr_conv.is_owned = false;
59488         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
59489         return ret_conv;
59490 }
59491
59492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
59493         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
59494         this_ptr_conv.inner = untag_ptr(this_ptr);
59495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59497         this_ptr_conv.is_owned = false;
59498         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
59499 }
59500
59501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1new(JNIEnv *env, jclass clz, int64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
59502         LDKChannelPublicKeys pubkeys_arg_conv;
59503         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
59504         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
59505         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
59506         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
59507         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
59508         int64_t ret_ref = 0;
59509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59511         return ret_ref;
59512 }
59513
59514 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
59515         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
59516         int64_t ret_ref = 0;
59517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59519         return ret_ref;
59520 }
59521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59522         LDKCounterpartyChannelTransactionParameters arg_conv;
59523         arg_conv.inner = untag_ptr(arg);
59524         arg_conv.is_owned = ptr_is_owned(arg);
59525         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59526         arg_conv.is_owned = false;
59527         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
59528         return ret_conv;
59529 }
59530
59531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59532         LDKCounterpartyChannelTransactionParameters orig_conv;
59533         orig_conv.inner = untag_ptr(orig);
59534         orig_conv.is_owned = ptr_is_owned(orig);
59535         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59536         orig_conv.is_owned = false;
59537         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
59538         int64_t ret_ref = 0;
59539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59541         return ret_ref;
59542 }
59543
59544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
59545         LDKCounterpartyChannelTransactionParameters o_conv;
59546         o_conv.inner = untag_ptr(o);
59547         o_conv.is_owned = ptr_is_owned(o);
59548         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59549         o_conv.is_owned = false;
59550         int64_t ret_conv = CounterpartyChannelTransactionParameters_hash(&o_conv);
59551         return ret_conv;
59552 }
59553
59554 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59555         LDKCounterpartyChannelTransactionParameters a_conv;
59556         a_conv.inner = untag_ptr(a);
59557         a_conv.is_owned = ptr_is_owned(a);
59558         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59559         a_conv.is_owned = false;
59560         LDKCounterpartyChannelTransactionParameters b_conv;
59561         b_conv.inner = untag_ptr(b);
59562         b_conv.is_owned = ptr_is_owned(b);
59563         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59564         b_conv.is_owned = false;
59565         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
59566         return ret_conv;
59567 }
59568
59569 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
59570         LDKChannelTransactionParameters this_arg_conv;
59571         this_arg_conv.inner = untag_ptr(this_arg);
59572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59574         this_arg_conv.is_owned = false;
59575         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
59576         return ret_conv;
59577 }
59578
59579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
59580         LDKChannelTransactionParameters this_arg_conv;
59581         this_arg_conv.inner = untag_ptr(this_arg);
59582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59584         this_arg_conv.is_owned = false;
59585         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
59586         int64_t ret_ref = 0;
59587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59589         return ret_ref;
59590 }
59591
59592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
59593         LDKChannelTransactionParameters this_arg_conv;
59594         this_arg_conv.inner = untag_ptr(this_arg);
59595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59597         this_arg_conv.is_owned = false;
59598         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
59599         int64_t ret_ref = 0;
59600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59602         return ret_ref;
59603 }
59604
59605 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
59606         LDKCounterpartyChannelTransactionParameters obj_conv;
59607         obj_conv.inner = untag_ptr(obj);
59608         obj_conv.is_owned = ptr_is_owned(obj);
59609         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59610         obj_conv.is_owned = false;
59611         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
59612         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59613         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59614         CVec_u8Z_free(ret_var);
59615         return ret_arr;
59616 }
59617
59618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
59619         LDKu8slice ser_ref;
59620         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
59621         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
59622         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
59623         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
59624         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
59625         return tag_ptr(ret_conv, true);
59626 }
59627
59628 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
59629         LDKChannelTransactionParameters obj_conv;
59630         obj_conv.inner = untag_ptr(obj);
59631         obj_conv.is_owned = ptr_is_owned(obj);
59632         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59633         obj_conv.is_owned = false;
59634         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
59635         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59636         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59637         CVec_u8Z_free(ret_var);
59638         return ret_arr;
59639 }
59640
59641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
59642         LDKu8slice ser_ref;
59643         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
59644         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
59645         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
59646         *ret_conv = ChannelTransactionParameters_read(ser_ref);
59647         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
59648         return tag_ptr(ret_conv, true);
59649 }
59650
59651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59652         LDKDirectedChannelTransactionParameters this_obj_conv;
59653         this_obj_conv.inner = untag_ptr(this_obj);
59654         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59656         DirectedChannelTransactionParameters_free(this_obj_conv);
59657 }
59658
59659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
59660         LDKDirectedChannelTransactionParameters this_arg_conv;
59661         this_arg_conv.inner = untag_ptr(this_arg);
59662         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59664         this_arg_conv.is_owned = false;
59665         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
59666         int64_t ret_ref = 0;
59667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59669         return ret_ref;
59670 }
59671
59672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
59673         LDKDirectedChannelTransactionParameters this_arg_conv;
59674         this_arg_conv.inner = untag_ptr(this_arg);
59675         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59677         this_arg_conv.is_owned = false;
59678         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
59679         int64_t ret_ref = 0;
59680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59682         return ret_ref;
59683 }
59684
59685 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
59686         LDKDirectedChannelTransactionParameters this_arg_conv;
59687         this_arg_conv.inner = untag_ptr(this_arg);
59688         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59690         this_arg_conv.is_owned = false;
59691         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
59692         return ret_conv;
59693 }
59694
59695 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
59696         LDKDirectedChannelTransactionParameters this_arg_conv;
59697         this_arg_conv.inner = untag_ptr(this_arg);
59698         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59700         this_arg_conv.is_owned = false;
59701         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
59702         return ret_conv;
59703 }
59704
59705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
59706         LDKDirectedChannelTransactionParameters this_arg_conv;
59707         this_arg_conv.inner = untag_ptr(this_arg);
59708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59710         this_arg_conv.is_owned = false;
59711         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
59712         int64_t ret_ref = 0;
59713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59715         return ret_ref;
59716 }
59717
59718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
59719         LDKDirectedChannelTransactionParameters this_arg_conv;
59720         this_arg_conv.inner = untag_ptr(this_arg);
59721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59723         this_arg_conv.is_owned = false;
59724         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
59725         int64_t ret_ref = 0;
59726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59728         return ret_ref;
59729 }
59730
59731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59732         LDKHolderCommitmentTransaction this_obj_conv;
59733         this_obj_conv.inner = untag_ptr(this_obj);
59734         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59736         HolderCommitmentTransaction_free(this_obj_conv);
59737 }
59738
59739 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
59740         LDKHolderCommitmentTransaction this_ptr_conv;
59741         this_ptr_conv.inner = untag_ptr(this_ptr);
59742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59744         this_ptr_conv.is_owned = false;
59745         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
59746         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
59747         return ret_arr;
59748 }
59749
59750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59751         LDKHolderCommitmentTransaction this_ptr_conv;
59752         this_ptr_conv.inner = untag_ptr(this_ptr);
59753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59755         this_ptr_conv.is_owned = false;
59756         LDKECDSASignature val_ref;
59757         CHECK((*env)->GetArrayLength(env, val) == 64);
59758         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
59759         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
59760 }
59761
59762 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr) {
59763         LDKHolderCommitmentTransaction this_ptr_conv;
59764         this_ptr_conv.inner = untag_ptr(this_ptr);
59765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59767         this_ptr_conv.is_owned = false;
59768         LDKCVec_ECDSASignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
59769         jobjectArray ret_arr = NULL;
59770         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
59771         ;
59772         for (size_t i = 0; i < ret_var.datalen; i++) {
59773                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
59774                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
59775                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
59776         }
59777         
59778         FREE(ret_var.data);
59779         return ret_arr;
59780 }
59781
59782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
59783         LDKHolderCommitmentTransaction this_ptr_conv;
59784         this_ptr_conv.inner = untag_ptr(this_ptr);
59785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59787         this_ptr_conv.is_owned = false;
59788         LDKCVec_ECDSASignatureZ val_constr;
59789         val_constr.datalen = (*env)->GetArrayLength(env, val);
59790         if (val_constr.datalen > 0)
59791                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
59792         else
59793                 val_constr.data = NULL;
59794         for (size_t i = 0; i < val_constr.datalen; i++) {
59795                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
59796                 LDKECDSASignature val_conv_8_ref;
59797                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
59798                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
59799                 val_constr.data[i] = val_conv_8_ref;
59800         }
59801         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
59802 }
59803
59804 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
59805         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
59806         int64_t ret_ref = 0;
59807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59809         return ret_ref;
59810 }
59811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59812         LDKHolderCommitmentTransaction arg_conv;
59813         arg_conv.inner = untag_ptr(arg);
59814         arg_conv.is_owned = ptr_is_owned(arg);
59815         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59816         arg_conv.is_owned = false;
59817         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
59818         return ret_conv;
59819 }
59820
59821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59822         LDKHolderCommitmentTransaction orig_conv;
59823         orig_conv.inner = untag_ptr(orig);
59824         orig_conv.is_owned = ptr_is_owned(orig);
59825         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59826         orig_conv.is_owned = false;
59827         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
59828         int64_t ret_ref = 0;
59829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59831         return ret_ref;
59832 }
59833
59834 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
59835         LDKHolderCommitmentTransaction obj_conv;
59836         obj_conv.inner = untag_ptr(obj);
59837         obj_conv.is_owned = ptr_is_owned(obj);
59838         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59839         obj_conv.is_owned = false;
59840         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
59841         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59842         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59843         CVec_u8Z_free(ret_var);
59844         return ret_arr;
59845 }
59846
59847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
59848         LDKu8slice ser_ref;
59849         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
59850         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
59851         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
59852         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
59853         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
59854         return tag_ptr(ret_conv, true);
59855 }
59856
59857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1new(JNIEnv *env, jclass clz, int64_t commitment_tx, int8_tArray counterparty_sig, jobjectArray counterparty_htlc_sigs, int8_tArray holder_funding_key, int8_tArray counterparty_funding_key) {
59858         LDKCommitmentTransaction commitment_tx_conv;
59859         commitment_tx_conv.inner = untag_ptr(commitment_tx);
59860         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
59861         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
59862         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
59863         LDKECDSASignature counterparty_sig_ref;
59864         CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
59865         (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
59866         LDKCVec_ECDSASignatureZ counterparty_htlc_sigs_constr;
59867         counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
59868         if (counterparty_htlc_sigs_constr.datalen > 0)
59869                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
59870         else
59871                 counterparty_htlc_sigs_constr.data = NULL;
59872         for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
59873                 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
59874                 LDKECDSASignature counterparty_htlc_sigs_conv_8_ref;
59875                 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
59876                 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
59877                 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
59878         }
59879         LDKPublicKey holder_funding_key_ref;
59880         CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
59881         (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
59882         LDKPublicKey counterparty_funding_key_ref;
59883         CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
59884         (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
59885         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
59886         int64_t ret_ref = 0;
59887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59889         return ret_ref;
59890 }
59891
59892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59893         LDKBuiltCommitmentTransaction this_obj_conv;
59894         this_obj_conv.inner = untag_ptr(this_obj);
59895         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59897         BuiltCommitmentTransaction_free(this_obj_conv);
59898 }
59899
59900 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
59901         LDKBuiltCommitmentTransaction this_ptr_conv;
59902         this_ptr_conv.inner = untag_ptr(this_ptr);
59903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59905         this_ptr_conv.is_owned = false;
59906         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
59907         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59908         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59909         Transaction_free(ret_var);
59910         return ret_arr;
59911 }
59912
59913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59914         LDKBuiltCommitmentTransaction this_ptr_conv;
59915         this_ptr_conv.inner = untag_ptr(this_ptr);
59916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59918         this_ptr_conv.is_owned = false;
59919         LDKTransaction val_ref;
59920         val_ref.datalen = (*env)->GetArrayLength(env, val);
59921         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
59922         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
59923         val_ref.data_is_owned = true;
59924         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
59925 }
59926
59927 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
59928         LDKBuiltCommitmentTransaction this_ptr_conv;
59929         this_ptr_conv.inner = untag_ptr(this_ptr);
59930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59932         this_ptr_conv.is_owned = false;
59933         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59934         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
59935         return ret_arr;
59936 }
59937
59938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59939         LDKBuiltCommitmentTransaction this_ptr_conv;
59940         this_ptr_conv.inner = untag_ptr(this_ptr);
59941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59943         this_ptr_conv.is_owned = false;
59944         LDKThirtyTwoBytes val_ref;
59945         CHECK((*env)->GetArrayLength(env, val) == 32);
59946         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
59947         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
59948 }
59949
59950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
59951         LDKTransaction transaction_arg_ref;
59952         transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
59953         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
59954         (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
59955         transaction_arg_ref.data_is_owned = true;
59956         LDKThirtyTwoBytes txid_arg_ref;
59957         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
59958         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
59959         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
59960         int64_t ret_ref = 0;
59961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59963         return ret_ref;
59964 }
59965
59966 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
59967         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
59968         int64_t ret_ref = 0;
59969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59971         return ret_ref;
59972 }
59973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59974         LDKBuiltCommitmentTransaction arg_conv;
59975         arg_conv.inner = untag_ptr(arg);
59976         arg_conv.is_owned = ptr_is_owned(arg);
59977         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59978         arg_conv.is_owned = false;
59979         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
59980         return ret_conv;
59981 }
59982
59983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59984         LDKBuiltCommitmentTransaction orig_conv;
59985         orig_conv.inner = untag_ptr(orig);
59986         orig_conv.is_owned = ptr_is_owned(orig);
59987         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59988         orig_conv.is_owned = false;
59989         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
59990         int64_t ret_ref = 0;
59991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59993         return ret_ref;
59994 }
59995
59996 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
59997         LDKBuiltCommitmentTransaction obj_conv;
59998         obj_conv.inner = untag_ptr(obj);
59999         obj_conv.is_owned = ptr_is_owned(obj);
60000         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60001         obj_conv.is_owned = false;
60002         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
60003         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60004         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60005         CVec_u8Z_free(ret_var);
60006         return ret_arr;
60007 }
60008
60009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60010         LDKu8slice ser_ref;
60011         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60012         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60013         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
60014         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
60015         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60016         return tag_ptr(ret_conv, true);
60017 }
60018
60019 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1sighash_1all(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
60020         LDKBuiltCommitmentTransaction this_arg_conv;
60021         this_arg_conv.inner = untag_ptr(this_arg);
60022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60024         this_arg_conv.is_owned = false;
60025         LDKu8slice funding_redeemscript_ref;
60026         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
60027         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
60028         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60029         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
60030         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
60031         return ret_arr;
60032 }
60033
60034 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
60035         LDKBuiltCommitmentTransaction this_arg_conv;
60036         this_arg_conv.inner = untag_ptr(this_arg);
60037         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60039         this_arg_conv.is_owned = false;
60040         uint8_t funding_key_arr[32];
60041         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
60042         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
60043         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
60044         LDKu8slice funding_redeemscript_ref;
60045         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
60046         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
60047         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
60048         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign_counterparty_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
60049         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
60050         return ret_arr;
60051 }
60052
60053 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1sign_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis, int64_t entropy_source) {
60054         LDKBuiltCommitmentTransaction this_arg_conv;
60055         this_arg_conv.inner = untag_ptr(this_arg);
60056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60058         this_arg_conv.is_owned = false;
60059         uint8_t funding_key_arr[32];
60060         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
60061         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
60062         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
60063         LDKu8slice funding_redeemscript_ref;
60064         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
60065         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
60066         void* entropy_source_ptr = untag_ptr(entropy_source);
60067         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
60068         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
60069         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
60070         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign_holder_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis, entropy_source_conv).compact_form);
60071         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
60072         return ret_arr;
60073 }
60074
60075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60076         LDKClosingTransaction this_obj_conv;
60077         this_obj_conv.inner = untag_ptr(this_obj);
60078         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60080         ClosingTransaction_free(this_obj_conv);
60081 }
60082
60083 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
60084         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
60085         int64_t ret_ref = 0;
60086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60088         return ret_ref;
60089 }
60090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60091         LDKClosingTransaction arg_conv;
60092         arg_conv.inner = untag_ptr(arg);
60093         arg_conv.is_owned = ptr_is_owned(arg);
60094         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60095         arg_conv.is_owned = false;
60096         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
60097         return ret_conv;
60098 }
60099
60100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60101         LDKClosingTransaction orig_conv;
60102         orig_conv.inner = untag_ptr(orig);
60103         orig_conv.is_owned = ptr_is_owned(orig);
60104         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60105         orig_conv.is_owned = false;
60106         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
60107         int64_t ret_ref = 0;
60108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60110         return ret_ref;
60111 }
60112
60113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
60114         LDKClosingTransaction o_conv;
60115         o_conv.inner = untag_ptr(o);
60116         o_conv.is_owned = ptr_is_owned(o);
60117         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60118         o_conv.is_owned = false;
60119         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
60120         return ret_conv;
60121 }
60122
60123 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60124         LDKClosingTransaction a_conv;
60125         a_conv.inner = untag_ptr(a);
60126         a_conv.is_owned = ptr_is_owned(a);
60127         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60128         a_conv.is_owned = false;
60129         LDKClosingTransaction b_conv;
60130         b_conv.inner = untag_ptr(b);
60131         b_conv.is_owned = ptr_is_owned(b);
60132         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60133         b_conv.is_owned = false;
60134         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
60135         return ret_conv;
60136 }
60137
60138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1new(JNIEnv *env, jclass clz, int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, int64_t funding_outpoint) {
60139         LDKCVec_u8Z to_holder_script_ref;
60140         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
60141         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
60142         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
60143         LDKCVec_u8Z to_counterparty_script_ref;
60144         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
60145         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
60146         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
60147         LDKOutPoint funding_outpoint_conv;
60148         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
60149         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
60150         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
60151         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
60152         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
60153         int64_t ret_ref = 0;
60154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60156         return ret_ref;
60157 }
60158
60159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
60160         LDKClosingTransaction this_arg_conv;
60161         this_arg_conv.inner = untag_ptr(this_arg);
60162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60164         this_arg_conv.is_owned = false;
60165         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
60166         int64_t ret_ref = 0;
60167         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60168         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60169         return ret_ref;
60170 }
60171
60172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
60173         LDKClosingTransaction this_arg_conv;
60174         this_arg_conv.inner = untag_ptr(this_arg);
60175         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60177         this_arg_conv.is_owned = false;
60178         LDKOutPoint funding_outpoint_conv;
60179         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
60180         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
60181         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
60182         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
60183         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
60184         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
60185         return tag_ptr(ret_conv, true);
60186 }
60187
60188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
60189         LDKClosingTransaction this_arg_conv;
60190         this_arg_conv.inner = untag_ptr(this_arg);
60191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60193         this_arg_conv.is_owned = false;
60194         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
60195         return ret_conv;
60196 }
60197
60198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
60199         LDKClosingTransaction this_arg_conv;
60200         this_arg_conv.inner = untag_ptr(this_arg);
60201         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60203         this_arg_conv.is_owned = false;
60204         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
60205         return ret_conv;
60206 }
60207
60208 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
60209         LDKClosingTransaction this_arg_conv;
60210         this_arg_conv.inner = untag_ptr(this_arg);
60211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60213         this_arg_conv.is_owned = false;
60214         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
60215         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60216         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60217         return ret_arr;
60218 }
60219
60220 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
60221         LDKClosingTransaction this_arg_conv;
60222         this_arg_conv.inner = untag_ptr(this_arg);
60223         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60225         this_arg_conv.is_owned = false;
60226         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
60227         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60228         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60229         return ret_arr;
60230 }
60231
60232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60233         LDKTrustedClosingTransaction this_obj_conv;
60234         this_obj_conv.inner = untag_ptr(this_obj);
60235         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60237         TrustedClosingTransaction_free(this_obj_conv);
60238 }
60239
60240 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
60241         LDKTrustedClosingTransaction this_arg_conv;
60242         this_arg_conv.inner = untag_ptr(this_arg);
60243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60245         this_arg_conv.is_owned = false;
60246         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
60247         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60248         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60249         Transaction_free(ret_var);
60250         return ret_arr;
60251 }
60252
60253 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1get_1sighash_1all(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
60254         LDKTrustedClosingTransaction this_arg_conv;
60255         this_arg_conv.inner = untag_ptr(this_arg);
60256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60258         this_arg_conv.is_owned = false;
60259         LDKu8slice funding_redeemscript_ref;
60260         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
60261         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
60262         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60263         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
60264         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
60265         return ret_arr;
60266 }
60267
60268 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1sign(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
60269         LDKTrustedClosingTransaction this_arg_conv;
60270         this_arg_conv.inner = untag_ptr(this_arg);
60271         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60273         this_arg_conv.is_owned = false;
60274         uint8_t funding_key_arr[32];
60275         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
60276         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
60277         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
60278         LDKu8slice funding_redeemscript_ref;
60279         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
60280         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
60281         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
60282         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
60283         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
60284         return ret_arr;
60285 }
60286
60287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60288         LDKCommitmentTransaction this_obj_conv;
60289         this_obj_conv.inner = untag_ptr(this_obj);
60290         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60292         CommitmentTransaction_free(this_obj_conv);
60293 }
60294
60295 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
60296         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
60297         int64_t ret_ref = 0;
60298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60300         return ret_ref;
60301 }
60302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60303         LDKCommitmentTransaction arg_conv;
60304         arg_conv.inner = untag_ptr(arg);
60305         arg_conv.is_owned = ptr_is_owned(arg);
60306         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60307         arg_conv.is_owned = false;
60308         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
60309         return ret_conv;
60310 }
60311
60312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60313         LDKCommitmentTransaction orig_conv;
60314         orig_conv.inner = untag_ptr(orig);
60315         orig_conv.is_owned = ptr_is_owned(orig);
60316         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60317         orig_conv.is_owned = false;
60318         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
60319         int64_t ret_ref = 0;
60320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60322         return ret_ref;
60323 }
60324
60325 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
60326         LDKCommitmentTransaction obj_conv;
60327         obj_conv.inner = untag_ptr(obj);
60328         obj_conv.is_owned = ptr_is_owned(obj);
60329         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60330         obj_conv.is_owned = false;
60331         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
60332         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60333         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60334         CVec_u8Z_free(ret_var);
60335         return ret_arr;
60336 }
60337
60338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60339         LDKu8slice ser_ref;
60340         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60341         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60342         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
60343         *ret_conv = CommitmentTransaction_read(ser_ref);
60344         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60345         return tag_ptr(ret_conv, true);
60346 }
60347
60348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
60349         LDKCommitmentTransaction this_arg_conv;
60350         this_arg_conv.inner = untag_ptr(this_arg);
60351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60353         this_arg_conv.is_owned = false;
60354         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
60355         return ret_conv;
60356 }
60357
60358 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg) {
60359         LDKCommitmentTransaction this_arg_conv;
60360         this_arg_conv.inner = untag_ptr(this_arg);
60361         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60363         this_arg_conv.is_owned = false;
60364         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60365         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommitmentTransaction_per_commitment_point(&this_arg_conv).compressed_form);
60366         return ret_arr;
60367 }
60368
60369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
60370         LDKCommitmentTransaction this_arg_conv;
60371         this_arg_conv.inner = untag_ptr(this_arg);
60372         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60374         this_arg_conv.is_owned = false;
60375         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
60376         return ret_conv;
60377 }
60378
60379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
60380         LDKCommitmentTransaction this_arg_conv;
60381         this_arg_conv.inner = untag_ptr(this_arg);
60382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60384         this_arg_conv.is_owned = false;
60385         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
60386         return ret_conv;
60387 }
60388
60389 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
60390         LDKCommitmentTransaction this_arg_conv;
60391         this_arg_conv.inner = untag_ptr(this_arg);
60392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60394         this_arg_conv.is_owned = false;
60395         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
60396         return ret_conv;
60397 }
60398
60399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
60400         LDKCommitmentTransaction this_arg_conv;
60401         this_arg_conv.inner = untag_ptr(this_arg);
60402         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60404         this_arg_conv.is_owned = false;
60405         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
60406         int64_t ret_ref = 0;
60407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60409         return ret_ref;
60410 }
60411
60412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters, int64_t broadcaster_keys, int64_t countersignatory_keys) {
60413         LDKCommitmentTransaction this_arg_conv;
60414         this_arg_conv.inner = untag_ptr(this_arg);
60415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60417         this_arg_conv.is_owned = false;
60418         LDKDirectedChannelTransactionParameters channel_parameters_conv;
60419         channel_parameters_conv.inner = untag_ptr(channel_parameters);
60420         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
60421         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
60422         channel_parameters_conv.is_owned = false;
60423         LDKChannelPublicKeys broadcaster_keys_conv;
60424         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
60425         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
60426         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
60427         broadcaster_keys_conv.is_owned = false;
60428         LDKChannelPublicKeys countersignatory_keys_conv;
60429         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
60430         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
60431         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
60432         countersignatory_keys_conv.is_owned = false;
60433         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
60434         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
60435         return tag_ptr(ret_conv, true);
60436 }
60437
60438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60439         LDKTrustedCommitmentTransaction this_obj_conv;
60440         this_obj_conv.inner = untag_ptr(this_obj);
60441         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60443         TrustedCommitmentTransaction_free(this_obj_conv);
60444 }
60445
60446 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
60447         LDKTrustedCommitmentTransaction this_arg_conv;
60448         this_arg_conv.inner = untag_ptr(this_arg);
60449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60451         this_arg_conv.is_owned = false;
60452         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60453         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
60454         return ret_arr;
60455 }
60456
60457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
60458         LDKTrustedCommitmentTransaction this_arg_conv;
60459         this_arg_conv.inner = untag_ptr(this_arg);
60460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60462         this_arg_conv.is_owned = false;
60463         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
60464         int64_t ret_ref = 0;
60465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60467         return ret_ref;
60468 }
60469
60470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
60471         LDKTrustedCommitmentTransaction this_arg_conv;
60472         this_arg_conv.inner = untag_ptr(this_arg);
60473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60475         this_arg_conv.is_owned = false;
60476         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
60477         int64_t ret_ref = 0;
60478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60480         return ret_ref;
60481 }
60482
60483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
60484         LDKTrustedCommitmentTransaction this_arg_conv;
60485         this_arg_conv.inner = untag_ptr(this_arg);
60486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60488         this_arg_conv.is_owned = false;
60489         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
60490         int64_t ret_ref = 0;
60491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60493         return ret_ref;
60494 }
60495
60496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1get_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_base_key, int64_t channel_parameters, int64_t entropy_source) {
60497         LDKTrustedCommitmentTransaction this_arg_conv;
60498         this_arg_conv.inner = untag_ptr(this_arg);
60499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60501         this_arg_conv.is_owned = false;
60502         uint8_t htlc_base_key_arr[32];
60503         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
60504         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
60505         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
60506         LDKDirectedChannelTransactionParameters channel_parameters_conv;
60507         channel_parameters_conv.inner = untag_ptr(channel_parameters);
60508         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
60509         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
60510         channel_parameters_conv.is_owned = false;
60511         void* entropy_source_ptr = untag_ptr(entropy_source);
60512         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
60513         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
60514         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
60515         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
60516         return tag_ptr(ret_conv, true);
60517 }
60518
60519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1revokeable_1output_1index(JNIEnv *env, jclass clz, int64_t this_arg) {
60520         LDKTrustedCommitmentTransaction this_arg_conv;
60521         this_arg_conv.inner = untag_ptr(this_arg);
60522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60524         this_arg_conv.is_owned = false;
60525         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
60526         *ret_copy = TrustedCommitmentTransaction_revokeable_output_index(&this_arg_conv);
60527         int64_t ret_ref = tag_ptr(ret_copy, true);
60528         return ret_ref;
60529 }
60530
60531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1build_1to_1local_1justice_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int64_t feerate_per_kw, int8_tArray destination_script) {
60532         LDKTrustedCommitmentTransaction this_arg_conv;
60533         this_arg_conv.inner = untag_ptr(this_arg);
60534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60536         this_arg_conv.is_owned = false;
60537         LDKCVec_u8Z destination_script_ref;
60538         destination_script_ref.datalen = (*env)->GetArrayLength(env, destination_script);
60539         destination_script_ref.data = MALLOC(destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
60540         (*env)->GetByteArrayRegion(env, destination_script, 0, destination_script_ref.datalen, destination_script_ref.data);
60541         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
60542         *ret_conv = TrustedCommitmentTransaction_build_to_local_justice_tx(&this_arg_conv, feerate_per_kw, destination_script_ref);
60543         return tag_ptr(ret_conv, true);
60544 }
60545
60546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1commitment_1transaction_1number_1obscure_1factor(JNIEnv *env, jclass clz, int8_tArray broadcaster_payment_basepoint, int8_tArray countersignatory_payment_basepoint, jboolean outbound_from_broadcaster) {
60547         LDKPublicKey broadcaster_payment_basepoint_ref;
60548         CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
60549         (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
60550         LDKPublicKey countersignatory_payment_basepoint_ref;
60551         CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
60552         (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
60553         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
60554         return ret_conv;
60555 }
60556
60557 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60558         LDKInitFeatures a_conv;
60559         a_conv.inner = untag_ptr(a);
60560         a_conv.is_owned = ptr_is_owned(a);
60561         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60562         a_conv.is_owned = false;
60563         LDKInitFeatures b_conv;
60564         b_conv.inner = untag_ptr(b);
60565         b_conv.is_owned = ptr_is_owned(b);
60566         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60567         b_conv.is_owned = false;
60568         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
60569         return ret_conv;
60570 }
60571
60572 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60573         LDKNodeFeatures a_conv;
60574         a_conv.inner = untag_ptr(a);
60575         a_conv.is_owned = ptr_is_owned(a);
60576         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60577         a_conv.is_owned = false;
60578         LDKNodeFeatures b_conv;
60579         b_conv.inner = untag_ptr(b);
60580         b_conv.is_owned = ptr_is_owned(b);
60581         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60582         b_conv.is_owned = false;
60583         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
60584         return ret_conv;
60585 }
60586
60587 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60588         LDKChannelFeatures a_conv;
60589         a_conv.inner = untag_ptr(a);
60590         a_conv.is_owned = ptr_is_owned(a);
60591         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60592         a_conv.is_owned = false;
60593         LDKChannelFeatures b_conv;
60594         b_conv.inner = untag_ptr(b);
60595         b_conv.is_owned = ptr_is_owned(b);
60596         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60597         b_conv.is_owned = false;
60598         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
60599         return ret_conv;
60600 }
60601
60602 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60603         LDKBolt11InvoiceFeatures a_conv;
60604         a_conv.inner = untag_ptr(a);
60605         a_conv.is_owned = ptr_is_owned(a);
60606         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60607         a_conv.is_owned = false;
60608         LDKBolt11InvoiceFeatures b_conv;
60609         b_conv.inner = untag_ptr(b);
60610         b_conv.is_owned = ptr_is_owned(b);
60611         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60612         b_conv.is_owned = false;
60613         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
60614         return ret_conv;
60615 }
60616
60617 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60618         LDKOfferFeatures a_conv;
60619         a_conv.inner = untag_ptr(a);
60620         a_conv.is_owned = ptr_is_owned(a);
60621         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60622         a_conv.is_owned = false;
60623         LDKOfferFeatures b_conv;
60624         b_conv.inner = untag_ptr(b);
60625         b_conv.is_owned = ptr_is_owned(b);
60626         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60627         b_conv.is_owned = false;
60628         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
60629         return ret_conv;
60630 }
60631
60632 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60633         LDKInvoiceRequestFeatures a_conv;
60634         a_conv.inner = untag_ptr(a);
60635         a_conv.is_owned = ptr_is_owned(a);
60636         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60637         a_conv.is_owned = false;
60638         LDKInvoiceRequestFeatures b_conv;
60639         b_conv.inner = untag_ptr(b);
60640         b_conv.is_owned = ptr_is_owned(b);
60641         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60642         b_conv.is_owned = false;
60643         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
60644         return ret_conv;
60645 }
60646
60647 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60648         LDKBolt12InvoiceFeatures a_conv;
60649         a_conv.inner = untag_ptr(a);
60650         a_conv.is_owned = ptr_is_owned(a);
60651         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60652         a_conv.is_owned = false;
60653         LDKBolt12InvoiceFeatures b_conv;
60654         b_conv.inner = untag_ptr(b);
60655         b_conv.is_owned = ptr_is_owned(b);
60656         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60657         b_conv.is_owned = false;
60658         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
60659         return ret_conv;
60660 }
60661
60662 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60663         LDKBlindedHopFeatures a_conv;
60664         a_conv.inner = untag_ptr(a);
60665         a_conv.is_owned = ptr_is_owned(a);
60666         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60667         a_conv.is_owned = false;
60668         LDKBlindedHopFeatures b_conv;
60669         b_conv.inner = untag_ptr(b);
60670         b_conv.is_owned = ptr_is_owned(b);
60671         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60672         b_conv.is_owned = false;
60673         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
60674         return ret_conv;
60675 }
60676
60677 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60678         LDKChannelTypeFeatures a_conv;
60679         a_conv.inner = untag_ptr(a);
60680         a_conv.is_owned = ptr_is_owned(a);
60681         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60682         a_conv.is_owned = false;
60683         LDKChannelTypeFeatures b_conv;
60684         b_conv.inner = untag_ptr(b);
60685         b_conv.is_owned = ptr_is_owned(b);
60686         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60687         b_conv.is_owned = false;
60688         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
60689         return ret_conv;
60690 }
60691
60692 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
60693         LDKInitFeatures ret_var = InitFeatures_clone(arg);
60694         int64_t ret_ref = 0;
60695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60697         return ret_ref;
60698 }
60699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60700         LDKInitFeatures arg_conv;
60701         arg_conv.inner = untag_ptr(arg);
60702         arg_conv.is_owned = ptr_is_owned(arg);
60703         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60704         arg_conv.is_owned = false;
60705         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
60706         return ret_conv;
60707 }
60708
60709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60710         LDKInitFeatures orig_conv;
60711         orig_conv.inner = untag_ptr(orig);
60712         orig_conv.is_owned = ptr_is_owned(orig);
60713         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60714         orig_conv.is_owned = false;
60715         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
60716         int64_t ret_ref = 0;
60717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60719         return ret_ref;
60720 }
60721
60722 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
60723         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
60724         int64_t ret_ref = 0;
60725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60727         return ret_ref;
60728 }
60729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60730         LDKNodeFeatures arg_conv;
60731         arg_conv.inner = untag_ptr(arg);
60732         arg_conv.is_owned = ptr_is_owned(arg);
60733         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60734         arg_conv.is_owned = false;
60735         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
60736         return ret_conv;
60737 }
60738
60739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60740         LDKNodeFeatures orig_conv;
60741         orig_conv.inner = untag_ptr(orig);
60742         orig_conv.is_owned = ptr_is_owned(orig);
60743         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60744         orig_conv.is_owned = false;
60745         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
60746         int64_t ret_ref = 0;
60747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60749         return ret_ref;
60750 }
60751
60752 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
60753         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
60754         int64_t ret_ref = 0;
60755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60757         return ret_ref;
60758 }
60759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60760         LDKChannelFeatures arg_conv;
60761         arg_conv.inner = untag_ptr(arg);
60762         arg_conv.is_owned = ptr_is_owned(arg);
60763         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60764         arg_conv.is_owned = false;
60765         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
60766         return ret_conv;
60767 }
60768
60769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60770         LDKChannelFeatures orig_conv;
60771         orig_conv.inner = untag_ptr(orig);
60772         orig_conv.is_owned = ptr_is_owned(orig);
60773         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60774         orig_conv.is_owned = false;
60775         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
60776         int64_t ret_ref = 0;
60777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60779         return ret_ref;
60780 }
60781
60782 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
60783         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
60784         int64_t ret_ref = 0;
60785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60787         return ret_ref;
60788 }
60789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60790         LDKBolt11InvoiceFeatures arg_conv;
60791         arg_conv.inner = untag_ptr(arg);
60792         arg_conv.is_owned = ptr_is_owned(arg);
60793         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60794         arg_conv.is_owned = false;
60795         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
60796         return ret_conv;
60797 }
60798
60799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60800         LDKBolt11InvoiceFeatures orig_conv;
60801         orig_conv.inner = untag_ptr(orig);
60802         orig_conv.is_owned = ptr_is_owned(orig);
60803         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60804         orig_conv.is_owned = false;
60805         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
60806         int64_t ret_ref = 0;
60807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60809         return ret_ref;
60810 }
60811
60812 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
60813         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
60814         int64_t ret_ref = 0;
60815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60817         return ret_ref;
60818 }
60819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60820         LDKOfferFeatures arg_conv;
60821         arg_conv.inner = untag_ptr(arg);
60822         arg_conv.is_owned = ptr_is_owned(arg);
60823         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60824         arg_conv.is_owned = false;
60825         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
60826         return ret_conv;
60827 }
60828
60829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60830         LDKOfferFeatures orig_conv;
60831         orig_conv.inner = untag_ptr(orig);
60832         orig_conv.is_owned = ptr_is_owned(orig);
60833         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60834         orig_conv.is_owned = false;
60835         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
60836         int64_t ret_ref = 0;
60837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60839         return ret_ref;
60840 }
60841
60842 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
60843         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
60844         int64_t ret_ref = 0;
60845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60846         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60847         return ret_ref;
60848 }
60849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60850         LDKInvoiceRequestFeatures arg_conv;
60851         arg_conv.inner = untag_ptr(arg);
60852         arg_conv.is_owned = ptr_is_owned(arg);
60853         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60854         arg_conv.is_owned = false;
60855         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
60856         return ret_conv;
60857 }
60858
60859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60860         LDKInvoiceRequestFeatures orig_conv;
60861         orig_conv.inner = untag_ptr(orig);
60862         orig_conv.is_owned = ptr_is_owned(orig);
60863         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60864         orig_conv.is_owned = false;
60865         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
60866         int64_t ret_ref = 0;
60867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60869         return ret_ref;
60870 }
60871
60872 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
60873         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
60874         int64_t ret_ref = 0;
60875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60877         return ret_ref;
60878 }
60879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60880         LDKBolt12InvoiceFeatures arg_conv;
60881         arg_conv.inner = untag_ptr(arg);
60882         arg_conv.is_owned = ptr_is_owned(arg);
60883         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60884         arg_conv.is_owned = false;
60885         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
60886         return ret_conv;
60887 }
60888
60889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60890         LDKBolt12InvoiceFeatures orig_conv;
60891         orig_conv.inner = untag_ptr(orig);
60892         orig_conv.is_owned = ptr_is_owned(orig);
60893         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60894         orig_conv.is_owned = false;
60895         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
60896         int64_t ret_ref = 0;
60897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60899         return ret_ref;
60900 }
60901
60902 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
60903         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
60904         int64_t ret_ref = 0;
60905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60907         return ret_ref;
60908 }
60909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60910         LDKBlindedHopFeatures arg_conv;
60911         arg_conv.inner = untag_ptr(arg);
60912         arg_conv.is_owned = ptr_is_owned(arg);
60913         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60914         arg_conv.is_owned = false;
60915         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
60916         return ret_conv;
60917 }
60918
60919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60920         LDKBlindedHopFeatures orig_conv;
60921         orig_conv.inner = untag_ptr(orig);
60922         orig_conv.is_owned = ptr_is_owned(orig);
60923         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60924         orig_conv.is_owned = false;
60925         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
60926         int64_t ret_ref = 0;
60927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60929         return ret_ref;
60930 }
60931
60932 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
60933         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
60934         int64_t ret_ref = 0;
60935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60937         return ret_ref;
60938 }
60939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60940         LDKChannelTypeFeatures arg_conv;
60941         arg_conv.inner = untag_ptr(arg);
60942         arg_conv.is_owned = ptr_is_owned(arg);
60943         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60944         arg_conv.is_owned = false;
60945         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
60946         return ret_conv;
60947 }
60948
60949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60950         LDKChannelTypeFeatures orig_conv;
60951         orig_conv.inner = untag_ptr(orig);
60952         orig_conv.is_owned = ptr_is_owned(orig);
60953         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60954         orig_conv.is_owned = false;
60955         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
60956         int64_t ret_ref = 0;
60957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60959         return ret_ref;
60960 }
60961
60962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
60963         LDKInitFeatures o_conv;
60964         o_conv.inner = untag_ptr(o);
60965         o_conv.is_owned = ptr_is_owned(o);
60966         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60967         o_conv.is_owned = false;
60968         int64_t ret_conv = InitFeatures_hash(&o_conv);
60969         return ret_conv;
60970 }
60971
60972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
60973         LDKNodeFeatures o_conv;
60974         o_conv.inner = untag_ptr(o);
60975         o_conv.is_owned = ptr_is_owned(o);
60976         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60977         o_conv.is_owned = false;
60978         int64_t ret_conv = NodeFeatures_hash(&o_conv);
60979         return ret_conv;
60980 }
60981
60982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
60983         LDKChannelFeatures o_conv;
60984         o_conv.inner = untag_ptr(o);
60985         o_conv.is_owned = ptr_is_owned(o);
60986         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60987         o_conv.is_owned = false;
60988         int64_t ret_conv = ChannelFeatures_hash(&o_conv);
60989         return ret_conv;
60990 }
60991
60992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
60993         LDKBolt11InvoiceFeatures o_conv;
60994         o_conv.inner = untag_ptr(o);
60995         o_conv.is_owned = ptr_is_owned(o);
60996         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60997         o_conv.is_owned = false;
60998         int64_t ret_conv = Bolt11InvoiceFeatures_hash(&o_conv);
60999         return ret_conv;
61000 }
61001
61002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
61003         LDKOfferFeatures o_conv;
61004         o_conv.inner = untag_ptr(o);
61005         o_conv.is_owned = ptr_is_owned(o);
61006         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61007         o_conv.is_owned = false;
61008         int64_t ret_conv = OfferFeatures_hash(&o_conv);
61009         return ret_conv;
61010 }
61011
61012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
61013         LDKInvoiceRequestFeatures o_conv;
61014         o_conv.inner = untag_ptr(o);
61015         o_conv.is_owned = ptr_is_owned(o);
61016         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61017         o_conv.is_owned = false;
61018         int64_t ret_conv = InvoiceRequestFeatures_hash(&o_conv);
61019         return ret_conv;
61020 }
61021
61022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
61023         LDKBolt12InvoiceFeatures o_conv;
61024         o_conv.inner = untag_ptr(o);
61025         o_conv.is_owned = ptr_is_owned(o);
61026         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61027         o_conv.is_owned = false;
61028         int64_t ret_conv = Bolt12InvoiceFeatures_hash(&o_conv);
61029         return ret_conv;
61030 }
61031
61032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
61033         LDKBlindedHopFeatures o_conv;
61034         o_conv.inner = untag_ptr(o);
61035         o_conv.is_owned = ptr_is_owned(o);
61036         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61037         o_conv.is_owned = false;
61038         int64_t ret_conv = BlindedHopFeatures_hash(&o_conv);
61039         return ret_conv;
61040 }
61041
61042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
61043         LDKChannelTypeFeatures o_conv;
61044         o_conv.inner = untag_ptr(o);
61045         o_conv.is_owned = ptr_is_owned(o);
61046         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61047         o_conv.is_owned = false;
61048         int64_t ret_conv = ChannelTypeFeatures_hash(&o_conv);
61049         return ret_conv;
61050 }
61051
61052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61053         LDKInitFeatures this_obj_conv;
61054         this_obj_conv.inner = untag_ptr(this_obj);
61055         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61057         InitFeatures_free(this_obj_conv);
61058 }
61059
61060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61061         LDKNodeFeatures this_obj_conv;
61062         this_obj_conv.inner = untag_ptr(this_obj);
61063         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61065         NodeFeatures_free(this_obj_conv);
61066 }
61067
61068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61069         LDKChannelFeatures this_obj_conv;
61070         this_obj_conv.inner = untag_ptr(this_obj);
61071         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61073         ChannelFeatures_free(this_obj_conv);
61074 }
61075
61076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61077         LDKBolt11InvoiceFeatures this_obj_conv;
61078         this_obj_conv.inner = untag_ptr(this_obj);
61079         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61081         Bolt11InvoiceFeatures_free(this_obj_conv);
61082 }
61083
61084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61085         LDKOfferFeatures this_obj_conv;
61086         this_obj_conv.inner = untag_ptr(this_obj);
61087         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61089         OfferFeatures_free(this_obj_conv);
61090 }
61091
61092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61093         LDKInvoiceRequestFeatures this_obj_conv;
61094         this_obj_conv.inner = untag_ptr(this_obj);
61095         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61097         InvoiceRequestFeatures_free(this_obj_conv);
61098 }
61099
61100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61101         LDKBolt12InvoiceFeatures this_obj_conv;
61102         this_obj_conv.inner = untag_ptr(this_obj);
61103         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61105         Bolt12InvoiceFeatures_free(this_obj_conv);
61106 }
61107
61108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61109         LDKBlindedHopFeatures this_obj_conv;
61110         this_obj_conv.inner = untag_ptr(this_obj);
61111         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61113         BlindedHopFeatures_free(this_obj_conv);
61114 }
61115
61116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61117         LDKChannelTypeFeatures this_obj_conv;
61118         this_obj_conv.inner = untag_ptr(this_obj);
61119         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61121         ChannelTypeFeatures_free(this_obj_conv);
61122 }
61123
61124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
61125         LDKInitFeatures ret_var = InitFeatures_empty();
61126         int64_t ret_ref = 0;
61127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61129         return ret_ref;
61130 }
61131
61132 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
61133         LDKInitFeatures this_arg_conv;
61134         this_arg_conv.inner = untag_ptr(this_arg);
61135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61137         this_arg_conv.is_owned = false;
61138         LDKInitFeatures other_conv;
61139         other_conv.inner = untag_ptr(other);
61140         other_conv.is_owned = ptr_is_owned(other);
61141         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61142         other_conv.is_owned = false;
61143         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61144         return ret_conv;
61145 }
61146
61147 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
61148         LDKInitFeatures this_arg_conv;
61149         this_arg_conv.inner = untag_ptr(this_arg);
61150         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61152         this_arg_conv.is_owned = false;
61153         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
61154         return ret_conv;
61155 }
61156
61157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1required_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61158         LDKInitFeatures this_arg_conv;
61159         this_arg_conv.inner = untag_ptr(this_arg);
61160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61162         this_arg_conv.is_owned = false;
61163         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61164         *ret_conv = InitFeatures_set_required_feature_bit(&this_arg_conv, bit);
61165         return tag_ptr(ret_conv, true);
61166 }
61167
61168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1optional_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61169         LDKInitFeatures this_arg_conv;
61170         this_arg_conv.inner = untag_ptr(this_arg);
61171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61173         this_arg_conv.is_owned = false;
61174         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61175         *ret_conv = InitFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61176         return tag_ptr(ret_conv, true);
61177 }
61178
61179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61180         LDKInitFeatures this_arg_conv;
61181         this_arg_conv.inner = untag_ptr(this_arg);
61182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61184         this_arg_conv.is_owned = false;
61185         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61186         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
61187         return tag_ptr(ret_conv, true);
61188 }
61189
61190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61191         LDKInitFeatures this_arg_conv;
61192         this_arg_conv.inner = untag_ptr(this_arg);
61193         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61195         this_arg_conv.is_owned = false;
61196         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61197         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61198         return tag_ptr(ret_conv, true);
61199 }
61200
61201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
61202         LDKNodeFeatures ret_var = NodeFeatures_empty();
61203         int64_t ret_ref = 0;
61204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61206         return ret_ref;
61207 }
61208
61209 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
61210         LDKNodeFeatures this_arg_conv;
61211         this_arg_conv.inner = untag_ptr(this_arg);
61212         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61214         this_arg_conv.is_owned = false;
61215         LDKNodeFeatures other_conv;
61216         other_conv.inner = untag_ptr(other);
61217         other_conv.is_owned = ptr_is_owned(other);
61218         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61219         other_conv.is_owned = false;
61220         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61221         return ret_conv;
61222 }
61223
61224 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
61225         LDKNodeFeatures this_arg_conv;
61226         this_arg_conv.inner = untag_ptr(this_arg);
61227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61229         this_arg_conv.is_owned = false;
61230         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
61231         return ret_conv;
61232 }
61233
61234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1required_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61235         LDKNodeFeatures this_arg_conv;
61236         this_arg_conv.inner = untag_ptr(this_arg);
61237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61239         this_arg_conv.is_owned = false;
61240         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61241         *ret_conv = NodeFeatures_set_required_feature_bit(&this_arg_conv, bit);
61242         return tag_ptr(ret_conv, true);
61243 }
61244
61245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1optional_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61246         LDKNodeFeatures this_arg_conv;
61247         this_arg_conv.inner = untag_ptr(this_arg);
61248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61250         this_arg_conv.is_owned = false;
61251         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61252         *ret_conv = NodeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61253         return tag_ptr(ret_conv, true);
61254 }
61255
61256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61257         LDKNodeFeatures this_arg_conv;
61258         this_arg_conv.inner = untag_ptr(this_arg);
61259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61261         this_arg_conv.is_owned = false;
61262         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61263         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
61264         return tag_ptr(ret_conv, true);
61265 }
61266
61267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61268         LDKNodeFeatures this_arg_conv;
61269         this_arg_conv.inner = untag_ptr(this_arg);
61270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61272         this_arg_conv.is_owned = false;
61273         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61274         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61275         return tag_ptr(ret_conv, true);
61276 }
61277
61278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
61279         LDKChannelFeatures ret_var = ChannelFeatures_empty();
61280         int64_t ret_ref = 0;
61281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61283         return ret_ref;
61284 }
61285
61286 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
61287         LDKChannelFeatures this_arg_conv;
61288         this_arg_conv.inner = untag_ptr(this_arg);
61289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61291         this_arg_conv.is_owned = false;
61292         LDKChannelFeatures other_conv;
61293         other_conv.inner = untag_ptr(other);
61294         other_conv.is_owned = ptr_is_owned(other);
61295         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61296         other_conv.is_owned = false;
61297         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61298         return ret_conv;
61299 }
61300
61301 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
61302         LDKChannelFeatures this_arg_conv;
61303         this_arg_conv.inner = untag_ptr(this_arg);
61304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61306         this_arg_conv.is_owned = false;
61307         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
61308         return ret_conv;
61309 }
61310
61311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1set_1required_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61312         LDKChannelFeatures this_arg_conv;
61313         this_arg_conv.inner = untag_ptr(this_arg);
61314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61316         this_arg_conv.is_owned = false;
61317         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61318         *ret_conv = ChannelFeatures_set_required_feature_bit(&this_arg_conv, bit);
61319         return tag_ptr(ret_conv, true);
61320 }
61321
61322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1set_1optional_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61323         LDKChannelFeatures this_arg_conv;
61324         this_arg_conv.inner = untag_ptr(this_arg);
61325         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61327         this_arg_conv.is_owned = false;
61328         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61329         *ret_conv = ChannelFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61330         return tag_ptr(ret_conv, true);
61331 }
61332
61333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61334         LDKChannelFeatures this_arg_conv;
61335         this_arg_conv.inner = untag_ptr(this_arg);
61336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61338         this_arg_conv.is_owned = false;
61339         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61340         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
61341         return tag_ptr(ret_conv, true);
61342 }
61343
61344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61345         LDKChannelFeatures this_arg_conv;
61346         this_arg_conv.inner = untag_ptr(this_arg);
61347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61349         this_arg_conv.is_owned = false;
61350         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61351         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61352         return tag_ptr(ret_conv, true);
61353 }
61354
61355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
61356         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
61357         int64_t ret_ref = 0;
61358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61360         return ret_ref;
61361 }
61362
61363 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
61364         LDKBolt11InvoiceFeatures this_arg_conv;
61365         this_arg_conv.inner = untag_ptr(this_arg);
61366         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61368         this_arg_conv.is_owned = false;
61369         LDKBolt11InvoiceFeatures other_conv;
61370         other_conv.inner = untag_ptr(other);
61371         other_conv.is_owned = ptr_is_owned(other);
61372         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61373         other_conv.is_owned = false;
61374         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61375         return ret_conv;
61376 }
61377
61378 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
61379         LDKBolt11InvoiceFeatures this_arg_conv;
61380         this_arg_conv.inner = untag_ptr(this_arg);
61381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61383         this_arg_conv.is_owned = false;
61384         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
61385         return ret_conv;
61386 }
61387
61388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1required_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61389         LDKBolt11InvoiceFeatures this_arg_conv;
61390         this_arg_conv.inner = untag_ptr(this_arg);
61391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61393         this_arg_conv.is_owned = false;
61394         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61395         *ret_conv = Bolt11InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
61396         return tag_ptr(ret_conv, true);
61397 }
61398
61399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1optional_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61400         LDKBolt11InvoiceFeatures this_arg_conv;
61401         this_arg_conv.inner = untag_ptr(this_arg);
61402         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61404         this_arg_conv.is_owned = false;
61405         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61406         *ret_conv = Bolt11InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61407         return tag_ptr(ret_conv, true);
61408 }
61409
61410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61411         LDKBolt11InvoiceFeatures this_arg_conv;
61412         this_arg_conv.inner = untag_ptr(this_arg);
61413         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61415         this_arg_conv.is_owned = false;
61416         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61417         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
61418         return tag_ptr(ret_conv, true);
61419 }
61420
61421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61422         LDKBolt11InvoiceFeatures this_arg_conv;
61423         this_arg_conv.inner = untag_ptr(this_arg);
61424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61426         this_arg_conv.is_owned = false;
61427         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61428         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61429         return tag_ptr(ret_conv, true);
61430 }
61431
61432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1empty(JNIEnv *env, jclass clz) {
61433         LDKOfferFeatures ret_var = OfferFeatures_empty();
61434         int64_t ret_ref = 0;
61435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61437         return ret_ref;
61438 }
61439
61440 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
61441         LDKOfferFeatures this_arg_conv;
61442         this_arg_conv.inner = untag_ptr(this_arg);
61443         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61445         this_arg_conv.is_owned = false;
61446         LDKOfferFeatures other_conv;
61447         other_conv.inner = untag_ptr(other);
61448         other_conv.is_owned = ptr_is_owned(other);
61449         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61450         other_conv.is_owned = false;
61451         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61452         return ret_conv;
61453 }
61454
61455 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
61456         LDKOfferFeatures this_arg_conv;
61457         this_arg_conv.inner = untag_ptr(this_arg);
61458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61460         this_arg_conv.is_owned = false;
61461         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
61462         return ret_conv;
61463 }
61464
61465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1set_1required_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61466         LDKOfferFeatures this_arg_conv;
61467         this_arg_conv.inner = untag_ptr(this_arg);
61468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61470         this_arg_conv.is_owned = false;
61471         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61472         *ret_conv = OfferFeatures_set_required_feature_bit(&this_arg_conv, bit);
61473         return tag_ptr(ret_conv, true);
61474 }
61475
61476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1set_1optional_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61477         LDKOfferFeatures this_arg_conv;
61478         this_arg_conv.inner = untag_ptr(this_arg);
61479         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61481         this_arg_conv.is_owned = false;
61482         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61483         *ret_conv = OfferFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61484         return tag_ptr(ret_conv, true);
61485 }
61486
61487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61488         LDKOfferFeatures this_arg_conv;
61489         this_arg_conv.inner = untag_ptr(this_arg);
61490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61492         this_arg_conv.is_owned = false;
61493         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61494         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
61495         return tag_ptr(ret_conv, true);
61496 }
61497
61498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61499         LDKOfferFeatures this_arg_conv;
61500         this_arg_conv.inner = untag_ptr(this_arg);
61501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61503         this_arg_conv.is_owned = false;
61504         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61505         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61506         return tag_ptr(ret_conv, true);
61507 }
61508
61509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1empty(JNIEnv *env, jclass clz) {
61510         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
61511         int64_t ret_ref = 0;
61512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61514         return ret_ref;
61515 }
61516
61517 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
61518         LDKInvoiceRequestFeatures this_arg_conv;
61519         this_arg_conv.inner = untag_ptr(this_arg);
61520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61522         this_arg_conv.is_owned = false;
61523         LDKInvoiceRequestFeatures other_conv;
61524         other_conv.inner = untag_ptr(other);
61525         other_conv.is_owned = ptr_is_owned(other);
61526         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61527         other_conv.is_owned = false;
61528         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61529         return ret_conv;
61530 }
61531
61532 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
61533         LDKInvoiceRequestFeatures this_arg_conv;
61534         this_arg_conv.inner = untag_ptr(this_arg);
61535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61537         this_arg_conv.is_owned = false;
61538         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
61539         return ret_conv;
61540 }
61541
61542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1set_1required_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61543         LDKInvoiceRequestFeatures this_arg_conv;
61544         this_arg_conv.inner = untag_ptr(this_arg);
61545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61547         this_arg_conv.is_owned = false;
61548         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61549         *ret_conv = InvoiceRequestFeatures_set_required_feature_bit(&this_arg_conv, bit);
61550         return tag_ptr(ret_conv, true);
61551 }
61552
61553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1set_1optional_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61554         LDKInvoiceRequestFeatures this_arg_conv;
61555         this_arg_conv.inner = untag_ptr(this_arg);
61556         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61558         this_arg_conv.is_owned = false;
61559         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61560         *ret_conv = InvoiceRequestFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61561         return tag_ptr(ret_conv, true);
61562 }
61563
61564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61565         LDKInvoiceRequestFeatures this_arg_conv;
61566         this_arg_conv.inner = untag_ptr(this_arg);
61567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61569         this_arg_conv.is_owned = false;
61570         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61571         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
61572         return tag_ptr(ret_conv, true);
61573 }
61574
61575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61576         LDKInvoiceRequestFeatures this_arg_conv;
61577         this_arg_conv.inner = untag_ptr(this_arg);
61578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61580         this_arg_conv.is_owned = false;
61581         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61582         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61583         return tag_ptr(ret_conv, true);
61584 }
61585
61586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
61587         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
61588         int64_t ret_ref = 0;
61589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61591         return ret_ref;
61592 }
61593
61594 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
61595         LDKBolt12InvoiceFeatures this_arg_conv;
61596         this_arg_conv.inner = untag_ptr(this_arg);
61597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61599         this_arg_conv.is_owned = false;
61600         LDKBolt12InvoiceFeatures other_conv;
61601         other_conv.inner = untag_ptr(other);
61602         other_conv.is_owned = ptr_is_owned(other);
61603         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61604         other_conv.is_owned = false;
61605         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61606         return ret_conv;
61607 }
61608
61609 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
61610         LDKBolt12InvoiceFeatures this_arg_conv;
61611         this_arg_conv.inner = untag_ptr(this_arg);
61612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61614         this_arg_conv.is_owned = false;
61615         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
61616         return ret_conv;
61617 }
61618
61619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1required_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61620         LDKBolt12InvoiceFeatures this_arg_conv;
61621         this_arg_conv.inner = untag_ptr(this_arg);
61622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61624         this_arg_conv.is_owned = false;
61625         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61626         *ret_conv = Bolt12InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
61627         return tag_ptr(ret_conv, true);
61628 }
61629
61630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1optional_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61631         LDKBolt12InvoiceFeatures this_arg_conv;
61632         this_arg_conv.inner = untag_ptr(this_arg);
61633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61635         this_arg_conv.is_owned = false;
61636         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61637         *ret_conv = Bolt12InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61638         return tag_ptr(ret_conv, true);
61639 }
61640
61641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61642         LDKBolt12InvoiceFeatures this_arg_conv;
61643         this_arg_conv.inner = untag_ptr(this_arg);
61644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61646         this_arg_conv.is_owned = false;
61647         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61648         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
61649         return tag_ptr(ret_conv, true);
61650 }
61651
61652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61653         LDKBolt12InvoiceFeatures this_arg_conv;
61654         this_arg_conv.inner = untag_ptr(this_arg);
61655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61657         this_arg_conv.is_owned = false;
61658         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61659         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61660         return tag_ptr(ret_conv, true);
61661 }
61662
61663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1empty(JNIEnv *env, jclass clz) {
61664         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
61665         int64_t ret_ref = 0;
61666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61668         return ret_ref;
61669 }
61670
61671 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
61672         LDKBlindedHopFeatures this_arg_conv;
61673         this_arg_conv.inner = untag_ptr(this_arg);
61674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61676         this_arg_conv.is_owned = false;
61677         LDKBlindedHopFeatures other_conv;
61678         other_conv.inner = untag_ptr(other);
61679         other_conv.is_owned = ptr_is_owned(other);
61680         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61681         other_conv.is_owned = false;
61682         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61683         return ret_conv;
61684 }
61685
61686 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
61687         LDKBlindedHopFeatures this_arg_conv;
61688         this_arg_conv.inner = untag_ptr(this_arg);
61689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61691         this_arg_conv.is_owned = false;
61692         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
61693         return ret_conv;
61694 }
61695
61696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1set_1required_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61697         LDKBlindedHopFeatures this_arg_conv;
61698         this_arg_conv.inner = untag_ptr(this_arg);
61699         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61701         this_arg_conv.is_owned = false;
61702         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61703         *ret_conv = BlindedHopFeatures_set_required_feature_bit(&this_arg_conv, bit);
61704         return tag_ptr(ret_conv, true);
61705 }
61706
61707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1set_1optional_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61708         LDKBlindedHopFeatures this_arg_conv;
61709         this_arg_conv.inner = untag_ptr(this_arg);
61710         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61712         this_arg_conv.is_owned = false;
61713         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61714         *ret_conv = BlindedHopFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61715         return tag_ptr(ret_conv, true);
61716 }
61717
61718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61719         LDKBlindedHopFeatures this_arg_conv;
61720         this_arg_conv.inner = untag_ptr(this_arg);
61721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61723         this_arg_conv.is_owned = false;
61724         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61725         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
61726         return tag_ptr(ret_conv, true);
61727 }
61728
61729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61730         LDKBlindedHopFeatures this_arg_conv;
61731         this_arg_conv.inner = untag_ptr(this_arg);
61732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61734         this_arg_conv.is_owned = false;
61735         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61736         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61737         return tag_ptr(ret_conv, true);
61738 }
61739
61740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
61741         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
61742         int64_t ret_ref = 0;
61743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61745         return ret_ref;
61746 }
61747
61748 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
61749         LDKChannelTypeFeatures this_arg_conv;
61750         this_arg_conv.inner = untag_ptr(this_arg);
61751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61753         this_arg_conv.is_owned = false;
61754         LDKChannelTypeFeatures other_conv;
61755         other_conv.inner = untag_ptr(other);
61756         other_conv.is_owned = ptr_is_owned(other);
61757         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61758         other_conv.is_owned = false;
61759         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61760         return ret_conv;
61761 }
61762
61763 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
61764         LDKChannelTypeFeatures this_arg_conv;
61765         this_arg_conv.inner = untag_ptr(this_arg);
61766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61768         this_arg_conv.is_owned = false;
61769         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
61770         return ret_conv;
61771 }
61772
61773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1required_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61774         LDKChannelTypeFeatures this_arg_conv;
61775         this_arg_conv.inner = untag_ptr(this_arg);
61776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61778         this_arg_conv.is_owned = false;
61779         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61780         *ret_conv = ChannelTypeFeatures_set_required_feature_bit(&this_arg_conv, bit);
61781         return tag_ptr(ret_conv, true);
61782 }
61783
61784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1optional_1feature_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61785         LDKChannelTypeFeatures this_arg_conv;
61786         this_arg_conv.inner = untag_ptr(this_arg);
61787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61789         this_arg_conv.is_owned = false;
61790         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61791         *ret_conv = ChannelTypeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61792         return tag_ptr(ret_conv, true);
61793 }
61794
61795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61796         LDKChannelTypeFeatures this_arg_conv;
61797         this_arg_conv.inner = untag_ptr(this_arg);
61798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61800         this_arg_conv.is_owned = false;
61801         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61802         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
61803         return tag_ptr(ret_conv, true);
61804 }
61805
61806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
61807         LDKChannelTypeFeatures this_arg_conv;
61808         this_arg_conv.inner = untag_ptr(this_arg);
61809         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61811         this_arg_conv.is_owned = false;
61812         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61813         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61814         return tag_ptr(ret_conv, true);
61815 }
61816
61817 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
61818         LDKInitFeatures obj_conv;
61819         obj_conv.inner = untag_ptr(obj);
61820         obj_conv.is_owned = ptr_is_owned(obj);
61821         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61822         obj_conv.is_owned = false;
61823         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
61824         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61825         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61826         CVec_u8Z_free(ret_var);
61827         return ret_arr;
61828 }
61829
61830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61831         LDKu8slice ser_ref;
61832         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61833         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61834         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
61835         *ret_conv = InitFeatures_read(ser_ref);
61836         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61837         return tag_ptr(ret_conv, true);
61838 }
61839
61840 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
61841         LDKChannelFeatures obj_conv;
61842         obj_conv.inner = untag_ptr(obj);
61843         obj_conv.is_owned = ptr_is_owned(obj);
61844         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61845         obj_conv.is_owned = false;
61846         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
61847         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61848         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61849         CVec_u8Z_free(ret_var);
61850         return ret_arr;
61851 }
61852
61853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61854         LDKu8slice ser_ref;
61855         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61856         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61857         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
61858         *ret_conv = ChannelFeatures_read(ser_ref);
61859         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61860         return tag_ptr(ret_conv, true);
61861 }
61862
61863 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
61864         LDKNodeFeatures obj_conv;
61865         obj_conv.inner = untag_ptr(obj);
61866         obj_conv.is_owned = ptr_is_owned(obj);
61867         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61868         obj_conv.is_owned = false;
61869         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
61870         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61871         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61872         CVec_u8Z_free(ret_var);
61873         return ret_arr;
61874 }
61875
61876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61877         LDKu8slice ser_ref;
61878         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61879         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61880         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
61881         *ret_conv = NodeFeatures_read(ser_ref);
61882         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61883         return tag_ptr(ret_conv, true);
61884 }
61885
61886 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
61887         LDKBolt11InvoiceFeatures obj_conv;
61888         obj_conv.inner = untag_ptr(obj);
61889         obj_conv.is_owned = ptr_is_owned(obj);
61890         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61891         obj_conv.is_owned = false;
61892         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
61893         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61894         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61895         CVec_u8Z_free(ret_var);
61896         return ret_arr;
61897 }
61898
61899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61900         LDKu8slice ser_ref;
61901         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61902         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61903         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
61904         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
61905         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61906         return tag_ptr(ret_conv, true);
61907 }
61908
61909 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
61910         LDKBolt12InvoiceFeatures obj_conv;
61911         obj_conv.inner = untag_ptr(obj);
61912         obj_conv.is_owned = ptr_is_owned(obj);
61913         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61914         obj_conv.is_owned = false;
61915         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
61916         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61917         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61918         CVec_u8Z_free(ret_var);
61919         return ret_arr;
61920 }
61921
61922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61923         LDKu8slice ser_ref;
61924         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61925         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61926         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
61927         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
61928         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61929         return tag_ptr(ret_conv, true);
61930 }
61931
61932 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
61933         LDKBlindedHopFeatures obj_conv;
61934         obj_conv.inner = untag_ptr(obj);
61935         obj_conv.is_owned = ptr_is_owned(obj);
61936         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61937         obj_conv.is_owned = false;
61938         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
61939         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61940         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61941         CVec_u8Z_free(ret_var);
61942         return ret_arr;
61943 }
61944
61945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61946         LDKu8slice ser_ref;
61947         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61948         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61949         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
61950         *ret_conv = BlindedHopFeatures_read(ser_ref);
61951         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61952         return tag_ptr(ret_conv, true);
61953 }
61954
61955 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
61956         LDKChannelTypeFeatures obj_conv;
61957         obj_conv.inner = untag_ptr(obj);
61958         obj_conv.is_owned = ptr_is_owned(obj);
61959         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61960         obj_conv.is_owned = false;
61961         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
61962         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61963         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61964         CVec_u8Z_free(ret_var);
61965         return ret_arr;
61966 }
61967
61968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61969         LDKu8slice ser_ref;
61970         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61971         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61972         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
61973         *ret_conv = ChannelTypeFeatures_read(ser_ref);
61974         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61975         return tag_ptr(ret_conv, true);
61976 }
61977
61978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
61979         LDKInitFeatures this_arg_conv;
61980         this_arg_conv.inner = untag_ptr(this_arg);
61981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61983         this_arg_conv.is_owned = false;
61984         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
61985 }
61986
61987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
61988         LDKInitFeatures this_arg_conv;
61989         this_arg_conv.inner = untag_ptr(this_arg);
61990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61992         this_arg_conv.is_owned = false;
61993         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
61994 }
61995
61996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
61997         LDKInitFeatures this_arg_conv;
61998         this_arg_conv.inner = untag_ptr(this_arg);
61999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62001         this_arg_conv.is_owned = false;
62002         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
62003         return ret_conv;
62004 }
62005
62006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62007         LDKNodeFeatures this_arg_conv;
62008         this_arg_conv.inner = untag_ptr(this_arg);
62009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62011         this_arg_conv.is_owned = false;
62012         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
62013 }
62014
62015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62016         LDKNodeFeatures this_arg_conv;
62017         this_arg_conv.inner = untag_ptr(this_arg);
62018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62020         this_arg_conv.is_owned = false;
62021         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
62022 }
62023
62024 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
62025         LDKNodeFeatures this_arg_conv;
62026         this_arg_conv.inner = untag_ptr(this_arg);
62027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62029         this_arg_conv.is_owned = false;
62030         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
62031         return ret_conv;
62032 }
62033
62034 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
62035         LDKInitFeatures this_arg_conv;
62036         this_arg_conv.inner = untag_ptr(this_arg);
62037         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62039         this_arg_conv.is_owned = false;
62040         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
62041         return ret_conv;
62042 }
62043
62044 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
62045         LDKNodeFeatures this_arg_conv;
62046         this_arg_conv.inner = untag_ptr(this_arg);
62047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62049         this_arg_conv.is_owned = false;
62050         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
62051         return ret_conv;
62052 }
62053
62054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62055         LDKInitFeatures this_arg_conv;
62056         this_arg_conv.inner = untag_ptr(this_arg);
62057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62059         this_arg_conv.is_owned = false;
62060         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
62061 }
62062
62063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62064         LDKInitFeatures this_arg_conv;
62065         this_arg_conv.inner = untag_ptr(this_arg);
62066         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62068         this_arg_conv.is_owned = false;
62069         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
62070 }
62071
62072 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1initial_1routing_1sync(JNIEnv *env, jclass clz, int64_t this_arg) {
62073         LDKInitFeatures this_arg_conv;
62074         this_arg_conv.inner = untag_ptr(this_arg);
62075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62077         this_arg_conv.is_owned = false;
62078         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
62079         return ret_conv;
62080 }
62081
62082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62083         LDKInitFeatures this_arg_conv;
62084         this_arg_conv.inner = untag_ptr(this_arg);
62085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62087         this_arg_conv.is_owned = false;
62088         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
62089 }
62090
62091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62092         LDKInitFeatures this_arg_conv;
62093         this_arg_conv.inner = untag_ptr(this_arg);
62094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62096         this_arg_conv.is_owned = false;
62097         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
62098 }
62099
62100 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
62101         LDKInitFeatures this_arg_conv;
62102         this_arg_conv.inner = untag_ptr(this_arg);
62103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62105         this_arg_conv.is_owned = false;
62106         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
62107         return ret_conv;
62108 }
62109
62110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62111         LDKNodeFeatures this_arg_conv;
62112         this_arg_conv.inner = untag_ptr(this_arg);
62113         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62115         this_arg_conv.is_owned = false;
62116         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
62117 }
62118
62119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62120         LDKNodeFeatures this_arg_conv;
62121         this_arg_conv.inner = untag_ptr(this_arg);
62122         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62124         this_arg_conv.is_owned = false;
62125         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
62126 }
62127
62128 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
62129         LDKNodeFeatures this_arg_conv;
62130         this_arg_conv.inner = untag_ptr(this_arg);
62131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62133         this_arg_conv.is_owned = false;
62134         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
62135         return ret_conv;
62136 }
62137
62138 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
62139         LDKInitFeatures this_arg_conv;
62140         this_arg_conv.inner = untag_ptr(this_arg);
62141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62143         this_arg_conv.is_owned = false;
62144         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
62145         return ret_conv;
62146 }
62147
62148 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
62149         LDKNodeFeatures this_arg_conv;
62150         this_arg_conv.inner = untag_ptr(this_arg);
62151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62153         this_arg_conv.is_owned = false;
62154         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
62155         return ret_conv;
62156 }
62157
62158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62159         LDKInitFeatures this_arg_conv;
62160         this_arg_conv.inner = untag_ptr(this_arg);
62161         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62163         this_arg_conv.is_owned = false;
62164         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
62165 }
62166
62167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62168         LDKInitFeatures this_arg_conv;
62169         this_arg_conv.inner = untag_ptr(this_arg);
62170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62172         this_arg_conv.is_owned = false;
62173         InitFeatures_set_gossip_queries_required(&this_arg_conv);
62174 }
62175
62176 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
62177         LDKInitFeatures this_arg_conv;
62178         this_arg_conv.inner = untag_ptr(this_arg);
62179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62181         this_arg_conv.is_owned = false;
62182         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
62183         return ret_conv;
62184 }
62185
62186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62187         LDKNodeFeatures this_arg_conv;
62188         this_arg_conv.inner = untag_ptr(this_arg);
62189         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62191         this_arg_conv.is_owned = false;
62192         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
62193 }
62194
62195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62196         LDKNodeFeatures this_arg_conv;
62197         this_arg_conv.inner = untag_ptr(this_arg);
62198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62200         this_arg_conv.is_owned = false;
62201         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
62202 }
62203
62204 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
62205         LDKNodeFeatures this_arg_conv;
62206         this_arg_conv.inner = untag_ptr(this_arg);
62207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62209         this_arg_conv.is_owned = false;
62210         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
62211         return ret_conv;
62212 }
62213
62214 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
62215         LDKInitFeatures this_arg_conv;
62216         this_arg_conv.inner = untag_ptr(this_arg);
62217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62219         this_arg_conv.is_owned = false;
62220         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
62221         return ret_conv;
62222 }
62223
62224 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
62225         LDKNodeFeatures this_arg_conv;
62226         this_arg_conv.inner = untag_ptr(this_arg);
62227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62229         this_arg_conv.is_owned = false;
62230         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
62231         return ret_conv;
62232 }
62233
62234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62235         LDKInitFeatures this_arg_conv;
62236         this_arg_conv.inner = untag_ptr(this_arg);
62237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62239         this_arg_conv.is_owned = false;
62240         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
62241 }
62242
62243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62244         LDKInitFeatures this_arg_conv;
62245         this_arg_conv.inner = untag_ptr(this_arg);
62246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62248         this_arg_conv.is_owned = false;
62249         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
62250 }
62251
62252 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
62253         LDKInitFeatures this_arg_conv;
62254         this_arg_conv.inner = untag_ptr(this_arg);
62255         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62257         this_arg_conv.is_owned = false;
62258         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
62259         return ret_conv;
62260 }
62261
62262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62263         LDKNodeFeatures this_arg_conv;
62264         this_arg_conv.inner = untag_ptr(this_arg);
62265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62267         this_arg_conv.is_owned = false;
62268         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
62269 }
62270
62271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62272         LDKNodeFeatures this_arg_conv;
62273         this_arg_conv.inner = untag_ptr(this_arg);
62274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62276         this_arg_conv.is_owned = false;
62277         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
62278 }
62279
62280 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
62281         LDKNodeFeatures this_arg_conv;
62282         this_arg_conv.inner = untag_ptr(this_arg);
62283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62285         this_arg_conv.is_owned = false;
62286         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
62287         return ret_conv;
62288 }
62289
62290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62291         LDKBolt11InvoiceFeatures this_arg_conv;
62292         this_arg_conv.inner = untag_ptr(this_arg);
62293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62295         this_arg_conv.is_owned = false;
62296         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
62297 }
62298
62299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62300         LDKBolt11InvoiceFeatures this_arg_conv;
62301         this_arg_conv.inner = untag_ptr(this_arg);
62302         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62304         this_arg_conv.is_owned = false;
62305         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
62306 }
62307
62308 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
62309         LDKBolt11InvoiceFeatures this_arg_conv;
62310         this_arg_conv.inner = untag_ptr(this_arg);
62311         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62313         this_arg_conv.is_owned = false;
62314         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
62315         return ret_conv;
62316 }
62317
62318 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
62319         LDKInitFeatures this_arg_conv;
62320         this_arg_conv.inner = untag_ptr(this_arg);
62321         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62323         this_arg_conv.is_owned = false;
62324         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
62325         return ret_conv;
62326 }
62327
62328 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
62329         LDKNodeFeatures this_arg_conv;
62330         this_arg_conv.inner = untag_ptr(this_arg);
62331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62333         this_arg_conv.is_owned = false;
62334         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
62335         return ret_conv;
62336 }
62337
62338 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
62339         LDKBolt11InvoiceFeatures this_arg_conv;
62340         this_arg_conv.inner = untag_ptr(this_arg);
62341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62343         this_arg_conv.is_owned = false;
62344         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
62345         return ret_conv;
62346 }
62347
62348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62349         LDKInitFeatures this_arg_conv;
62350         this_arg_conv.inner = untag_ptr(this_arg);
62351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62353         this_arg_conv.is_owned = false;
62354         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
62355 }
62356
62357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62358         LDKInitFeatures this_arg_conv;
62359         this_arg_conv.inner = untag_ptr(this_arg);
62360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62362         this_arg_conv.is_owned = false;
62363         InitFeatures_set_static_remote_key_required(&this_arg_conv);
62364 }
62365
62366 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
62367         LDKInitFeatures this_arg_conv;
62368         this_arg_conv.inner = untag_ptr(this_arg);
62369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62371         this_arg_conv.is_owned = false;
62372         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
62373         return ret_conv;
62374 }
62375
62376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62377         LDKNodeFeatures this_arg_conv;
62378         this_arg_conv.inner = untag_ptr(this_arg);
62379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62381         this_arg_conv.is_owned = false;
62382         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
62383 }
62384
62385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62386         LDKNodeFeatures this_arg_conv;
62387         this_arg_conv.inner = untag_ptr(this_arg);
62388         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62390         this_arg_conv.is_owned = false;
62391         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
62392 }
62393
62394 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
62395         LDKNodeFeatures this_arg_conv;
62396         this_arg_conv.inner = untag_ptr(this_arg);
62397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62399         this_arg_conv.is_owned = false;
62400         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
62401         return ret_conv;
62402 }
62403
62404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62405         LDKChannelTypeFeatures this_arg_conv;
62406         this_arg_conv.inner = untag_ptr(this_arg);
62407         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62409         this_arg_conv.is_owned = false;
62410         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
62411 }
62412
62413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62414         LDKChannelTypeFeatures this_arg_conv;
62415         this_arg_conv.inner = untag_ptr(this_arg);
62416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62418         this_arg_conv.is_owned = false;
62419         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
62420 }
62421
62422 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
62423         LDKChannelTypeFeatures this_arg_conv;
62424         this_arg_conv.inner = untag_ptr(this_arg);
62425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62427         this_arg_conv.is_owned = false;
62428         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
62429         return ret_conv;
62430 }
62431
62432 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
62433         LDKInitFeatures this_arg_conv;
62434         this_arg_conv.inner = untag_ptr(this_arg);
62435         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62437         this_arg_conv.is_owned = false;
62438         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
62439         return ret_conv;
62440 }
62441
62442 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
62443         LDKNodeFeatures this_arg_conv;
62444         this_arg_conv.inner = untag_ptr(this_arg);
62445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62447         this_arg_conv.is_owned = false;
62448         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
62449         return ret_conv;
62450 }
62451
62452 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
62453         LDKChannelTypeFeatures this_arg_conv;
62454         this_arg_conv.inner = untag_ptr(this_arg);
62455         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62457         this_arg_conv.is_owned = false;
62458         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
62459         return ret_conv;
62460 }
62461
62462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62463         LDKInitFeatures this_arg_conv;
62464         this_arg_conv.inner = untag_ptr(this_arg);
62465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62467         this_arg_conv.is_owned = false;
62468         InitFeatures_set_payment_secret_optional(&this_arg_conv);
62469 }
62470
62471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62472         LDKInitFeatures this_arg_conv;
62473         this_arg_conv.inner = untag_ptr(this_arg);
62474         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62476         this_arg_conv.is_owned = false;
62477         InitFeatures_set_payment_secret_required(&this_arg_conv);
62478 }
62479
62480 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
62481         LDKInitFeatures this_arg_conv;
62482         this_arg_conv.inner = untag_ptr(this_arg);
62483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62485         this_arg_conv.is_owned = false;
62486         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
62487         return ret_conv;
62488 }
62489
62490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62491         LDKNodeFeatures this_arg_conv;
62492         this_arg_conv.inner = untag_ptr(this_arg);
62493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62495         this_arg_conv.is_owned = false;
62496         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
62497 }
62498
62499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62500         LDKNodeFeatures this_arg_conv;
62501         this_arg_conv.inner = untag_ptr(this_arg);
62502         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62504         this_arg_conv.is_owned = false;
62505         NodeFeatures_set_payment_secret_required(&this_arg_conv);
62506 }
62507
62508 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
62509         LDKNodeFeatures this_arg_conv;
62510         this_arg_conv.inner = untag_ptr(this_arg);
62511         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62513         this_arg_conv.is_owned = false;
62514         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
62515         return ret_conv;
62516 }
62517
62518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62519         LDKBolt11InvoiceFeatures this_arg_conv;
62520         this_arg_conv.inner = untag_ptr(this_arg);
62521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62523         this_arg_conv.is_owned = false;
62524         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
62525 }
62526
62527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62528         LDKBolt11InvoiceFeatures this_arg_conv;
62529         this_arg_conv.inner = untag_ptr(this_arg);
62530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62532         this_arg_conv.is_owned = false;
62533         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
62534 }
62535
62536 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
62537         LDKBolt11InvoiceFeatures this_arg_conv;
62538         this_arg_conv.inner = untag_ptr(this_arg);
62539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62541         this_arg_conv.is_owned = false;
62542         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
62543         return ret_conv;
62544 }
62545
62546 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
62547         LDKInitFeatures this_arg_conv;
62548         this_arg_conv.inner = untag_ptr(this_arg);
62549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62551         this_arg_conv.is_owned = false;
62552         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
62553         return ret_conv;
62554 }
62555
62556 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
62557         LDKNodeFeatures this_arg_conv;
62558         this_arg_conv.inner = untag_ptr(this_arg);
62559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62561         this_arg_conv.is_owned = false;
62562         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
62563         return ret_conv;
62564 }
62565
62566 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
62567         LDKBolt11InvoiceFeatures this_arg_conv;
62568         this_arg_conv.inner = untag_ptr(this_arg);
62569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62571         this_arg_conv.is_owned = false;
62572         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
62573         return ret_conv;
62574 }
62575
62576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62577         LDKInitFeatures this_arg_conv;
62578         this_arg_conv.inner = untag_ptr(this_arg);
62579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62581         this_arg_conv.is_owned = false;
62582         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
62583 }
62584
62585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62586         LDKInitFeatures this_arg_conv;
62587         this_arg_conv.inner = untag_ptr(this_arg);
62588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62590         this_arg_conv.is_owned = false;
62591         InitFeatures_set_basic_mpp_required(&this_arg_conv);
62592 }
62593
62594 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
62595         LDKInitFeatures this_arg_conv;
62596         this_arg_conv.inner = untag_ptr(this_arg);
62597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62599         this_arg_conv.is_owned = false;
62600         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
62601         return ret_conv;
62602 }
62603
62604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62605         LDKNodeFeatures this_arg_conv;
62606         this_arg_conv.inner = untag_ptr(this_arg);
62607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62609         this_arg_conv.is_owned = false;
62610         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
62611 }
62612
62613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62614         LDKNodeFeatures this_arg_conv;
62615         this_arg_conv.inner = untag_ptr(this_arg);
62616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62618         this_arg_conv.is_owned = false;
62619         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
62620 }
62621
62622 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
62623         LDKNodeFeatures this_arg_conv;
62624         this_arg_conv.inner = untag_ptr(this_arg);
62625         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62627         this_arg_conv.is_owned = false;
62628         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
62629         return ret_conv;
62630 }
62631
62632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62633         LDKBolt11InvoiceFeatures this_arg_conv;
62634         this_arg_conv.inner = untag_ptr(this_arg);
62635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62637         this_arg_conv.is_owned = false;
62638         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
62639 }
62640
62641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62642         LDKBolt11InvoiceFeatures this_arg_conv;
62643         this_arg_conv.inner = untag_ptr(this_arg);
62644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62646         this_arg_conv.is_owned = false;
62647         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
62648 }
62649
62650 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
62651         LDKBolt11InvoiceFeatures this_arg_conv;
62652         this_arg_conv.inner = untag_ptr(this_arg);
62653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62655         this_arg_conv.is_owned = false;
62656         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
62657         return ret_conv;
62658 }
62659
62660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62661         LDKBolt12InvoiceFeatures this_arg_conv;
62662         this_arg_conv.inner = untag_ptr(this_arg);
62663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62665         this_arg_conv.is_owned = false;
62666         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
62667 }
62668
62669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62670         LDKBolt12InvoiceFeatures this_arg_conv;
62671         this_arg_conv.inner = untag_ptr(this_arg);
62672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62674         this_arg_conv.is_owned = false;
62675         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
62676 }
62677
62678 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
62679         LDKBolt12InvoiceFeatures this_arg_conv;
62680         this_arg_conv.inner = untag_ptr(this_arg);
62681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62683         this_arg_conv.is_owned = false;
62684         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
62685         return ret_conv;
62686 }
62687
62688 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
62689         LDKInitFeatures this_arg_conv;
62690         this_arg_conv.inner = untag_ptr(this_arg);
62691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62693         this_arg_conv.is_owned = false;
62694         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
62695         return ret_conv;
62696 }
62697
62698 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
62699         LDKNodeFeatures this_arg_conv;
62700         this_arg_conv.inner = untag_ptr(this_arg);
62701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62703         this_arg_conv.is_owned = false;
62704         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
62705         return ret_conv;
62706 }
62707
62708 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
62709         LDKBolt11InvoiceFeatures this_arg_conv;
62710         this_arg_conv.inner = untag_ptr(this_arg);
62711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62713         this_arg_conv.is_owned = false;
62714         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
62715         return ret_conv;
62716 }
62717
62718 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
62719         LDKBolt12InvoiceFeatures this_arg_conv;
62720         this_arg_conv.inner = untag_ptr(this_arg);
62721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62723         this_arg_conv.is_owned = false;
62724         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
62725         return ret_conv;
62726 }
62727
62728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62729         LDKInitFeatures this_arg_conv;
62730         this_arg_conv.inner = untag_ptr(this_arg);
62731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62733         this_arg_conv.is_owned = false;
62734         InitFeatures_set_wumbo_optional(&this_arg_conv);
62735 }
62736
62737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62738         LDKInitFeatures this_arg_conv;
62739         this_arg_conv.inner = untag_ptr(this_arg);
62740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62742         this_arg_conv.is_owned = false;
62743         InitFeatures_set_wumbo_required(&this_arg_conv);
62744 }
62745
62746 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
62747         LDKInitFeatures this_arg_conv;
62748         this_arg_conv.inner = untag_ptr(this_arg);
62749         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62751         this_arg_conv.is_owned = false;
62752         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
62753         return ret_conv;
62754 }
62755
62756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62757         LDKNodeFeatures this_arg_conv;
62758         this_arg_conv.inner = untag_ptr(this_arg);
62759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62761         this_arg_conv.is_owned = false;
62762         NodeFeatures_set_wumbo_optional(&this_arg_conv);
62763 }
62764
62765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62766         LDKNodeFeatures this_arg_conv;
62767         this_arg_conv.inner = untag_ptr(this_arg);
62768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62770         this_arg_conv.is_owned = false;
62771         NodeFeatures_set_wumbo_required(&this_arg_conv);
62772 }
62773
62774 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
62775         LDKNodeFeatures this_arg_conv;
62776         this_arg_conv.inner = untag_ptr(this_arg);
62777         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62779         this_arg_conv.is_owned = false;
62780         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
62781         return ret_conv;
62782 }
62783
62784 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
62785         LDKInitFeatures this_arg_conv;
62786         this_arg_conv.inner = untag_ptr(this_arg);
62787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62789         this_arg_conv.is_owned = false;
62790         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
62791         return ret_conv;
62792 }
62793
62794 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
62795         LDKNodeFeatures this_arg_conv;
62796         this_arg_conv.inner = untag_ptr(this_arg);
62797         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62799         this_arg_conv.is_owned = false;
62800         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
62801         return ret_conv;
62802 }
62803
62804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62805         LDKInitFeatures this_arg_conv;
62806         this_arg_conv.inner = untag_ptr(this_arg);
62807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62809         this_arg_conv.is_owned = false;
62810         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
62811 }
62812
62813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62814         LDKInitFeatures this_arg_conv;
62815         this_arg_conv.inner = untag_ptr(this_arg);
62816         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62818         this_arg_conv.is_owned = false;
62819         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
62820 }
62821
62822 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
62823         LDKInitFeatures this_arg_conv;
62824         this_arg_conv.inner = untag_ptr(this_arg);
62825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62827         this_arg_conv.is_owned = false;
62828         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
62829         return ret_conv;
62830 }
62831
62832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62833         LDKNodeFeatures this_arg_conv;
62834         this_arg_conv.inner = untag_ptr(this_arg);
62835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62837         this_arg_conv.is_owned = false;
62838         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
62839 }
62840
62841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62842         LDKNodeFeatures this_arg_conv;
62843         this_arg_conv.inner = untag_ptr(this_arg);
62844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62846         this_arg_conv.is_owned = false;
62847         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
62848 }
62849
62850 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
62851         LDKNodeFeatures this_arg_conv;
62852         this_arg_conv.inner = untag_ptr(this_arg);
62853         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62855         this_arg_conv.is_owned = false;
62856         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
62857         return ret_conv;
62858 }
62859
62860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62861         LDKChannelTypeFeatures this_arg_conv;
62862         this_arg_conv.inner = untag_ptr(this_arg);
62863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62865         this_arg_conv.is_owned = false;
62866         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
62867 }
62868
62869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62870         LDKChannelTypeFeatures this_arg_conv;
62871         this_arg_conv.inner = untag_ptr(this_arg);
62872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62874         this_arg_conv.is_owned = false;
62875         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
62876 }
62877
62878 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
62879         LDKChannelTypeFeatures this_arg_conv;
62880         this_arg_conv.inner = untag_ptr(this_arg);
62881         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62883         this_arg_conv.is_owned = false;
62884         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
62885         return ret_conv;
62886 }
62887
62888 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
62889         LDKInitFeatures this_arg_conv;
62890         this_arg_conv.inner = untag_ptr(this_arg);
62891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62893         this_arg_conv.is_owned = false;
62894         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
62895         return ret_conv;
62896 }
62897
62898 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
62899         LDKNodeFeatures this_arg_conv;
62900         this_arg_conv.inner = untag_ptr(this_arg);
62901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62903         this_arg_conv.is_owned = false;
62904         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
62905         return ret_conv;
62906 }
62907
62908 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
62909         LDKChannelTypeFeatures this_arg_conv;
62910         this_arg_conv.inner = untag_ptr(this_arg);
62911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62913         this_arg_conv.is_owned = false;
62914         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
62915         return ret_conv;
62916 }
62917
62918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62919         LDKInitFeatures this_arg_conv;
62920         this_arg_conv.inner = untag_ptr(this_arg);
62921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62923         this_arg_conv.is_owned = false;
62924         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
62925 }
62926
62927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62928         LDKInitFeatures this_arg_conv;
62929         this_arg_conv.inner = untag_ptr(this_arg);
62930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62932         this_arg_conv.is_owned = false;
62933         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
62934 }
62935
62936 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
62937         LDKInitFeatures this_arg_conv;
62938         this_arg_conv.inner = untag_ptr(this_arg);
62939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62941         this_arg_conv.is_owned = false;
62942         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
62943         return ret_conv;
62944 }
62945
62946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62947         LDKNodeFeatures this_arg_conv;
62948         this_arg_conv.inner = untag_ptr(this_arg);
62949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62951         this_arg_conv.is_owned = false;
62952         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
62953 }
62954
62955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62956         LDKNodeFeatures this_arg_conv;
62957         this_arg_conv.inner = untag_ptr(this_arg);
62958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62960         this_arg_conv.is_owned = false;
62961         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
62962 }
62963
62964 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
62965         LDKNodeFeatures this_arg_conv;
62966         this_arg_conv.inner = untag_ptr(this_arg);
62967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62969         this_arg_conv.is_owned = false;
62970         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
62971         return ret_conv;
62972 }
62973
62974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
62975         LDKChannelTypeFeatures this_arg_conv;
62976         this_arg_conv.inner = untag_ptr(this_arg);
62977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62979         this_arg_conv.is_owned = false;
62980         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
62981 }
62982
62983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
62984         LDKChannelTypeFeatures this_arg_conv;
62985         this_arg_conv.inner = untag_ptr(this_arg);
62986         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62988         this_arg_conv.is_owned = false;
62989         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
62990 }
62991
62992 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
62993         LDKChannelTypeFeatures this_arg_conv;
62994         this_arg_conv.inner = untag_ptr(this_arg);
62995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62997         this_arg_conv.is_owned = false;
62998         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
62999         return ret_conv;
63000 }
63001
63002 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
63003         LDKInitFeatures this_arg_conv;
63004         this_arg_conv.inner = untag_ptr(this_arg);
63005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63007         this_arg_conv.is_owned = false;
63008         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
63009         return ret_conv;
63010 }
63011
63012 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
63013         LDKNodeFeatures this_arg_conv;
63014         this_arg_conv.inner = untag_ptr(this_arg);
63015         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63017         this_arg_conv.is_owned = false;
63018         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
63019         return ret_conv;
63020 }
63021
63022 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
63023         LDKChannelTypeFeatures this_arg_conv;
63024         this_arg_conv.inner = untag_ptr(this_arg);
63025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63027         this_arg_conv.is_owned = false;
63028         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
63029         return ret_conv;
63030 }
63031
63032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1route_1blinding_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63033         LDKInitFeatures this_arg_conv;
63034         this_arg_conv.inner = untag_ptr(this_arg);
63035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63037         this_arg_conv.is_owned = false;
63038         InitFeatures_set_route_blinding_optional(&this_arg_conv);
63039 }
63040
63041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1route_1blinding_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63042         LDKInitFeatures this_arg_conv;
63043         this_arg_conv.inner = untag_ptr(this_arg);
63044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63046         this_arg_conv.is_owned = false;
63047         InitFeatures_set_route_blinding_required(&this_arg_conv);
63048 }
63049
63050 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1route_1blinding(JNIEnv *env, jclass clz, int64_t this_arg) {
63051         LDKInitFeatures this_arg_conv;
63052         this_arg_conv.inner = untag_ptr(this_arg);
63053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63055         this_arg_conv.is_owned = false;
63056         jboolean ret_conv = InitFeatures_supports_route_blinding(&this_arg_conv);
63057         return ret_conv;
63058 }
63059
63060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1route_1blinding_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63061         LDKNodeFeatures this_arg_conv;
63062         this_arg_conv.inner = untag_ptr(this_arg);
63063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63065         this_arg_conv.is_owned = false;
63066         NodeFeatures_set_route_blinding_optional(&this_arg_conv);
63067 }
63068
63069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1route_1blinding_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63070         LDKNodeFeatures this_arg_conv;
63071         this_arg_conv.inner = untag_ptr(this_arg);
63072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63074         this_arg_conv.is_owned = false;
63075         NodeFeatures_set_route_blinding_required(&this_arg_conv);
63076 }
63077
63078 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1route_1blinding(JNIEnv *env, jclass clz, int64_t this_arg) {
63079         LDKNodeFeatures this_arg_conv;
63080         this_arg_conv.inner = untag_ptr(this_arg);
63081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63083         this_arg_conv.is_owned = false;
63084         jboolean ret_conv = NodeFeatures_supports_route_blinding(&this_arg_conv);
63085         return ret_conv;
63086 }
63087
63088 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1route_1blinding(JNIEnv *env, jclass clz, int64_t this_arg) {
63089         LDKInitFeatures this_arg_conv;
63090         this_arg_conv.inner = untag_ptr(this_arg);
63091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63093         this_arg_conv.is_owned = false;
63094         jboolean ret_conv = InitFeatures_requires_route_blinding(&this_arg_conv);
63095         return ret_conv;
63096 }
63097
63098 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1route_1blinding(JNIEnv *env, jclass clz, int64_t this_arg) {
63099         LDKNodeFeatures this_arg_conv;
63100         this_arg_conv.inner = untag_ptr(this_arg);
63101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63103         this_arg_conv.is_owned = false;
63104         jboolean ret_conv = NodeFeatures_requires_route_blinding(&this_arg_conv);
63105         return ret_conv;
63106 }
63107
63108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63109         LDKInitFeatures this_arg_conv;
63110         this_arg_conv.inner = untag_ptr(this_arg);
63111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63113         this_arg_conv.is_owned = false;
63114         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
63115 }
63116
63117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63118         LDKInitFeatures this_arg_conv;
63119         this_arg_conv.inner = untag_ptr(this_arg);
63120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63122         this_arg_conv.is_owned = false;
63123         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
63124 }
63125
63126 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
63127         LDKInitFeatures this_arg_conv;
63128         this_arg_conv.inner = untag_ptr(this_arg);
63129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63131         this_arg_conv.is_owned = false;
63132         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
63133         return ret_conv;
63134 }
63135
63136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63137         LDKNodeFeatures this_arg_conv;
63138         this_arg_conv.inner = untag_ptr(this_arg);
63139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63141         this_arg_conv.is_owned = false;
63142         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
63143 }
63144
63145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63146         LDKNodeFeatures this_arg_conv;
63147         this_arg_conv.inner = untag_ptr(this_arg);
63148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63150         this_arg_conv.is_owned = false;
63151         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
63152 }
63153
63154 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
63155         LDKNodeFeatures this_arg_conv;
63156         this_arg_conv.inner = untag_ptr(this_arg);
63157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63159         this_arg_conv.is_owned = false;
63160         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
63161         return ret_conv;
63162 }
63163
63164 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
63165         LDKInitFeatures this_arg_conv;
63166         this_arg_conv.inner = untag_ptr(this_arg);
63167         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63169         this_arg_conv.is_owned = false;
63170         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
63171         return ret_conv;
63172 }
63173
63174 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
63175         LDKNodeFeatures this_arg_conv;
63176         this_arg_conv.inner = untag_ptr(this_arg);
63177         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63179         this_arg_conv.is_owned = false;
63180         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
63181         return ret_conv;
63182 }
63183
63184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63185         LDKInitFeatures this_arg_conv;
63186         this_arg_conv.inner = untag_ptr(this_arg);
63187         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63189         this_arg_conv.is_owned = false;
63190         InitFeatures_set_taproot_optional(&this_arg_conv);
63191 }
63192
63193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63194         LDKInitFeatures this_arg_conv;
63195         this_arg_conv.inner = untag_ptr(this_arg);
63196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63198         this_arg_conv.is_owned = false;
63199         InitFeatures_set_taproot_required(&this_arg_conv);
63200 }
63201
63202 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
63203         LDKInitFeatures this_arg_conv;
63204         this_arg_conv.inner = untag_ptr(this_arg);
63205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63207         this_arg_conv.is_owned = false;
63208         jboolean ret_conv = InitFeatures_supports_taproot(&this_arg_conv);
63209         return ret_conv;
63210 }
63211
63212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63213         LDKNodeFeatures this_arg_conv;
63214         this_arg_conv.inner = untag_ptr(this_arg);
63215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63217         this_arg_conv.is_owned = false;
63218         NodeFeatures_set_taproot_optional(&this_arg_conv);
63219 }
63220
63221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63222         LDKNodeFeatures this_arg_conv;
63223         this_arg_conv.inner = untag_ptr(this_arg);
63224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63226         this_arg_conv.is_owned = false;
63227         NodeFeatures_set_taproot_required(&this_arg_conv);
63228 }
63229
63230 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
63231         LDKNodeFeatures this_arg_conv;
63232         this_arg_conv.inner = untag_ptr(this_arg);
63233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63235         this_arg_conv.is_owned = false;
63236         jboolean ret_conv = NodeFeatures_supports_taproot(&this_arg_conv);
63237         return ret_conv;
63238 }
63239
63240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63241         LDKChannelTypeFeatures this_arg_conv;
63242         this_arg_conv.inner = untag_ptr(this_arg);
63243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63245         this_arg_conv.is_owned = false;
63246         ChannelTypeFeatures_set_taproot_optional(&this_arg_conv);
63247 }
63248
63249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63250         LDKChannelTypeFeatures this_arg_conv;
63251         this_arg_conv.inner = untag_ptr(this_arg);
63252         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63254         this_arg_conv.is_owned = false;
63255         ChannelTypeFeatures_set_taproot_required(&this_arg_conv);
63256 }
63257
63258 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
63259         LDKChannelTypeFeatures this_arg_conv;
63260         this_arg_conv.inner = untag_ptr(this_arg);
63261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63263         this_arg_conv.is_owned = false;
63264         jboolean ret_conv = ChannelTypeFeatures_supports_taproot(&this_arg_conv);
63265         return ret_conv;
63266 }
63267
63268 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
63269         LDKInitFeatures this_arg_conv;
63270         this_arg_conv.inner = untag_ptr(this_arg);
63271         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63273         this_arg_conv.is_owned = false;
63274         jboolean ret_conv = InitFeatures_requires_taproot(&this_arg_conv);
63275         return ret_conv;
63276 }
63277
63278 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
63279         LDKNodeFeatures this_arg_conv;
63280         this_arg_conv.inner = untag_ptr(this_arg);
63281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63283         this_arg_conv.is_owned = false;
63284         jboolean ret_conv = NodeFeatures_requires_taproot(&this_arg_conv);
63285         return ret_conv;
63286 }
63287
63288 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
63289         LDKChannelTypeFeatures this_arg_conv;
63290         this_arg_conv.inner = untag_ptr(this_arg);
63291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63293         this_arg_conv.is_owned = false;
63294         jboolean ret_conv = ChannelTypeFeatures_requires_taproot(&this_arg_conv);
63295         return ret_conv;
63296 }
63297
63298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63299         LDKInitFeatures this_arg_conv;
63300         this_arg_conv.inner = untag_ptr(this_arg);
63301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63303         this_arg_conv.is_owned = false;
63304         InitFeatures_set_onion_messages_optional(&this_arg_conv);
63305 }
63306
63307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63308         LDKInitFeatures this_arg_conv;
63309         this_arg_conv.inner = untag_ptr(this_arg);
63310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63312         this_arg_conv.is_owned = false;
63313         InitFeatures_set_onion_messages_required(&this_arg_conv);
63314 }
63315
63316 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
63317         LDKInitFeatures this_arg_conv;
63318         this_arg_conv.inner = untag_ptr(this_arg);
63319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63321         this_arg_conv.is_owned = false;
63322         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
63323         return ret_conv;
63324 }
63325
63326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63327         LDKNodeFeatures this_arg_conv;
63328         this_arg_conv.inner = untag_ptr(this_arg);
63329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63331         this_arg_conv.is_owned = false;
63332         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
63333 }
63334
63335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63336         LDKNodeFeatures this_arg_conv;
63337         this_arg_conv.inner = untag_ptr(this_arg);
63338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63340         this_arg_conv.is_owned = false;
63341         NodeFeatures_set_onion_messages_required(&this_arg_conv);
63342 }
63343
63344 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
63345         LDKNodeFeatures this_arg_conv;
63346         this_arg_conv.inner = untag_ptr(this_arg);
63347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63349         this_arg_conv.is_owned = false;
63350         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
63351         return ret_conv;
63352 }
63353
63354 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
63355         LDKInitFeatures this_arg_conv;
63356         this_arg_conv.inner = untag_ptr(this_arg);
63357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63359         this_arg_conv.is_owned = false;
63360         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
63361         return ret_conv;
63362 }
63363
63364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
63365         LDKNodeFeatures this_arg_conv;
63366         this_arg_conv.inner = untag_ptr(this_arg);
63367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63369         this_arg_conv.is_owned = false;
63370         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
63371         return ret_conv;
63372 }
63373
63374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63375         LDKInitFeatures this_arg_conv;
63376         this_arg_conv.inner = untag_ptr(this_arg);
63377         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63379         this_arg_conv.is_owned = false;
63380         InitFeatures_set_channel_type_optional(&this_arg_conv);
63381 }
63382
63383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63384         LDKInitFeatures this_arg_conv;
63385         this_arg_conv.inner = untag_ptr(this_arg);
63386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63388         this_arg_conv.is_owned = false;
63389         InitFeatures_set_channel_type_required(&this_arg_conv);
63390 }
63391
63392 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
63393         LDKInitFeatures this_arg_conv;
63394         this_arg_conv.inner = untag_ptr(this_arg);
63395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63397         this_arg_conv.is_owned = false;
63398         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
63399         return ret_conv;
63400 }
63401
63402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63403         LDKNodeFeatures this_arg_conv;
63404         this_arg_conv.inner = untag_ptr(this_arg);
63405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63407         this_arg_conv.is_owned = false;
63408         NodeFeatures_set_channel_type_optional(&this_arg_conv);
63409 }
63410
63411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63412         LDKNodeFeatures this_arg_conv;
63413         this_arg_conv.inner = untag_ptr(this_arg);
63414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63416         this_arg_conv.is_owned = false;
63417         NodeFeatures_set_channel_type_required(&this_arg_conv);
63418 }
63419
63420 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
63421         LDKNodeFeatures this_arg_conv;
63422         this_arg_conv.inner = untag_ptr(this_arg);
63423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63425         this_arg_conv.is_owned = false;
63426         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
63427         return ret_conv;
63428 }
63429
63430 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
63431         LDKInitFeatures this_arg_conv;
63432         this_arg_conv.inner = untag_ptr(this_arg);
63433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63435         this_arg_conv.is_owned = false;
63436         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
63437         return ret_conv;
63438 }
63439
63440 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
63441         LDKNodeFeatures this_arg_conv;
63442         this_arg_conv.inner = untag_ptr(this_arg);
63443         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63445         this_arg_conv.is_owned = false;
63446         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
63447         return ret_conv;
63448 }
63449
63450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63451         LDKInitFeatures this_arg_conv;
63452         this_arg_conv.inner = untag_ptr(this_arg);
63453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63455         this_arg_conv.is_owned = false;
63456         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
63457 }
63458
63459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63460         LDKInitFeatures this_arg_conv;
63461         this_arg_conv.inner = untag_ptr(this_arg);
63462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63464         this_arg_conv.is_owned = false;
63465         InitFeatures_set_scid_privacy_required(&this_arg_conv);
63466 }
63467
63468 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
63469         LDKInitFeatures this_arg_conv;
63470         this_arg_conv.inner = untag_ptr(this_arg);
63471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63473         this_arg_conv.is_owned = false;
63474         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
63475         return ret_conv;
63476 }
63477
63478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63479         LDKNodeFeatures this_arg_conv;
63480         this_arg_conv.inner = untag_ptr(this_arg);
63481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63483         this_arg_conv.is_owned = false;
63484         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
63485 }
63486
63487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63488         LDKNodeFeatures this_arg_conv;
63489         this_arg_conv.inner = untag_ptr(this_arg);
63490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63492         this_arg_conv.is_owned = false;
63493         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
63494 }
63495
63496 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
63497         LDKNodeFeatures this_arg_conv;
63498         this_arg_conv.inner = untag_ptr(this_arg);
63499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63501         this_arg_conv.is_owned = false;
63502         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
63503         return ret_conv;
63504 }
63505
63506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63507         LDKChannelTypeFeatures this_arg_conv;
63508         this_arg_conv.inner = untag_ptr(this_arg);
63509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63511         this_arg_conv.is_owned = false;
63512         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
63513 }
63514
63515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63516         LDKChannelTypeFeatures this_arg_conv;
63517         this_arg_conv.inner = untag_ptr(this_arg);
63518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63520         this_arg_conv.is_owned = false;
63521         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
63522 }
63523
63524 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
63525         LDKChannelTypeFeatures this_arg_conv;
63526         this_arg_conv.inner = untag_ptr(this_arg);
63527         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63529         this_arg_conv.is_owned = false;
63530         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
63531         return ret_conv;
63532 }
63533
63534 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
63535         LDKInitFeatures this_arg_conv;
63536         this_arg_conv.inner = untag_ptr(this_arg);
63537         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63539         this_arg_conv.is_owned = false;
63540         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
63541         return ret_conv;
63542 }
63543
63544 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
63545         LDKNodeFeatures this_arg_conv;
63546         this_arg_conv.inner = untag_ptr(this_arg);
63547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63549         this_arg_conv.is_owned = false;
63550         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
63551         return ret_conv;
63552 }
63553
63554 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
63555         LDKChannelTypeFeatures this_arg_conv;
63556         this_arg_conv.inner = untag_ptr(this_arg);
63557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63559         this_arg_conv.is_owned = false;
63560         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
63561         return ret_conv;
63562 }
63563
63564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1metadata_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63565         LDKBolt11InvoiceFeatures this_arg_conv;
63566         this_arg_conv.inner = untag_ptr(this_arg);
63567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63569         this_arg_conv.is_owned = false;
63570         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
63571 }
63572
63573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1metadata_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63574         LDKBolt11InvoiceFeatures this_arg_conv;
63575         this_arg_conv.inner = untag_ptr(this_arg);
63576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63578         this_arg_conv.is_owned = false;
63579         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
63580 }
63581
63582 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
63583         LDKBolt11InvoiceFeatures this_arg_conv;
63584         this_arg_conv.inner = untag_ptr(this_arg);
63585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63587         this_arg_conv.is_owned = false;
63588         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
63589         return ret_conv;
63590 }
63591
63592 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
63593         LDKBolt11InvoiceFeatures this_arg_conv;
63594         this_arg_conv.inner = untag_ptr(this_arg);
63595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63597         this_arg_conv.is_owned = false;
63598         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
63599         return ret_conv;
63600 }
63601
63602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63603         LDKInitFeatures this_arg_conv;
63604         this_arg_conv.inner = untag_ptr(this_arg);
63605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63607         this_arg_conv.is_owned = false;
63608         InitFeatures_set_zero_conf_optional(&this_arg_conv);
63609 }
63610
63611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63612         LDKInitFeatures this_arg_conv;
63613         this_arg_conv.inner = untag_ptr(this_arg);
63614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63616         this_arg_conv.is_owned = false;
63617         InitFeatures_set_zero_conf_required(&this_arg_conv);
63618 }
63619
63620 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
63621         LDKInitFeatures this_arg_conv;
63622         this_arg_conv.inner = untag_ptr(this_arg);
63623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63625         this_arg_conv.is_owned = false;
63626         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
63627         return ret_conv;
63628 }
63629
63630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63631         LDKNodeFeatures this_arg_conv;
63632         this_arg_conv.inner = untag_ptr(this_arg);
63633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63635         this_arg_conv.is_owned = false;
63636         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
63637 }
63638
63639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63640         LDKNodeFeatures this_arg_conv;
63641         this_arg_conv.inner = untag_ptr(this_arg);
63642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63644         this_arg_conv.is_owned = false;
63645         NodeFeatures_set_zero_conf_required(&this_arg_conv);
63646 }
63647
63648 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
63649         LDKNodeFeatures this_arg_conv;
63650         this_arg_conv.inner = untag_ptr(this_arg);
63651         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63653         this_arg_conv.is_owned = false;
63654         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
63655         return ret_conv;
63656 }
63657
63658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63659         LDKChannelTypeFeatures this_arg_conv;
63660         this_arg_conv.inner = untag_ptr(this_arg);
63661         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63663         this_arg_conv.is_owned = false;
63664         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
63665 }
63666
63667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63668         LDKChannelTypeFeatures this_arg_conv;
63669         this_arg_conv.inner = untag_ptr(this_arg);
63670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63672         this_arg_conv.is_owned = false;
63673         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
63674 }
63675
63676 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
63677         LDKChannelTypeFeatures this_arg_conv;
63678         this_arg_conv.inner = untag_ptr(this_arg);
63679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63681         this_arg_conv.is_owned = false;
63682         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
63683         return ret_conv;
63684 }
63685
63686 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
63687         LDKInitFeatures this_arg_conv;
63688         this_arg_conv.inner = untag_ptr(this_arg);
63689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63691         this_arg_conv.is_owned = false;
63692         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
63693         return ret_conv;
63694 }
63695
63696 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
63697         LDKNodeFeatures this_arg_conv;
63698         this_arg_conv.inner = untag_ptr(this_arg);
63699         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63701         this_arg_conv.is_owned = false;
63702         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
63703         return ret_conv;
63704 }
63705
63706 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
63707         LDKChannelTypeFeatures this_arg_conv;
63708         this_arg_conv.inner = untag_ptr(this_arg);
63709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63711         this_arg_conv.is_owned = false;
63712         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
63713         return ret_conv;
63714 }
63715
63716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
63717         LDKNodeFeatures this_arg_conv;
63718         this_arg_conv.inner = untag_ptr(this_arg);
63719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63721         this_arg_conv.is_owned = false;
63722         NodeFeatures_set_keysend_optional(&this_arg_conv);
63723 }
63724
63725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
63726         LDKNodeFeatures this_arg_conv;
63727         this_arg_conv.inner = untag_ptr(this_arg);
63728         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63730         this_arg_conv.is_owned = false;
63731         NodeFeatures_set_keysend_required(&this_arg_conv);
63732 }
63733
63734 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
63735         LDKNodeFeatures this_arg_conv;
63736         this_arg_conv.inner = untag_ptr(this_arg);
63737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63739         this_arg_conv.is_owned = false;
63740         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
63741         return ret_conv;
63742 }
63743
63744 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
63745         LDKNodeFeatures this_arg_conv;
63746         this_arg_conv.inner = untag_ptr(this_arg);
63747         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63749         this_arg_conv.is_owned = false;
63750         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
63751         return ret_conv;
63752 }
63753
63754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63755         LDKShutdownScript this_obj_conv;
63756         this_obj_conv.inner = untag_ptr(this_obj);
63757         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63759         ShutdownScript_free(this_obj_conv);
63760 }
63761
63762 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
63763         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
63764         int64_t ret_ref = 0;
63765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63767         return ret_ref;
63768 }
63769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63770         LDKShutdownScript arg_conv;
63771         arg_conv.inner = untag_ptr(arg);
63772         arg_conv.is_owned = ptr_is_owned(arg);
63773         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63774         arg_conv.is_owned = false;
63775         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
63776         return ret_conv;
63777 }
63778
63779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63780         LDKShutdownScript orig_conv;
63781         orig_conv.inner = untag_ptr(orig);
63782         orig_conv.is_owned = ptr_is_owned(orig);
63783         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63784         orig_conv.is_owned = false;
63785         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
63786         int64_t ret_ref = 0;
63787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63789         return ret_ref;
63790 }
63791
63792 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63793         LDKShutdownScript a_conv;
63794         a_conv.inner = untag_ptr(a);
63795         a_conv.is_owned = ptr_is_owned(a);
63796         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63797         a_conv.is_owned = false;
63798         LDKShutdownScript b_conv;
63799         b_conv.inner = untag_ptr(b);
63800         b_conv.is_owned = ptr_is_owned(b);
63801         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63802         b_conv.is_owned = false;
63803         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
63804         return ret_conv;
63805 }
63806
63807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63808         LDKInvalidShutdownScript this_obj_conv;
63809         this_obj_conv.inner = untag_ptr(this_obj);
63810         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63812         InvalidShutdownScript_free(this_obj_conv);
63813 }
63814
63815 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
63816         LDKInvalidShutdownScript this_ptr_conv;
63817         this_ptr_conv.inner = untag_ptr(this_ptr);
63818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63820         this_ptr_conv.is_owned = false;
63821         LDKCVec_u8Z ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
63822         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63823         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63824         CVec_u8Z_free(ret_var);
63825         return ret_arr;
63826 }
63827
63828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
63829         LDKInvalidShutdownScript this_ptr_conv;
63830         this_ptr_conv.inner = untag_ptr(this_ptr);
63831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63833         this_ptr_conv.is_owned = false;
63834         LDKCVec_u8Z val_ref;
63835         val_ref.datalen = (*env)->GetArrayLength(env, val);
63836         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
63837         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
63838         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
63839 }
63840
63841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
63842         LDKCVec_u8Z script_arg_ref;
63843         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
63844         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
63845         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
63846         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
63847         int64_t ret_ref = 0;
63848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63850         return ret_ref;
63851 }
63852
63853 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
63854         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
63855         int64_t ret_ref = 0;
63856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63858         return ret_ref;
63859 }
63860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63861         LDKInvalidShutdownScript arg_conv;
63862         arg_conv.inner = untag_ptr(arg);
63863         arg_conv.is_owned = ptr_is_owned(arg);
63864         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63865         arg_conv.is_owned = false;
63866         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
63867         return ret_conv;
63868 }
63869
63870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63871         LDKInvalidShutdownScript orig_conv;
63872         orig_conv.inner = untag_ptr(orig);
63873         orig_conv.is_owned = ptr_is_owned(orig);
63874         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63875         orig_conv.is_owned = false;
63876         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
63877         int64_t ret_ref = 0;
63878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63880         return ret_ref;
63881 }
63882
63883 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
63884         LDKShutdownScript obj_conv;
63885         obj_conv.inner = untag_ptr(obj);
63886         obj_conv.is_owned = ptr_is_owned(obj);
63887         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63888         obj_conv.is_owned = false;
63889         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
63890         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63891         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63892         CVec_u8Z_free(ret_var);
63893         return ret_arr;
63894 }
63895
63896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63897         LDKu8slice ser_ref;
63898         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63899         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63900         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
63901         *ret_conv = ShutdownScript_read(ser_ref);
63902         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63903         return tag_ptr(ret_conv, true);
63904 }
63905
63906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
63907         uint8_t pubkey_hash_arr[20];
63908         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
63909         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
63910         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
63911         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
63912         int64_t ret_ref = 0;
63913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63915         return ret_ref;
63916 }
63917
63918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
63919         uint8_t script_hash_arr[32];
63920         CHECK((*env)->GetArrayLength(env, script_hash) == 32);
63921         (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
63922         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
63923         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
63924         int64_t ret_ref = 0;
63925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63927         return ret_ref;
63928 }
63929
63930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int64_t witness_program) {
63931         void* witness_program_ptr = untag_ptr(witness_program);
63932         CHECK_ACCESS(witness_program_ptr);
63933         LDKWitnessProgram witness_program_conv = *(LDKWitnessProgram*)(witness_program_ptr);
63934         witness_program_conv = WitnessProgram_clone((LDKWitnessProgram*)untag_ptr(witness_program));
63935         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
63936         *ret_conv = ShutdownScript_new_witness_program(witness_program_conv);
63937         return tag_ptr(ret_conv, true);
63938 }
63939
63940 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
63941         LDKShutdownScript this_arg_conv;
63942         this_arg_conv.inner = untag_ptr(this_arg);
63943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63945         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
63946         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
63947         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63948         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63949         CVec_u8Z_free(ret_var);
63950         return ret_arr;
63951 }
63952
63953 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
63954         LDKShutdownScript this_arg_conv;
63955         this_arg_conv.inner = untag_ptr(this_arg);
63956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63958         this_arg_conv.is_owned = false;
63959         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
63960         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
63961         return ret_arr;
63962 }
63963
63964 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
63965         LDKShutdownScript this_arg_conv;
63966         this_arg_conv.inner = untag_ptr(this_arg);
63967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63969         this_arg_conv.is_owned = false;
63970         LDKInitFeatures features_conv;
63971         features_conv.inner = untag_ptr(features);
63972         features_conv.is_owned = ptr_is_owned(features);
63973         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
63974         features_conv.is_owned = false;
63975         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
63976         return ret_conv;
63977 }
63978
63979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
63980         if (!ptr_is_owned(this_ptr)) return;
63981         void* this_ptr_ptr = untag_ptr(this_ptr);
63982         CHECK_ACCESS(this_ptr_ptr);
63983         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
63984         FREE(untag_ptr(this_ptr));
63985         Retry_free(this_ptr_conv);
63986 }
63987
63988 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
63989         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
63990         *ret_copy = Retry_clone(arg);
63991         int64_t ret_ref = tag_ptr(ret_copy, true);
63992         return ret_ref;
63993 }
63994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63995         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
63996         int64_t ret_conv = Retry_clone_ptr(arg_conv);
63997         return ret_conv;
63998 }
63999
64000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64001         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
64002         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
64003         *ret_copy = Retry_clone(orig_conv);
64004         int64_t ret_ref = tag_ptr(ret_copy, true);
64005         return ret_ref;
64006 }
64007
64008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int32_t a) {
64009         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
64010         *ret_copy = Retry_attempts(a);
64011         int64_t ret_ref = tag_ptr(ret_copy, true);
64012         return ret_ref;
64013 }
64014
64015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) {
64016         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
64017         *ret_copy = Retry_timeout(a);
64018         int64_t ret_ref = tag_ptr(ret_copy, true);
64019         return ret_ref;
64020 }
64021
64022 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64023         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
64024         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
64025         jboolean ret_conv = Retry_eq(a_conv, b_conv);
64026         return ret_conv;
64027 }
64028
64029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) {
64030         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
64031         int64_t ret_conv = Retry_hash(o_conv);
64032         return ret_conv;
64033 }
64034
64035 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Retry_1write(JNIEnv *env, jclass clz, int64_t obj) {
64036         LDKRetry* obj_conv = (LDKRetry*)untag_ptr(obj);
64037         LDKCVec_u8Z ret_var = Retry_write(obj_conv);
64038         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64039         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64040         CVec_u8Z_free(ret_var);
64041         return ret_arr;
64042 }
64043
64044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64045         LDKu8slice ser_ref;
64046         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64047         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64048         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
64049         *ret_conv = Retry_read(ser_ref);
64050         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64051         return tag_ptr(ret_conv, true);
64052 }
64053
64054 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64055         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
64056         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_clone(orig_conv));
64057         return ret_conv;
64058 }
64059
64060 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1payment_1expired(JNIEnv *env, jclass clz) {
64061         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_payment_expired());
64062         return ret_conv;
64063 }
64064
64065 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1route_1not_1found(JNIEnv *env, jclass clz) {
64066         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_route_not_found());
64067         return ret_conv;
64068 }
64069
64070 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
64071         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_duplicate_payment());
64072         return ret_conv;
64073 }
64074
64075 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64076         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
64077         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
64078         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
64079         return ret_conv;
64080 }
64081
64082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
64083         if (!ptr_is_owned(this_ptr)) return;
64084         void* this_ptr_ptr = untag_ptr(this_ptr);
64085         CHECK_ACCESS(this_ptr_ptr);
64086         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
64087         FREE(untag_ptr(this_ptr));
64088         PaymentSendFailure_free(this_ptr_conv);
64089 }
64090
64091 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
64092         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64093         *ret_copy = PaymentSendFailure_clone(arg);
64094         int64_t ret_ref = tag_ptr(ret_copy, true);
64095         return ret_ref;
64096 }
64097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64098         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
64099         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
64100         return ret_conv;
64101 }
64102
64103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64104         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
64105         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64106         *ret_copy = PaymentSendFailure_clone(orig_conv);
64107         int64_t ret_ref = tag_ptr(ret_copy, true);
64108         return ret_ref;
64109 }
64110
64111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
64112         void* a_ptr = untag_ptr(a);
64113         CHECK_ACCESS(a_ptr);
64114         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
64115         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
64116         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64117         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
64118         int64_t ret_ref = tag_ptr(ret_copy, true);
64119         return ret_ref;
64120 }
64121
64122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
64123         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
64124         a_constr.datalen = (*env)->GetArrayLength(env, a);
64125         if (a_constr.datalen > 0)
64126                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
64127         else
64128                 a_constr.data = NULL;
64129         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
64130         for (size_t w = 0; w < a_constr.datalen; w++) {
64131                 int64_t a_conv_22 = a_vals[w];
64132                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
64133                 CHECK_ACCESS(a_conv_22_ptr);
64134                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
64135                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
64136                 a_constr.data[w] = a_conv_22_conv;
64137         }
64138         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
64139         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64140         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
64141         int64_t ret_ref = tag_ptr(ret_copy, true);
64142         return ret_ref;
64143 }
64144
64145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1resend_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
64146         LDKCVec_APIErrorZ a_constr;
64147         a_constr.datalen = (*env)->GetArrayLength(env, a);
64148         if (a_constr.datalen > 0)
64149                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
64150         else
64151                 a_constr.data = NULL;
64152         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
64153         for (size_t k = 0; k < a_constr.datalen; k++) {
64154                 int64_t a_conv_10 = a_vals[k];
64155                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
64156                 CHECK_ACCESS(a_conv_10_ptr);
64157                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
64158                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
64159                 a_constr.data[k] = a_conv_10_conv;
64160         }
64161         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
64162         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64163         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
64164         int64_t ret_ref = tag_ptr(ret_copy, true);
64165         return ret_ref;
64166 }
64167
64168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
64169         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64170         *ret_copy = PaymentSendFailure_duplicate_payment();
64171         int64_t ret_ref = tag_ptr(ret_copy, true);
64172         return ret_ref;
64173 }
64174
64175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial_1failure(JNIEnv *env, jclass clz, int64_tArray results, int64_t failed_paths_retry, int8_tArray payment_id) {
64176         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
64177         results_constr.datalen = (*env)->GetArrayLength(env, results);
64178         if (results_constr.datalen > 0)
64179                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
64180         else
64181                 results_constr.data = NULL;
64182         int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
64183         for (size_t w = 0; w < results_constr.datalen; w++) {
64184                 int64_t results_conv_22 = results_vals[w];
64185                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
64186                 CHECK_ACCESS(results_conv_22_ptr);
64187                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
64188                 results_constr.data[w] = results_conv_22_conv;
64189         }
64190         (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
64191         LDKRouteParameters failed_paths_retry_conv;
64192         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
64193         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
64194         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
64195         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
64196         LDKThirtyTwoBytes payment_id_ref;
64197         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
64198         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
64199         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64200         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
64201         int64_t ret_ref = tag_ptr(ret_copy, true);
64202         return ret_ref;
64203 }
64204
64205 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64206         LDKPaymentSendFailure* a_conv = (LDKPaymentSendFailure*)untag_ptr(a);
64207         LDKPaymentSendFailure* b_conv = (LDKPaymentSendFailure*)untag_ptr(b);
64208         jboolean ret_conv = PaymentSendFailure_eq(a_conv, b_conv);
64209         return ret_conv;
64210 }
64211
64212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
64213         if (!ptr_is_owned(this_ptr)) return;
64214         void* this_ptr_ptr = untag_ptr(this_ptr);
64215         CHECK_ACCESS(this_ptr_ptr);
64216         LDKProbeSendFailure this_ptr_conv = *(LDKProbeSendFailure*)(this_ptr_ptr);
64217         FREE(untag_ptr(this_ptr));
64218         ProbeSendFailure_free(this_ptr_conv);
64219 }
64220
64221 static inline uint64_t ProbeSendFailure_clone_ptr(LDKProbeSendFailure *NONNULL_PTR arg) {
64222         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
64223         *ret_copy = ProbeSendFailure_clone(arg);
64224         int64_t ret_ref = tag_ptr(ret_copy, true);
64225         return ret_ref;
64226 }
64227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64228         LDKProbeSendFailure* arg_conv = (LDKProbeSendFailure*)untag_ptr(arg);
64229         int64_t ret_conv = ProbeSendFailure_clone_ptr(arg_conv);
64230         return ret_conv;
64231 }
64232
64233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64234         LDKProbeSendFailure* orig_conv = (LDKProbeSendFailure*)untag_ptr(orig);
64235         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
64236         *ret_copy = ProbeSendFailure_clone(orig_conv);
64237         int64_t ret_ref = tag_ptr(ret_copy, true);
64238         return ret_ref;
64239 }
64240
64241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1route_1not_1found(JNIEnv *env, jclass clz) {
64242         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
64243         *ret_copy = ProbeSendFailure_route_not_found();
64244         int64_t ret_ref = tag_ptr(ret_copy, true);
64245         return ret_ref;
64246 }
64247
64248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1sending_1failed(JNIEnv *env, jclass clz, int64_t a) {
64249         void* a_ptr = untag_ptr(a);
64250         CHECK_ACCESS(a_ptr);
64251         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
64252         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
64253         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
64254         *ret_copy = ProbeSendFailure_sending_failed(a_conv);
64255         int64_t ret_ref = tag_ptr(ret_copy, true);
64256         return ret_ref;
64257 }
64258
64259 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64260         LDKProbeSendFailure* a_conv = (LDKProbeSendFailure*)untag_ptr(a);
64261         LDKProbeSendFailure* b_conv = (LDKProbeSendFailure*)untag_ptr(b);
64262         jboolean ret_conv = ProbeSendFailure_eq(a_conv, b_conv);
64263         return ret_conv;
64264 }
64265
64266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64267         LDKRecipientOnionFields this_obj_conv;
64268         this_obj_conv.inner = untag_ptr(this_obj);
64269         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64271         RecipientOnionFields_free(this_obj_conv);
64272 }
64273
64274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
64275         LDKRecipientOnionFields this_ptr_conv;
64276         this_ptr_conv.inner = untag_ptr(this_ptr);
64277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64279         this_ptr_conv.is_owned = false;
64280         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
64281         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
64282         int64_t ret_ref = tag_ptr(ret_copy, true);
64283         return ret_ref;
64284 }
64285
64286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64287         LDKRecipientOnionFields this_ptr_conv;
64288         this_ptr_conv.inner = untag_ptr(this_ptr);
64289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64291         this_ptr_conv.is_owned = false;
64292         void* val_ptr = untag_ptr(val);
64293         CHECK_ACCESS(val_ptr);
64294         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
64295         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
64296         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
64297 }
64298
64299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1get_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_ptr) {
64300         LDKRecipientOnionFields this_ptr_conv;
64301         this_ptr_conv.inner = untag_ptr(this_ptr);
64302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64304         this_ptr_conv.is_owned = false;
64305         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
64306         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
64307         int64_t ret_ref = tag_ptr(ret_copy, true);
64308         return ret_ref;
64309 }
64310
64311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1set_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
64312         LDKRecipientOnionFields this_ptr_conv;
64313         this_ptr_conv.inner = untag_ptr(this_ptr);
64314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64316         this_ptr_conv.is_owned = false;
64317         void* val_ptr = untag_ptr(val);
64318         CHECK_ACCESS(val_ptr);
64319         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
64320         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
64321         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
64322 }
64323
64324 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
64325         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
64326         int64_t ret_ref = 0;
64327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64329         return ret_ref;
64330 }
64331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64332         LDKRecipientOnionFields arg_conv;
64333         arg_conv.inner = untag_ptr(arg);
64334         arg_conv.is_owned = ptr_is_owned(arg);
64335         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64336         arg_conv.is_owned = false;
64337         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
64338         return ret_conv;
64339 }
64340
64341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64342         LDKRecipientOnionFields orig_conv;
64343         orig_conv.inner = untag_ptr(orig);
64344         orig_conv.is_owned = ptr_is_owned(orig);
64345         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64346         orig_conv.is_owned = false;
64347         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
64348         int64_t ret_ref = 0;
64349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64351         return ret_ref;
64352 }
64353
64354 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64355         LDKRecipientOnionFields a_conv;
64356         a_conv.inner = untag_ptr(a);
64357         a_conv.is_owned = ptr_is_owned(a);
64358         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64359         a_conv.is_owned = false;
64360         LDKRecipientOnionFields b_conv;
64361         b_conv.inner = untag_ptr(b);
64362         b_conv.is_owned = ptr_is_owned(b);
64363         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64364         b_conv.is_owned = false;
64365         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
64366         return ret_conv;
64367 }
64368
64369 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1write(JNIEnv *env, jclass clz, int64_t obj) {
64370         LDKRecipientOnionFields obj_conv;
64371         obj_conv.inner = untag_ptr(obj);
64372         obj_conv.is_owned = ptr_is_owned(obj);
64373         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64374         obj_conv.is_owned = false;
64375         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
64376         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64377         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64378         CVec_u8Z_free(ret_var);
64379         return ret_arr;
64380 }
64381
64382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64383         LDKu8slice ser_ref;
64384         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64385         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64386         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
64387         *ret_conv = RecipientOnionFields_read(ser_ref);
64388         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64389         return tag_ptr(ret_conv, true);
64390 }
64391
64392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1secret_1only(JNIEnv *env, jclass clz, int8_tArray payment_secret) {
64393         LDKThirtyTwoBytes payment_secret_ref;
64394         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
64395         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
64396         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
64397         int64_t ret_ref = 0;
64398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64400         return ret_ref;
64401 }
64402
64403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1spontaneous_1empty(JNIEnv *env, jclass clz) {
64404         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
64405         int64_t ret_ref = 0;
64406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64408         return ret_ref;
64409 }
64410
64411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1with_1custom_1tlvs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray custom_tlvs) {
64412         LDKRecipientOnionFields this_arg_conv;
64413         this_arg_conv.inner = untag_ptr(this_arg);
64414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64416         this_arg_conv = RecipientOnionFields_clone(&this_arg_conv);
64417         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
64418         custom_tlvs_constr.datalen = (*env)->GetArrayLength(env, custom_tlvs);
64419         if (custom_tlvs_constr.datalen > 0)
64420                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
64421         else
64422                 custom_tlvs_constr.data = NULL;
64423         int64_t* custom_tlvs_vals = (*env)->GetLongArrayElements (env, custom_tlvs, NULL);
64424         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
64425                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
64426                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
64427                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
64428                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
64429                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
64430                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
64431         }
64432         (*env)->ReleaseLongArrayElements(env, custom_tlvs, custom_tlvs_vals, 0);
64433         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
64434         *ret_conv = RecipientOnionFields_with_custom_tlvs(this_arg_conv, custom_tlvs_constr);
64435         return tag_ptr(ret_conv, true);
64436 }
64437
64438 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1custom_1tlvs(JNIEnv *env, jclass clz, int64_t this_arg) {
64439         LDKRecipientOnionFields this_arg_conv;
64440         this_arg_conv.inner = untag_ptr(this_arg);
64441         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64443         this_arg_conv.is_owned = false;
64444         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret_var = RecipientOnionFields_custom_tlvs(&this_arg_conv);
64445         int64_tArray ret_arr = NULL;
64446         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
64447         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
64448         for (size_t x = 0; x < ret_var.datalen; x++) {
64449                 LDKC2Tuple_u64CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
64450                 *ret_conv_23_conv = ret_var.data[x];
64451                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
64452         }
64453         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
64454         FREE(ret_var.data);
64455         return ret_arr;
64456 }
64457
64458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
64459         if (!ptr_is_owned(this_ptr)) return;
64460         void* this_ptr_ptr = untag_ptr(this_ptr);
64461         CHECK_ACCESS(this_ptr_ptr);
64462         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
64463         FREE(untag_ptr(this_ptr));
64464         CustomMessageReader_free(this_ptr_conv);
64465 }
64466
64467 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
64468         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
64469         *ret_ret = Type_clone(arg);
64470         return tag_ptr(ret_ret, true);
64471 }
64472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64473         void* arg_ptr = untag_ptr(arg);
64474         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
64475         LDKType* arg_conv = (LDKType*)arg_ptr;
64476         int64_t ret_conv = Type_clone_ptr(arg_conv);
64477         return ret_conv;
64478 }
64479
64480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64481         void* orig_ptr = untag_ptr(orig);
64482         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
64483         LDKType* orig_conv = (LDKType*)orig_ptr;
64484         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
64485         *ret_ret = Type_clone(orig_conv);
64486         return tag_ptr(ret_ret, true);
64487 }
64488
64489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
64490         if (!ptr_is_owned(this_ptr)) return;
64491         void* this_ptr_ptr = untag_ptr(this_ptr);
64492         CHECK_ACCESS(this_ptr_ptr);
64493         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
64494         FREE(untag_ptr(this_ptr));
64495         Type_free(this_ptr_conv);
64496 }
64497
64498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Offer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64499         LDKOffer this_obj_conv;
64500         this_obj_conv.inner = untag_ptr(this_obj);
64501         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64503         Offer_free(this_obj_conv);
64504 }
64505
64506 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
64507         LDKOffer ret_var = Offer_clone(arg);
64508         int64_t ret_ref = 0;
64509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64511         return ret_ref;
64512 }
64513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64514         LDKOffer arg_conv;
64515         arg_conv.inner = untag_ptr(arg);
64516         arg_conv.is_owned = ptr_is_owned(arg);
64517         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64518         arg_conv.is_owned = false;
64519         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
64520         return ret_conv;
64521 }
64522
64523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64524         LDKOffer orig_conv;
64525         orig_conv.inner = untag_ptr(orig);
64526         orig_conv.is_owned = ptr_is_owned(orig);
64527         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64528         orig_conv.is_owned = false;
64529         LDKOffer ret_var = Offer_clone(&orig_conv);
64530         int64_t ret_ref = 0;
64531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64533         return ret_ref;
64534 }
64535
64536 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
64537         LDKOffer this_arg_conv;
64538         this_arg_conv.inner = untag_ptr(this_arg);
64539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64541         this_arg_conv.is_owned = false;
64542         LDKCVec_ThirtyTwoBytesZ ret_var = Offer_chains(&this_arg_conv);
64543         jobjectArray ret_arr = NULL;
64544         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
64545         ;
64546         for (size_t i = 0; i < ret_var.datalen; i++) {
64547                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
64548                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
64549                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
64550         }
64551         
64552         FREE(ret_var.data);
64553         return ret_arr;
64554 }
64555
64556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
64557         LDKOffer this_arg_conv;
64558         this_arg_conv.inner = untag_ptr(this_arg);
64559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64561         this_arg_conv.is_owned = false;
64562         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
64563         *ret_copy = Offer_metadata(&this_arg_conv);
64564         int64_t ret_ref = tag_ptr(ret_copy, true);
64565         return ret_ref;
64566 }
64567
64568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
64569         LDKOffer this_arg_conv;
64570         this_arg_conv.inner = untag_ptr(this_arg);
64571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64573         this_arg_conv.is_owned = false;
64574         LDKAmount ret_var = Offer_amount(&this_arg_conv);
64575         int64_t ret_ref = 0;
64576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64578         return ret_ref;
64579 }
64580
64581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
64582         LDKOffer this_arg_conv;
64583         this_arg_conv.inner = untag_ptr(this_arg);
64584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64586         this_arg_conv.is_owned = false;
64587         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
64588         int64_t ret_ref = 0;
64589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64591         return ret_ref;
64592 }
64593
64594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
64595         LDKOffer this_arg_conv;
64596         this_arg_conv.inner = untag_ptr(this_arg);
64597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64599         this_arg_conv.is_owned = false;
64600         LDKOfferFeatures ret_var = Offer_offer_features(&this_arg_conv);
64601         int64_t ret_ref = 0;
64602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64604         return ret_ref;
64605 }
64606
64607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
64608         LDKOffer this_arg_conv;
64609         this_arg_conv.inner = untag_ptr(this_arg);
64610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64612         this_arg_conv.is_owned = false;
64613         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64614         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
64615         int64_t ret_ref = tag_ptr(ret_copy, true);
64616         return ret_ref;
64617 }
64618
64619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
64620         LDKOffer this_arg_conv;
64621         this_arg_conv.inner = untag_ptr(this_arg);
64622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64624         this_arg_conv.is_owned = false;
64625         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
64626         int64_t ret_ref = 0;
64627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64629         return ret_ref;
64630 }
64631
64632 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
64633         LDKOffer this_arg_conv;
64634         this_arg_conv.inner = untag_ptr(this_arg);
64635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64637         this_arg_conv.is_owned = false;
64638         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
64639         int64_tArray ret_arr = NULL;
64640         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
64641         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
64642         for (size_t n = 0; n < ret_var.datalen; n++) {
64643                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
64644                 int64_t ret_conv_13_ref = 0;
64645                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
64646                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
64647                 ret_arr_ptr[n] = ret_conv_13_ref;
64648         }
64649         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
64650         FREE(ret_var.data);
64651         return ret_arr;
64652 }
64653
64654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
64655         LDKOffer this_arg_conv;
64656         this_arg_conv.inner = untag_ptr(this_arg);
64657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64659         this_arg_conv.is_owned = false;
64660         LDKQuantity ret_var = Offer_supported_quantity(&this_arg_conv);
64661         int64_t ret_ref = 0;
64662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64664         return ret_ref;
64665 }
64666
64667 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
64668         LDKOffer this_arg_conv;
64669         this_arg_conv.inner = untag_ptr(this_arg);
64670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64672         this_arg_conv.is_owned = false;
64673         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
64674         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Offer_signing_pubkey(&this_arg_conv).compressed_form);
64675         return ret_arr;
64676 }
64677
64678 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1supports_1chain(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray chain) {
64679         LDKOffer this_arg_conv;
64680         this_arg_conv.inner = untag_ptr(this_arg);
64681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64683         this_arg_conv.is_owned = false;
64684         LDKThirtyTwoBytes chain_ref;
64685         CHECK((*env)->GetArrayLength(env, chain) == 32);
64686         (*env)->GetByteArrayRegion(env, chain, 0, 32, chain_ref.data);
64687         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
64688         return ret_conv;
64689 }
64690
64691 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
64692         LDKOffer this_arg_conv;
64693         this_arg_conv.inner = untag_ptr(this_arg);
64694         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64696         this_arg_conv.is_owned = false;
64697         jboolean ret_conv = Offer_is_expired(&this_arg_conv);
64698         return ret_conv;
64699 }
64700
64701 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1expired_1no_1std(JNIEnv *env, jclass clz, int64_t this_arg, int64_t duration_since_epoch) {
64702         LDKOffer this_arg_conv;
64703         this_arg_conv.inner = untag_ptr(this_arg);
64704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64706         this_arg_conv.is_owned = false;
64707         jboolean ret_conv = Offer_is_expired_no_std(&this_arg_conv, duration_since_epoch);
64708         return ret_conv;
64709 }
64710
64711 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1valid_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
64712         LDKOffer this_arg_conv;
64713         this_arg_conv.inner = untag_ptr(this_arg);
64714         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64716         this_arg_conv.is_owned = false;
64717         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
64718         return ret_conv;
64719 }
64720
64721 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1expects_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
64722         LDKOffer this_arg_conv;
64723         this_arg_conv.inner = untag_ptr(this_arg);
64724         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64726         this_arg_conv.is_owned = false;
64727         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
64728         return ret_conv;
64729 }
64730
64731 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1write(JNIEnv *env, jclass clz, int64_t obj) {
64732         LDKOffer obj_conv;
64733         obj_conv.inner = untag_ptr(obj);
64734         obj_conv.is_owned = ptr_is_owned(obj);
64735         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64736         obj_conv.is_owned = false;
64737         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
64738         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64739         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64740         CVec_u8Z_free(ret_var);
64741         return ret_arr;
64742 }
64743
64744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Amount_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64745         LDKAmount this_obj_conv;
64746         this_obj_conv.inner = untag_ptr(this_obj);
64747         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64749         Amount_free(this_obj_conv);
64750 }
64751
64752 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
64753         LDKAmount ret_var = Amount_clone(arg);
64754         int64_t ret_ref = 0;
64755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64757         return ret_ref;
64758 }
64759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64760         LDKAmount arg_conv;
64761         arg_conv.inner = untag_ptr(arg);
64762         arg_conv.is_owned = ptr_is_owned(arg);
64763         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64764         arg_conv.is_owned = false;
64765         int64_t ret_conv = Amount_clone_ptr(&arg_conv);
64766         return ret_conv;
64767 }
64768
64769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64770         LDKAmount orig_conv;
64771         orig_conv.inner = untag_ptr(orig);
64772         orig_conv.is_owned = ptr_is_owned(orig);
64773         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64774         orig_conv.is_owned = false;
64775         LDKAmount ret_var = Amount_clone(&orig_conv);
64776         int64_t ret_ref = 0;
64777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64779         return ret_ref;
64780 }
64781
64782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Quantity_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64783         LDKQuantity this_obj_conv;
64784         this_obj_conv.inner = untag_ptr(this_obj);
64785         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64787         Quantity_free(this_obj_conv);
64788 }
64789
64790 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
64791         LDKQuantity ret_var = Quantity_clone(arg);
64792         int64_t ret_ref = 0;
64793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64795         return ret_ref;
64796 }
64797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64798         LDKQuantity arg_conv;
64799         arg_conv.inner = untag_ptr(arg);
64800         arg_conv.is_owned = ptr_is_owned(arg);
64801         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64802         arg_conv.is_owned = false;
64803         int64_t ret_conv = Quantity_clone_ptr(&arg_conv);
64804         return ret_conv;
64805 }
64806
64807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64808         LDKQuantity orig_conv;
64809         orig_conv.inner = untag_ptr(orig);
64810         orig_conv.is_owned = ptr_is_owned(orig);
64811         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64812         orig_conv.is_owned = false;
64813         LDKQuantity ret_var = Quantity_clone(&orig_conv);
64814         int64_t ret_ref = 0;
64815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64817         return ret_ref;
64818 }
64819
64820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1from_1str(JNIEnv *env, jclass clz, jstring s) {
64821         LDKStr s_conv = java_to_owned_str(env, s);
64822         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
64823         *ret_conv = Offer_from_str(s_conv);
64824         return tag_ptr(ret_conv, true);
64825 }
64826
64827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64828         LDKUnsignedBolt12Invoice this_obj_conv;
64829         this_obj_conv.inner = untag_ptr(this_obj);
64830         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64832         UnsignedBolt12Invoice_free(this_obj_conv);
64833 }
64834
64835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1tagged_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
64836         LDKUnsignedBolt12Invoice this_arg_conv;
64837         this_arg_conv.inner = untag_ptr(this_arg);
64838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64840         this_arg_conv.is_owned = false;
64841         LDKTaggedHash ret_var = UnsignedBolt12Invoice_tagged_hash(&this_arg_conv);
64842         int64_t ret_ref = 0;
64843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64845         return ret_ref;
64846 }
64847
64848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64849         LDKBolt12Invoice this_obj_conv;
64850         this_obj_conv.inner = untag_ptr(this_obj);
64851         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64853         Bolt12Invoice_free(this_obj_conv);
64854 }
64855
64856 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
64857         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
64858         int64_t ret_ref = 0;
64859         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64860         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64861         return ret_ref;
64862 }
64863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64864         LDKBolt12Invoice arg_conv;
64865         arg_conv.inner = untag_ptr(arg);
64866         arg_conv.is_owned = ptr_is_owned(arg);
64867         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64868         arg_conv.is_owned = false;
64869         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
64870         return ret_conv;
64871 }
64872
64873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64874         LDKBolt12Invoice orig_conv;
64875         orig_conv.inner = untag_ptr(orig);
64876         orig_conv.is_owned = ptr_is_owned(orig);
64877         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64878         orig_conv.is_owned = false;
64879         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
64880         int64_t ret_ref = 0;
64881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64883         return ret_ref;
64884 }
64885
64886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
64887         LDKUnsignedBolt12Invoice this_arg_conv;
64888         this_arg_conv.inner = untag_ptr(this_arg);
64889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64891         this_arg_conv.is_owned = false;
64892         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
64893         *ret_copy = UnsignedBolt12Invoice_offer_chains(&this_arg_conv);
64894         int64_t ret_ref = tag_ptr(ret_copy, true);
64895         return ret_ref;
64896 }
64897
64898 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
64899         LDKUnsignedBolt12Invoice this_arg_conv;
64900         this_arg_conv.inner = untag_ptr(this_arg);
64901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64903         this_arg_conv.is_owned = false;
64904         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
64905         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedBolt12Invoice_chain(&this_arg_conv).data);
64906         return ret_arr;
64907 }
64908
64909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
64910         LDKUnsignedBolt12Invoice this_arg_conv;
64911         this_arg_conv.inner = untag_ptr(this_arg);
64912         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64914         this_arg_conv.is_owned = false;
64915         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
64916         *ret_copy = UnsignedBolt12Invoice_metadata(&this_arg_conv);
64917         int64_t ret_ref = tag_ptr(ret_copy, true);
64918         return ret_ref;
64919 }
64920
64921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
64922         LDKUnsignedBolt12Invoice this_arg_conv;
64923         this_arg_conv.inner = untag_ptr(this_arg);
64924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64926         this_arg_conv.is_owned = false;
64927         LDKAmount ret_var = UnsignedBolt12Invoice_amount(&this_arg_conv);
64928         int64_t ret_ref = 0;
64929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64931         return ret_ref;
64932 }
64933
64934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
64935         LDKUnsignedBolt12Invoice this_arg_conv;
64936         this_arg_conv.inner = untag_ptr(this_arg);
64937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64939         this_arg_conv.is_owned = false;
64940         LDKOfferFeatures ret_var = UnsignedBolt12Invoice_offer_features(&this_arg_conv);
64941         int64_t ret_ref = 0;
64942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64944         return ret_ref;
64945 }
64946
64947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
64948         LDKUnsignedBolt12Invoice this_arg_conv;
64949         this_arg_conv.inner = untag_ptr(this_arg);
64950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64952         this_arg_conv.is_owned = false;
64953         LDKPrintableString ret_var = UnsignedBolt12Invoice_description(&this_arg_conv);
64954         int64_t ret_ref = 0;
64955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64957         return ret_ref;
64958 }
64959
64960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
64961         LDKUnsignedBolt12Invoice this_arg_conv;
64962         this_arg_conv.inner = untag_ptr(this_arg);
64963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64965         this_arg_conv.is_owned = false;
64966         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
64967         *ret_copy = UnsignedBolt12Invoice_absolute_expiry(&this_arg_conv);
64968         int64_t ret_ref = tag_ptr(ret_copy, true);
64969         return ret_ref;
64970 }
64971
64972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
64973         LDKUnsignedBolt12Invoice this_arg_conv;
64974         this_arg_conv.inner = untag_ptr(this_arg);
64975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64977         this_arg_conv.is_owned = false;
64978         LDKPrintableString ret_var = UnsignedBolt12Invoice_issuer(&this_arg_conv);
64979         int64_t ret_ref = 0;
64980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64982         return ret_ref;
64983 }
64984
64985 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1message_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
64986         LDKUnsignedBolt12Invoice this_arg_conv;
64987         this_arg_conv.inner = untag_ptr(this_arg);
64988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64990         this_arg_conv.is_owned = false;
64991         LDKCVec_BlindedPathZ ret_var = UnsignedBolt12Invoice_message_paths(&this_arg_conv);
64992         int64_tArray ret_arr = NULL;
64993         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
64994         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
64995         for (size_t n = 0; n < ret_var.datalen; n++) {
64996                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
64997                 int64_t ret_conv_13_ref = 0;
64998                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
64999                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
65000                 ret_arr_ptr[n] = ret_conv_13_ref;
65001         }
65002         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
65003         FREE(ret_var.data);
65004         return ret_arr;
65005 }
65006
65007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
65008         LDKUnsignedBolt12Invoice this_arg_conv;
65009         this_arg_conv.inner = untag_ptr(this_arg);
65010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65012         this_arg_conv.is_owned = false;
65013         LDKQuantity ret_var = UnsignedBolt12Invoice_supported_quantity(&this_arg_conv);
65014         int64_t ret_ref = 0;
65015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65017         return ret_ref;
65018 }
65019
65020 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
65021         LDKUnsignedBolt12Invoice this_arg_conv;
65022         this_arg_conv.inner = untag_ptr(this_arg);
65023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65025         this_arg_conv.is_owned = false;
65026         LDKu8slice ret_var = UnsignedBolt12Invoice_payer_metadata(&this_arg_conv);
65027         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65028         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65029         return ret_arr;
65030 }
65031
65032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
65033         LDKUnsignedBolt12Invoice this_arg_conv;
65034         this_arg_conv.inner = untag_ptr(this_arg);
65035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65037         this_arg_conv.is_owned = false;
65038         LDKInvoiceRequestFeatures ret_var = UnsignedBolt12Invoice_invoice_request_features(&this_arg_conv);
65039         int64_t ret_ref = 0;
65040         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65041         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65042         return ret_ref;
65043 }
65044
65045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
65046         LDKUnsignedBolt12Invoice this_arg_conv;
65047         this_arg_conv.inner = untag_ptr(this_arg);
65048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65050         this_arg_conv.is_owned = false;
65051         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65052         *ret_copy = UnsignedBolt12Invoice_quantity(&this_arg_conv);
65053         int64_t ret_ref = tag_ptr(ret_copy, true);
65054         return ret_ref;
65055 }
65056
65057 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
65058         LDKUnsignedBolt12Invoice this_arg_conv;
65059         this_arg_conv.inner = untag_ptr(this_arg);
65060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65062         this_arg_conv.is_owned = false;
65063         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
65064         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedBolt12Invoice_payer_id(&this_arg_conv).compressed_form);
65065         return ret_arr;
65066 }
65067
65068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
65069         LDKUnsignedBolt12Invoice this_arg_conv;
65070         this_arg_conv.inner = untag_ptr(this_arg);
65071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65073         this_arg_conv.is_owned = false;
65074         LDKPrintableString ret_var = UnsignedBolt12Invoice_payer_note(&this_arg_conv);
65075         int64_t ret_ref = 0;
65076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65078         return ret_ref;
65079 }
65080
65081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1created_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
65082         LDKUnsignedBolt12Invoice this_arg_conv;
65083         this_arg_conv.inner = untag_ptr(this_arg);
65084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65086         this_arg_conv.is_owned = false;
65087         int64_t ret_conv = UnsignedBolt12Invoice_created_at(&this_arg_conv);
65088         return ret_conv;
65089 }
65090
65091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
65092         LDKUnsignedBolt12Invoice this_arg_conv;
65093         this_arg_conv.inner = untag_ptr(this_arg);
65094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65096         this_arg_conv.is_owned = false;
65097         int64_t ret_conv = UnsignedBolt12Invoice_relative_expiry(&this_arg_conv);
65098         return ret_conv;
65099 }
65100
65101 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
65102         LDKUnsignedBolt12Invoice this_arg_conv;
65103         this_arg_conv.inner = untag_ptr(this_arg);
65104         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65106         this_arg_conv.is_owned = false;
65107         jboolean ret_conv = UnsignedBolt12Invoice_is_expired(&this_arg_conv);
65108         return ret_conv;
65109 }
65110
65111 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
65112         LDKUnsignedBolt12Invoice this_arg_conv;
65113         this_arg_conv.inner = untag_ptr(this_arg);
65114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65116         this_arg_conv.is_owned = false;
65117         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
65118         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedBolt12Invoice_payment_hash(&this_arg_conv).data);
65119         return ret_arr;
65120 }
65121
65122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
65123         LDKUnsignedBolt12Invoice this_arg_conv;
65124         this_arg_conv.inner = untag_ptr(this_arg);
65125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65127         this_arg_conv.is_owned = false;
65128         int64_t ret_conv = UnsignedBolt12Invoice_amount_msats(&this_arg_conv);
65129         return ret_conv;
65130 }
65131
65132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
65133         LDKUnsignedBolt12Invoice this_arg_conv;
65134         this_arg_conv.inner = untag_ptr(this_arg);
65135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65137         this_arg_conv.is_owned = false;
65138         LDKBolt12InvoiceFeatures ret_var = UnsignedBolt12Invoice_invoice_features(&this_arg_conv);
65139         int64_t ret_ref = 0;
65140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65142         return ret_ref;
65143 }
65144
65145 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
65146         LDKUnsignedBolt12Invoice this_arg_conv;
65147         this_arg_conv.inner = untag_ptr(this_arg);
65148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65150         this_arg_conv.is_owned = false;
65151         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
65152         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form);
65153         return ret_arr;
65154 }
65155
65156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
65157         LDKBolt12Invoice this_arg_conv;
65158         this_arg_conv.inner = untag_ptr(this_arg);
65159         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65161         this_arg_conv.is_owned = false;
65162         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
65163         *ret_copy = Bolt12Invoice_offer_chains(&this_arg_conv);
65164         int64_t ret_ref = tag_ptr(ret_copy, true);
65165         return ret_ref;
65166 }
65167
65168 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
65169         LDKBolt12Invoice this_arg_conv;
65170         this_arg_conv.inner = untag_ptr(this_arg);
65171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65173         this_arg_conv.is_owned = false;
65174         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
65175         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_chain(&this_arg_conv).data);
65176         return ret_arr;
65177 }
65178
65179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
65180         LDKBolt12Invoice this_arg_conv;
65181         this_arg_conv.inner = untag_ptr(this_arg);
65182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65184         this_arg_conv.is_owned = false;
65185         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
65186         *ret_copy = Bolt12Invoice_metadata(&this_arg_conv);
65187         int64_t ret_ref = tag_ptr(ret_copy, true);
65188         return ret_ref;
65189 }
65190
65191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
65192         LDKBolt12Invoice this_arg_conv;
65193         this_arg_conv.inner = untag_ptr(this_arg);
65194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65196         this_arg_conv.is_owned = false;
65197         LDKAmount ret_var = Bolt12Invoice_amount(&this_arg_conv);
65198         int64_t ret_ref = 0;
65199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65201         return ret_ref;
65202 }
65203
65204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
65205         LDKBolt12Invoice this_arg_conv;
65206         this_arg_conv.inner = untag_ptr(this_arg);
65207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65209         this_arg_conv.is_owned = false;
65210         LDKOfferFeatures ret_var = Bolt12Invoice_offer_features(&this_arg_conv);
65211         int64_t ret_ref = 0;
65212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65214         return ret_ref;
65215 }
65216
65217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
65218         LDKBolt12Invoice this_arg_conv;
65219         this_arg_conv.inner = untag_ptr(this_arg);
65220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65222         this_arg_conv.is_owned = false;
65223         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
65224         int64_t ret_ref = 0;
65225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65227         return ret_ref;
65228 }
65229
65230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
65231         LDKBolt12Invoice this_arg_conv;
65232         this_arg_conv.inner = untag_ptr(this_arg);
65233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65235         this_arg_conv.is_owned = false;
65236         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65237         *ret_copy = Bolt12Invoice_absolute_expiry(&this_arg_conv);
65238         int64_t ret_ref = tag_ptr(ret_copy, true);
65239         return ret_ref;
65240 }
65241
65242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
65243         LDKBolt12Invoice this_arg_conv;
65244         this_arg_conv.inner = untag_ptr(this_arg);
65245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65247         this_arg_conv.is_owned = false;
65248         LDKPrintableString ret_var = Bolt12Invoice_issuer(&this_arg_conv);
65249         int64_t ret_ref = 0;
65250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65252         return ret_ref;
65253 }
65254
65255 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1message_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
65256         LDKBolt12Invoice this_arg_conv;
65257         this_arg_conv.inner = untag_ptr(this_arg);
65258         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65260         this_arg_conv.is_owned = false;
65261         LDKCVec_BlindedPathZ ret_var = Bolt12Invoice_message_paths(&this_arg_conv);
65262         int64_tArray ret_arr = NULL;
65263         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
65264         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
65265         for (size_t n = 0; n < ret_var.datalen; n++) {
65266                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
65267                 int64_t ret_conv_13_ref = 0;
65268                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
65269                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
65270                 ret_arr_ptr[n] = ret_conv_13_ref;
65271         }
65272         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
65273         FREE(ret_var.data);
65274         return ret_arr;
65275 }
65276
65277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
65278         LDKBolt12Invoice this_arg_conv;
65279         this_arg_conv.inner = untag_ptr(this_arg);
65280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65282         this_arg_conv.is_owned = false;
65283         LDKQuantity ret_var = Bolt12Invoice_supported_quantity(&this_arg_conv);
65284         int64_t ret_ref = 0;
65285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65287         return ret_ref;
65288 }
65289
65290 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
65291         LDKBolt12Invoice this_arg_conv;
65292         this_arg_conv.inner = untag_ptr(this_arg);
65293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65295         this_arg_conv.is_owned = false;
65296         LDKu8slice ret_var = Bolt12Invoice_payer_metadata(&this_arg_conv);
65297         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65298         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65299         return ret_arr;
65300 }
65301
65302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
65303         LDKBolt12Invoice this_arg_conv;
65304         this_arg_conv.inner = untag_ptr(this_arg);
65305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65307         this_arg_conv.is_owned = false;
65308         LDKInvoiceRequestFeatures ret_var = Bolt12Invoice_invoice_request_features(&this_arg_conv);
65309         int64_t ret_ref = 0;
65310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65312         return ret_ref;
65313 }
65314
65315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
65316         LDKBolt12Invoice this_arg_conv;
65317         this_arg_conv.inner = untag_ptr(this_arg);
65318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65320         this_arg_conv.is_owned = false;
65321         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65322         *ret_copy = Bolt12Invoice_quantity(&this_arg_conv);
65323         int64_t ret_ref = tag_ptr(ret_copy, true);
65324         return ret_ref;
65325 }
65326
65327 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
65328         LDKBolt12Invoice this_arg_conv;
65329         this_arg_conv.inner = untag_ptr(this_arg);
65330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65332         this_arg_conv.is_owned = false;
65333         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
65334         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt12Invoice_payer_id(&this_arg_conv).compressed_form);
65335         return ret_arr;
65336 }
65337
65338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
65339         LDKBolt12Invoice this_arg_conv;
65340         this_arg_conv.inner = untag_ptr(this_arg);
65341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65343         this_arg_conv.is_owned = false;
65344         LDKPrintableString ret_var = Bolt12Invoice_payer_note(&this_arg_conv);
65345         int64_t ret_ref = 0;
65346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65348         return ret_ref;
65349 }
65350
65351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1created_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
65352         LDKBolt12Invoice this_arg_conv;
65353         this_arg_conv.inner = untag_ptr(this_arg);
65354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65356         this_arg_conv.is_owned = false;
65357         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
65358         return ret_conv;
65359 }
65360
65361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
65362         LDKBolt12Invoice this_arg_conv;
65363         this_arg_conv.inner = untag_ptr(this_arg);
65364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65366         this_arg_conv.is_owned = false;
65367         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
65368         return ret_conv;
65369 }
65370
65371 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
65372         LDKBolt12Invoice this_arg_conv;
65373         this_arg_conv.inner = untag_ptr(this_arg);
65374         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65376         this_arg_conv.is_owned = false;
65377         jboolean ret_conv = Bolt12Invoice_is_expired(&this_arg_conv);
65378         return ret_conv;
65379 }
65380
65381 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
65382         LDKBolt12Invoice this_arg_conv;
65383         this_arg_conv.inner = untag_ptr(this_arg);
65384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65386         this_arg_conv.is_owned = false;
65387         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
65388         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_payment_hash(&this_arg_conv).data);
65389         return ret_arr;
65390 }
65391
65392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
65393         LDKBolt12Invoice this_arg_conv;
65394         this_arg_conv.inner = untag_ptr(this_arg);
65395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65397         this_arg_conv.is_owned = false;
65398         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
65399         return ret_conv;
65400 }
65401
65402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
65403         LDKBolt12Invoice this_arg_conv;
65404         this_arg_conv.inner = untag_ptr(this_arg);
65405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65407         this_arg_conv.is_owned = false;
65408         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_invoice_features(&this_arg_conv);
65409         int64_t ret_ref = 0;
65410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65412         return ret_ref;
65413 }
65414
65415 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
65416         LDKBolt12Invoice this_arg_conv;
65417         this_arg_conv.inner = untag_ptr(this_arg);
65418         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65420         this_arg_conv.is_owned = false;
65421         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
65422         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form);
65423         return ret_arr;
65424 }
65425
65426 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
65427         LDKBolt12Invoice this_arg_conv;
65428         this_arg_conv.inner = untag_ptr(this_arg);
65429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65431         this_arg_conv.is_owned = false;
65432         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
65433         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, Bolt12Invoice_signature(&this_arg_conv).compact_form);
65434         return ret_arr;
65435 }
65436
65437 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
65438         LDKBolt12Invoice this_arg_conv;
65439         this_arg_conv.inner = untag_ptr(this_arg);
65440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65442         this_arg_conv.is_owned = false;
65443         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
65444         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_signable_hash(&this_arg_conv).data);
65445         return ret_arr;
65446 }
65447
65448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t key) {
65449         LDKBolt12Invoice this_arg_conv;
65450         this_arg_conv.inner = untag_ptr(this_arg);
65451         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65453         this_arg_conv.is_owned = false;
65454         LDKExpandedKey key_conv;
65455         key_conv.inner = untag_ptr(key);
65456         key_conv.is_owned = ptr_is_owned(key);
65457         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
65458         key_conv.is_owned = false;
65459         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
65460         *ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
65461         return tag_ptr(ret_conv, true);
65462 }
65463
65464 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1write(JNIEnv *env, jclass clz, int64_t obj) {
65465         LDKUnsignedBolt12Invoice obj_conv;
65466         obj_conv.inner = untag_ptr(obj);
65467         obj_conv.is_owned = ptr_is_owned(obj);
65468         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65469         obj_conv.is_owned = false;
65470         LDKCVec_u8Z ret_var = UnsignedBolt12Invoice_write(&obj_conv);
65471         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65472         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65473         CVec_u8Z_free(ret_var);
65474         return ret_arr;
65475 }
65476
65477 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1write(JNIEnv *env, jclass clz, int64_t obj) {
65478         LDKBolt12Invoice obj_conv;
65479         obj_conv.inner = untag_ptr(obj);
65480         obj_conv.is_owned = ptr_is_owned(obj);
65481         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65482         obj_conv.is_owned = false;
65483         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
65484         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65485         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65486         CVec_u8Z_free(ret_var);
65487         return ret_arr;
65488 }
65489
65490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65491         LDKBlindedPayInfo this_obj_conv;
65492         this_obj_conv.inner = untag_ptr(this_obj);
65493         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65495         BlindedPayInfo_free(this_obj_conv);
65496 }
65497
65498 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65499         LDKBlindedPayInfo this_ptr_conv;
65500         this_ptr_conv.inner = untag_ptr(this_ptr);
65501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65503         this_ptr_conv.is_owned = false;
65504         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
65505         return ret_conv;
65506 }
65507
65508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
65509         LDKBlindedPayInfo this_ptr_conv;
65510         this_ptr_conv.inner = untag_ptr(this_ptr);
65511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65513         this_ptr_conv.is_owned = false;
65514         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
65515 }
65516
65517 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
65518         LDKBlindedPayInfo this_ptr_conv;
65519         this_ptr_conv.inner = untag_ptr(this_ptr);
65520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65522         this_ptr_conv.is_owned = false;
65523         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
65524         return ret_conv;
65525 }
65526
65527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
65528         LDKBlindedPayInfo this_ptr_conv;
65529         this_ptr_conv.inner = untag_ptr(this_ptr);
65530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65532         this_ptr_conv.is_owned = false;
65533         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
65534 }
65535
65536 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
65537         LDKBlindedPayInfo this_ptr_conv;
65538         this_ptr_conv.inner = untag_ptr(this_ptr);
65539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65541         this_ptr_conv.is_owned = false;
65542         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
65543         return ret_conv;
65544 }
65545
65546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
65547         LDKBlindedPayInfo this_ptr_conv;
65548         this_ptr_conv.inner = untag_ptr(this_ptr);
65549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65551         this_ptr_conv.is_owned = false;
65552         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
65553 }
65554
65555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65556         LDKBlindedPayInfo this_ptr_conv;
65557         this_ptr_conv.inner = untag_ptr(this_ptr);
65558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65560         this_ptr_conv.is_owned = false;
65561         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
65562         return ret_conv;
65563 }
65564
65565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65566         LDKBlindedPayInfo this_ptr_conv;
65567         this_ptr_conv.inner = untag_ptr(this_ptr);
65568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65570         this_ptr_conv.is_owned = false;
65571         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
65572 }
65573
65574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
65575         LDKBlindedPayInfo this_ptr_conv;
65576         this_ptr_conv.inner = untag_ptr(this_ptr);
65577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65579         this_ptr_conv.is_owned = false;
65580         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
65581         return ret_conv;
65582 }
65583
65584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65585         LDKBlindedPayInfo this_ptr_conv;
65586         this_ptr_conv.inner = untag_ptr(this_ptr);
65587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65589         this_ptr_conv.is_owned = false;
65590         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
65591 }
65592
65593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
65594         LDKBlindedPayInfo this_ptr_conv;
65595         this_ptr_conv.inner = untag_ptr(this_ptr);
65596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65598         this_ptr_conv.is_owned = false;
65599         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
65600         int64_t ret_ref = 0;
65601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65603         return ret_ref;
65604 }
65605
65606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65607         LDKBlindedPayInfo this_ptr_conv;
65608         this_ptr_conv.inner = untag_ptr(this_ptr);
65609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65611         this_ptr_conv.is_owned = false;
65612         LDKBlindedHopFeatures val_conv;
65613         val_conv.inner = untag_ptr(val);
65614         val_conv.is_owned = ptr_is_owned(val);
65615         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65616         val_conv = BlindedHopFeatures_clone(&val_conv);
65617         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
65618 }
65619
65620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1new(JNIEnv *env, jclass clz, int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t features_arg) {
65621         LDKBlindedHopFeatures features_arg_conv;
65622         features_arg_conv.inner = untag_ptr(features_arg);
65623         features_arg_conv.is_owned = ptr_is_owned(features_arg);
65624         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
65625         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
65626         LDKBlindedPayInfo ret_var = BlindedPayInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, features_arg_conv);
65627         int64_t ret_ref = 0;
65628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65630         return ret_ref;
65631 }
65632
65633 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
65634         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
65635         int64_t ret_ref = 0;
65636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65638         return ret_ref;
65639 }
65640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65641         LDKBlindedPayInfo arg_conv;
65642         arg_conv.inner = untag_ptr(arg);
65643         arg_conv.is_owned = ptr_is_owned(arg);
65644         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65645         arg_conv.is_owned = false;
65646         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
65647         return ret_conv;
65648 }
65649
65650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65651         LDKBlindedPayInfo orig_conv;
65652         orig_conv.inner = untag_ptr(orig);
65653         orig_conv.is_owned = ptr_is_owned(orig);
65654         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65655         orig_conv.is_owned = false;
65656         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
65657         int64_t ret_ref = 0;
65658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65660         return ret_ref;
65661 }
65662
65663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1hash(JNIEnv *env, jclass clz, int64_t o) {
65664         LDKBlindedPayInfo o_conv;
65665         o_conv.inner = untag_ptr(o);
65666         o_conv.is_owned = ptr_is_owned(o);
65667         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65668         o_conv.is_owned = false;
65669         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
65670         return ret_conv;
65671 }
65672
65673 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65674         LDKBlindedPayInfo a_conv;
65675         a_conv.inner = untag_ptr(a);
65676         a_conv.is_owned = ptr_is_owned(a);
65677         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65678         a_conv.is_owned = false;
65679         LDKBlindedPayInfo b_conv;
65680         b_conv.inner = untag_ptr(b);
65681         b_conv.is_owned = ptr_is_owned(b);
65682         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65683         b_conv.is_owned = false;
65684         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
65685         return ret_conv;
65686 }
65687
65688 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
65689         LDKBlindedPayInfo obj_conv;
65690         obj_conv.inner = untag_ptr(obj);
65691         obj_conv.is_owned = ptr_is_owned(obj);
65692         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65693         obj_conv.is_owned = false;
65694         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
65695         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65696         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65697         CVec_u8Z_free(ret_var);
65698         return ret_arr;
65699 }
65700
65701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
65702         LDKu8slice ser_ref;
65703         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
65704         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
65705         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
65706         *ret_conv = BlindedPayInfo_read(ser_ref);
65707         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
65708         return tag_ptr(ret_conv, true);
65709 }
65710
65711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65712         LDKInvoiceError this_obj_conv;
65713         this_obj_conv.inner = untag_ptr(this_obj);
65714         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65716         InvoiceError_free(this_obj_conv);
65717 }
65718
65719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1get_1erroneous_1field(JNIEnv *env, jclass clz, int64_t this_ptr) {
65720         LDKInvoiceError this_ptr_conv;
65721         this_ptr_conv.inner = untag_ptr(this_ptr);
65722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65724         this_ptr_conv.is_owned = false;
65725         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
65726         int64_t ret_ref = 0;
65727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65729         return ret_ref;
65730 }
65731
65732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1set_1erroneous_1field(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65733         LDKInvoiceError this_ptr_conv;
65734         this_ptr_conv.inner = untag_ptr(this_ptr);
65735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65737         this_ptr_conv.is_owned = false;
65738         LDKErroneousField val_conv;
65739         val_conv.inner = untag_ptr(val);
65740         val_conv.is_owned = ptr_is_owned(val);
65741         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65742         val_conv = ErroneousField_clone(&val_conv);
65743         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
65744 }
65745
65746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1get_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
65747         LDKInvoiceError this_ptr_conv;
65748         this_ptr_conv.inner = untag_ptr(this_ptr);
65749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65751         this_ptr_conv.is_owned = false;
65752         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
65753         int64_t ret_ref = 0;
65754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65756         return ret_ref;
65757 }
65758
65759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1set_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65760         LDKInvoiceError this_ptr_conv;
65761         this_ptr_conv.inner = untag_ptr(this_ptr);
65762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65764         this_ptr_conv.is_owned = false;
65765         LDKUntrustedString val_conv;
65766         val_conv.inner = untag_ptr(val);
65767         val_conv.is_owned = ptr_is_owned(val);
65768         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65769         val_conv = UntrustedString_clone(&val_conv);
65770         InvoiceError_set_message(&this_ptr_conv, val_conv);
65771 }
65772
65773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1new(JNIEnv *env, jclass clz, int64_t erroneous_field_arg, int64_t message_arg) {
65774         LDKErroneousField erroneous_field_arg_conv;
65775         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
65776         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
65777         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
65778         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
65779         LDKUntrustedString message_arg_conv;
65780         message_arg_conv.inner = untag_ptr(message_arg);
65781         message_arg_conv.is_owned = ptr_is_owned(message_arg);
65782         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
65783         message_arg_conv = UntrustedString_clone(&message_arg_conv);
65784         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
65785         int64_t ret_ref = 0;
65786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65788         return ret_ref;
65789 }
65790
65791 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
65792         LDKInvoiceError ret_var = InvoiceError_clone(arg);
65793         int64_t ret_ref = 0;
65794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65796         return ret_ref;
65797 }
65798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65799         LDKInvoiceError arg_conv;
65800         arg_conv.inner = untag_ptr(arg);
65801         arg_conv.is_owned = ptr_is_owned(arg);
65802         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65803         arg_conv.is_owned = false;
65804         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
65805         return ret_conv;
65806 }
65807
65808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65809         LDKInvoiceError orig_conv;
65810         orig_conv.inner = untag_ptr(orig);
65811         orig_conv.is_owned = ptr_is_owned(orig);
65812         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65813         orig_conv.is_owned = false;
65814         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
65815         int64_t ret_ref = 0;
65816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65818         return ret_ref;
65819 }
65820
65821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65822         LDKErroneousField this_obj_conv;
65823         this_obj_conv.inner = untag_ptr(this_obj);
65824         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65826         ErroneousField_free(this_obj_conv);
65827 }
65828
65829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1get_1tlv_1fieldnum(JNIEnv *env, jclass clz, int64_t this_ptr) {
65830         LDKErroneousField this_ptr_conv;
65831         this_ptr_conv.inner = untag_ptr(this_ptr);
65832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65834         this_ptr_conv.is_owned = false;
65835         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
65836         return ret_conv;
65837 }
65838
65839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1set_1tlv_1fieldnum(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65840         LDKErroneousField this_ptr_conv;
65841         this_ptr_conv.inner = untag_ptr(this_ptr);
65842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65844         this_ptr_conv.is_owned = false;
65845         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
65846 }
65847
65848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1get_1suggested_1value(JNIEnv *env, jclass clz, int64_t this_ptr) {
65849         LDKErroneousField this_ptr_conv;
65850         this_ptr_conv.inner = untag_ptr(this_ptr);
65851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65853         this_ptr_conv.is_owned = false;
65854         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
65855         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
65856         int64_t ret_ref = tag_ptr(ret_copy, true);
65857         return ret_ref;
65858 }
65859
65860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1set_1suggested_1value(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65861         LDKErroneousField this_ptr_conv;
65862         this_ptr_conv.inner = untag_ptr(this_ptr);
65863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65865         this_ptr_conv.is_owned = false;
65866         void* val_ptr = untag_ptr(val);
65867         CHECK_ACCESS(val_ptr);
65868         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
65869         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
65870         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
65871 }
65872
65873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1new(JNIEnv *env, jclass clz, int64_t tlv_fieldnum_arg, int64_t suggested_value_arg) {
65874         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
65875         CHECK_ACCESS(suggested_value_arg_ptr);
65876         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
65877         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
65878         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
65879         int64_t ret_ref = 0;
65880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65882         return ret_ref;
65883 }
65884
65885 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
65886         LDKErroneousField ret_var = ErroneousField_clone(arg);
65887         int64_t ret_ref = 0;
65888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65890         return ret_ref;
65891 }
65892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65893         LDKErroneousField arg_conv;
65894         arg_conv.inner = untag_ptr(arg);
65895         arg_conv.is_owned = ptr_is_owned(arg);
65896         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65897         arg_conv.is_owned = false;
65898         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
65899         return ret_conv;
65900 }
65901
65902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65903         LDKErroneousField orig_conv;
65904         orig_conv.inner = untag_ptr(orig);
65905         orig_conv.is_owned = ptr_is_owned(orig);
65906         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65907         orig_conv.is_owned = false;
65908         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
65909         int64_t ret_ref = 0;
65910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65912         return ret_ref;
65913 }
65914
65915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1from_1string(JNIEnv *env, jclass clz, jstring s) {
65916         LDKStr s_conv = java_to_owned_str(env, s);
65917         LDKInvoiceError ret_var = InvoiceError_from_string(s_conv);
65918         int64_t ret_ref = 0;
65919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65921         return ret_ref;
65922 }
65923
65924 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceError_1write(JNIEnv *env, jclass clz, int64_t obj) {
65925         LDKInvoiceError obj_conv;
65926         obj_conv.inner = untag_ptr(obj);
65927         obj_conv.is_owned = ptr_is_owned(obj);
65928         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65929         obj_conv.is_owned = false;
65930         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
65931         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65932         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65933         CVec_u8Z_free(ret_var);
65934         return ret_arr;
65935 }
65936
65937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
65938         LDKu8slice ser_ref;
65939         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
65940         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
65941         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
65942         *ret_conv = InvoiceError_read(ser_ref);
65943         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
65944         return tag_ptr(ret_conv, true);
65945 }
65946
65947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65948         LDKUnsignedInvoiceRequest this_obj_conv;
65949         this_obj_conv.inner = untag_ptr(this_obj);
65950         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65952         UnsignedInvoiceRequest_free(this_obj_conv);
65953 }
65954
65955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1tagged_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
65956         LDKUnsignedInvoiceRequest this_arg_conv;
65957         this_arg_conv.inner = untag_ptr(this_arg);
65958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65960         this_arg_conv.is_owned = false;
65961         LDKTaggedHash ret_var = UnsignedInvoiceRequest_tagged_hash(&this_arg_conv);
65962         int64_t ret_ref = 0;
65963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65965         return ret_ref;
65966 }
65967
65968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65969         LDKInvoiceRequest this_obj_conv;
65970         this_obj_conv.inner = untag_ptr(this_obj);
65971         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65973         InvoiceRequest_free(this_obj_conv);
65974 }
65975
65976 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
65977         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
65978         int64_t ret_ref = 0;
65979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65981         return ret_ref;
65982 }
65983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65984         LDKInvoiceRequest arg_conv;
65985         arg_conv.inner = untag_ptr(arg);
65986         arg_conv.is_owned = ptr_is_owned(arg);
65987         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65988         arg_conv.is_owned = false;
65989         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
65990         return ret_conv;
65991 }
65992
65993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65994         LDKInvoiceRequest orig_conv;
65995         orig_conv.inner = untag_ptr(orig);
65996         orig_conv.is_owned = ptr_is_owned(orig);
65997         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65998         orig_conv.is_owned = false;
65999         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
66000         int64_t ret_ref = 0;
66001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66003         return ret_ref;
66004 }
66005
66006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66007         LDKVerifiedInvoiceRequest this_obj_conv;
66008         this_obj_conv.inner = untag_ptr(this_obj);
66009         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66011         VerifiedInvoiceRequest_free(this_obj_conv);
66012 }
66013
66014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1get_1keys(JNIEnv *env, jclass clz, int64_t this_ptr) {
66015         LDKVerifiedInvoiceRequest this_ptr_conv;
66016         this_ptr_conv.inner = untag_ptr(this_ptr);
66017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66019         this_ptr_conv.is_owned = false;
66020         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
66021         *ret_copy = VerifiedInvoiceRequest_get_keys(&this_ptr_conv);
66022         int64_t ret_ref = tag_ptr(ret_copy, true);
66023         return ret_ref;
66024 }
66025
66026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1set_1keys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66027         LDKVerifiedInvoiceRequest this_ptr_conv;
66028         this_ptr_conv.inner = untag_ptr(this_ptr);
66029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66031         this_ptr_conv.is_owned = false;
66032         void* val_ptr = untag_ptr(val);
66033         CHECK_ACCESS(val_ptr);
66034         LDKCOption_SecretKeyZ val_conv = *(LDKCOption_SecretKeyZ*)(val_ptr);
66035         val_conv = COption_SecretKeyZ_clone((LDKCOption_SecretKeyZ*)untag_ptr(val));
66036         VerifiedInvoiceRequest_set_keys(&this_ptr_conv, val_conv);
66037 }
66038
66039 static inline uint64_t VerifiedInvoiceRequest_clone_ptr(LDKVerifiedInvoiceRequest *NONNULL_PTR arg) {
66040         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(arg);
66041         int64_t ret_ref = 0;
66042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66044         return ret_ref;
66045 }
66046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66047         LDKVerifiedInvoiceRequest arg_conv;
66048         arg_conv.inner = untag_ptr(arg);
66049         arg_conv.is_owned = ptr_is_owned(arg);
66050         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66051         arg_conv.is_owned = false;
66052         int64_t ret_conv = VerifiedInvoiceRequest_clone_ptr(&arg_conv);
66053         return ret_conv;
66054 }
66055
66056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66057         LDKVerifiedInvoiceRequest orig_conv;
66058         orig_conv.inner = untag_ptr(orig);
66059         orig_conv.is_owned = ptr_is_owned(orig);
66060         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66061         orig_conv.is_owned = false;
66062         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(&orig_conv);
66063         int64_t ret_ref = 0;
66064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66066         return ret_ref;
66067 }
66068
66069 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
66070         LDKUnsignedInvoiceRequest this_arg_conv;
66071         this_arg_conv.inner = untag_ptr(this_arg);
66072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66074         this_arg_conv.is_owned = false;
66075         LDKCVec_ThirtyTwoBytesZ ret_var = UnsignedInvoiceRequest_chains(&this_arg_conv);
66076         jobjectArray ret_arr = NULL;
66077         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
66078         ;
66079         for (size_t i = 0; i < ret_var.datalen; i++) {
66080                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
66081                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
66082                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
66083         }
66084         
66085         FREE(ret_var.data);
66086         return ret_arr;
66087 }
66088
66089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
66090         LDKUnsignedInvoiceRequest this_arg_conv;
66091         this_arg_conv.inner = untag_ptr(this_arg);
66092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66094         this_arg_conv.is_owned = false;
66095         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
66096         *ret_copy = UnsignedInvoiceRequest_metadata(&this_arg_conv);
66097         int64_t ret_ref = tag_ptr(ret_copy, true);
66098         return ret_ref;
66099 }
66100
66101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
66102         LDKUnsignedInvoiceRequest this_arg_conv;
66103         this_arg_conv.inner = untag_ptr(this_arg);
66104         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66106         this_arg_conv.is_owned = false;
66107         LDKAmount ret_var = UnsignedInvoiceRequest_amount(&this_arg_conv);
66108         int64_t ret_ref = 0;
66109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66111         return ret_ref;
66112 }
66113
66114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
66115         LDKUnsignedInvoiceRequest this_arg_conv;
66116         this_arg_conv.inner = untag_ptr(this_arg);
66117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66119         this_arg_conv.is_owned = false;
66120         LDKPrintableString ret_var = UnsignedInvoiceRequest_description(&this_arg_conv);
66121         int64_t ret_ref = 0;
66122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66124         return ret_ref;
66125 }
66126
66127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
66128         LDKUnsignedInvoiceRequest this_arg_conv;
66129         this_arg_conv.inner = untag_ptr(this_arg);
66130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66132         this_arg_conv.is_owned = false;
66133         LDKOfferFeatures ret_var = UnsignedInvoiceRequest_offer_features(&this_arg_conv);
66134         int64_t ret_ref = 0;
66135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66137         return ret_ref;
66138 }
66139
66140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
66141         LDKUnsignedInvoiceRequest this_arg_conv;
66142         this_arg_conv.inner = untag_ptr(this_arg);
66143         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66145         this_arg_conv.is_owned = false;
66146         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66147         *ret_copy = UnsignedInvoiceRequest_absolute_expiry(&this_arg_conv);
66148         int64_t ret_ref = tag_ptr(ret_copy, true);
66149         return ret_ref;
66150 }
66151
66152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
66153         LDKUnsignedInvoiceRequest this_arg_conv;
66154         this_arg_conv.inner = untag_ptr(this_arg);
66155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66157         this_arg_conv.is_owned = false;
66158         LDKPrintableString ret_var = UnsignedInvoiceRequest_issuer(&this_arg_conv);
66159         int64_t ret_ref = 0;
66160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66162         return ret_ref;
66163 }
66164
66165 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
66166         LDKUnsignedInvoiceRequest this_arg_conv;
66167         this_arg_conv.inner = untag_ptr(this_arg);
66168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66170         this_arg_conv.is_owned = false;
66171         LDKCVec_BlindedPathZ ret_var = UnsignedInvoiceRequest_paths(&this_arg_conv);
66172         int64_tArray ret_arr = NULL;
66173         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
66174         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
66175         for (size_t n = 0; n < ret_var.datalen; n++) {
66176                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
66177                 int64_t ret_conv_13_ref = 0;
66178                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
66179                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
66180                 ret_arr_ptr[n] = ret_conv_13_ref;
66181         }
66182         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
66183         FREE(ret_var.data);
66184         return ret_arr;
66185 }
66186
66187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
66188         LDKUnsignedInvoiceRequest this_arg_conv;
66189         this_arg_conv.inner = untag_ptr(this_arg);
66190         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66192         this_arg_conv.is_owned = false;
66193         LDKQuantity ret_var = UnsignedInvoiceRequest_supported_quantity(&this_arg_conv);
66194         int64_t ret_ref = 0;
66195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66197         return ret_ref;
66198 }
66199
66200 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
66201         LDKUnsignedInvoiceRequest this_arg_conv;
66202         this_arg_conv.inner = untag_ptr(this_arg);
66203         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66205         this_arg_conv.is_owned = false;
66206         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
66207         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
66208         return ret_arr;
66209 }
66210
66211 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
66212         LDKUnsignedInvoiceRequest this_arg_conv;
66213         this_arg_conv.inner = untag_ptr(this_arg);
66214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66216         this_arg_conv.is_owned = false;
66217         LDKu8slice ret_var = UnsignedInvoiceRequest_payer_metadata(&this_arg_conv);
66218         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66219         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66220         return ret_arr;
66221 }
66222
66223 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
66224         LDKUnsignedInvoiceRequest this_arg_conv;
66225         this_arg_conv.inner = untag_ptr(this_arg);
66226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66228         this_arg_conv.is_owned = false;
66229         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
66230         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedInvoiceRequest_chain(&this_arg_conv).data);
66231         return ret_arr;
66232 }
66233
66234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
66235         LDKUnsignedInvoiceRequest this_arg_conv;
66236         this_arg_conv.inner = untag_ptr(this_arg);
66237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66239         this_arg_conv.is_owned = false;
66240         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66241         *ret_copy = UnsignedInvoiceRequest_amount_msats(&this_arg_conv);
66242         int64_t ret_ref = tag_ptr(ret_copy, true);
66243         return ret_ref;
66244 }
66245
66246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
66247         LDKUnsignedInvoiceRequest this_arg_conv;
66248         this_arg_conv.inner = untag_ptr(this_arg);
66249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66251         this_arg_conv.is_owned = false;
66252         LDKInvoiceRequestFeatures ret_var = UnsignedInvoiceRequest_invoice_request_features(&this_arg_conv);
66253         int64_t ret_ref = 0;
66254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66256         return ret_ref;
66257 }
66258
66259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
66260         LDKUnsignedInvoiceRequest this_arg_conv;
66261         this_arg_conv.inner = untag_ptr(this_arg);
66262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66264         this_arg_conv.is_owned = false;
66265         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66266         *ret_copy = UnsignedInvoiceRequest_quantity(&this_arg_conv);
66267         int64_t ret_ref = tag_ptr(ret_copy, true);
66268         return ret_ref;
66269 }
66270
66271 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
66272         LDKUnsignedInvoiceRequest this_arg_conv;
66273         this_arg_conv.inner = untag_ptr(this_arg);
66274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66276         this_arg_conv.is_owned = false;
66277         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
66278         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedInvoiceRequest_payer_id(&this_arg_conv).compressed_form);
66279         return ret_arr;
66280 }
66281
66282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
66283         LDKUnsignedInvoiceRequest this_arg_conv;
66284         this_arg_conv.inner = untag_ptr(this_arg);
66285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66287         this_arg_conv.is_owned = false;
66288         LDKPrintableString ret_var = UnsignedInvoiceRequest_payer_note(&this_arg_conv);
66289         int64_t ret_ref = 0;
66290         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66291         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66292         return ret_ref;
66293 }
66294
66295 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
66296         LDKInvoiceRequest this_arg_conv;
66297         this_arg_conv.inner = untag_ptr(this_arg);
66298         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66300         this_arg_conv.is_owned = false;
66301         LDKCVec_ThirtyTwoBytesZ ret_var = InvoiceRequest_chains(&this_arg_conv);
66302         jobjectArray ret_arr = NULL;
66303         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
66304         ;
66305         for (size_t i = 0; i < ret_var.datalen; i++) {
66306                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
66307                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
66308                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
66309         }
66310         
66311         FREE(ret_var.data);
66312         return ret_arr;
66313 }
66314
66315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
66316         LDKInvoiceRequest this_arg_conv;
66317         this_arg_conv.inner = untag_ptr(this_arg);
66318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66320         this_arg_conv.is_owned = false;
66321         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
66322         *ret_copy = InvoiceRequest_metadata(&this_arg_conv);
66323         int64_t ret_ref = tag_ptr(ret_copy, true);
66324         return ret_ref;
66325 }
66326
66327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
66328         LDKInvoiceRequest this_arg_conv;
66329         this_arg_conv.inner = untag_ptr(this_arg);
66330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66332         this_arg_conv.is_owned = false;
66333         LDKAmount ret_var = InvoiceRequest_amount(&this_arg_conv);
66334         int64_t ret_ref = 0;
66335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66337         return ret_ref;
66338 }
66339
66340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
66341         LDKInvoiceRequest this_arg_conv;
66342         this_arg_conv.inner = untag_ptr(this_arg);
66343         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66345         this_arg_conv.is_owned = false;
66346         LDKPrintableString ret_var = InvoiceRequest_description(&this_arg_conv);
66347         int64_t ret_ref = 0;
66348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66350         return ret_ref;
66351 }
66352
66353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
66354         LDKInvoiceRequest this_arg_conv;
66355         this_arg_conv.inner = untag_ptr(this_arg);
66356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66358         this_arg_conv.is_owned = false;
66359         LDKOfferFeatures ret_var = InvoiceRequest_offer_features(&this_arg_conv);
66360         int64_t ret_ref = 0;
66361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66363         return ret_ref;
66364 }
66365
66366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
66367         LDKInvoiceRequest this_arg_conv;
66368         this_arg_conv.inner = untag_ptr(this_arg);
66369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66371         this_arg_conv.is_owned = false;
66372         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66373         *ret_copy = InvoiceRequest_absolute_expiry(&this_arg_conv);
66374         int64_t ret_ref = tag_ptr(ret_copy, true);
66375         return ret_ref;
66376 }
66377
66378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
66379         LDKInvoiceRequest this_arg_conv;
66380         this_arg_conv.inner = untag_ptr(this_arg);
66381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66383         this_arg_conv.is_owned = false;
66384         LDKPrintableString ret_var = InvoiceRequest_issuer(&this_arg_conv);
66385         int64_t ret_ref = 0;
66386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66388         return ret_ref;
66389 }
66390
66391 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
66392         LDKInvoiceRequest this_arg_conv;
66393         this_arg_conv.inner = untag_ptr(this_arg);
66394         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66396         this_arg_conv.is_owned = false;
66397         LDKCVec_BlindedPathZ ret_var = InvoiceRequest_paths(&this_arg_conv);
66398         int64_tArray ret_arr = NULL;
66399         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
66400         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
66401         for (size_t n = 0; n < ret_var.datalen; n++) {
66402                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
66403                 int64_t ret_conv_13_ref = 0;
66404                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
66405                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
66406                 ret_arr_ptr[n] = ret_conv_13_ref;
66407         }
66408         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
66409         FREE(ret_var.data);
66410         return ret_arr;
66411 }
66412
66413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
66414         LDKInvoiceRequest this_arg_conv;
66415         this_arg_conv.inner = untag_ptr(this_arg);
66416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66418         this_arg_conv.is_owned = false;
66419         LDKQuantity ret_var = InvoiceRequest_supported_quantity(&this_arg_conv);
66420         int64_t ret_ref = 0;
66421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66423         return ret_ref;
66424 }
66425
66426 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
66427         LDKInvoiceRequest this_arg_conv;
66428         this_arg_conv.inner = untag_ptr(this_arg);
66429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66431         this_arg_conv.is_owned = false;
66432         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
66433         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, InvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
66434         return ret_arr;
66435 }
66436
66437 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
66438         LDKInvoiceRequest this_arg_conv;
66439         this_arg_conv.inner = untag_ptr(this_arg);
66440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66442         this_arg_conv.is_owned = false;
66443         LDKu8slice ret_var = InvoiceRequest_payer_metadata(&this_arg_conv);
66444         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66445         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66446         return ret_arr;
66447 }
66448
66449 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
66450         LDKInvoiceRequest this_arg_conv;
66451         this_arg_conv.inner = untag_ptr(this_arg);
66452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66454         this_arg_conv.is_owned = false;
66455         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
66456         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, InvoiceRequest_chain(&this_arg_conv).data);
66457         return ret_arr;
66458 }
66459
66460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
66461         LDKInvoiceRequest this_arg_conv;
66462         this_arg_conv.inner = untag_ptr(this_arg);
66463         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66465         this_arg_conv.is_owned = false;
66466         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66467         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
66468         int64_t ret_ref = tag_ptr(ret_copy, true);
66469         return ret_ref;
66470 }
66471
66472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
66473         LDKInvoiceRequest this_arg_conv;
66474         this_arg_conv.inner = untag_ptr(this_arg);
66475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66477         this_arg_conv.is_owned = false;
66478         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_invoice_request_features(&this_arg_conv);
66479         int64_t ret_ref = 0;
66480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66482         return ret_ref;
66483 }
66484
66485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
66486         LDKInvoiceRequest this_arg_conv;
66487         this_arg_conv.inner = untag_ptr(this_arg);
66488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66490         this_arg_conv.is_owned = false;
66491         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66492         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
66493         int64_t ret_ref = tag_ptr(ret_copy, true);
66494         return ret_ref;
66495 }
66496
66497 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
66498         LDKInvoiceRequest this_arg_conv;
66499         this_arg_conv.inner = untag_ptr(this_arg);
66500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66502         this_arg_conv.is_owned = false;
66503         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
66504         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, InvoiceRequest_payer_id(&this_arg_conv).compressed_form);
66505         return ret_arr;
66506 }
66507
66508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
66509         LDKInvoiceRequest this_arg_conv;
66510         this_arg_conv.inner = untag_ptr(this_arg);
66511         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66513         this_arg_conv.is_owned = false;
66514         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
66515         int64_t ret_ref = 0;
66516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66518         return ret_ref;
66519 }
66520
66521 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
66522         LDKInvoiceRequest this_arg_conv;
66523         this_arg_conv.inner = untag_ptr(this_arg);
66524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66526         this_arg_conv.is_owned = false;
66527         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
66528         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, InvoiceRequest_signature(&this_arg_conv).compact_form);
66529         return ret_arr;
66530 }
66531
66532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t key) {
66533         LDKInvoiceRequest this_arg_conv;
66534         this_arg_conv.inner = untag_ptr(this_arg);
66535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66537         this_arg_conv = InvoiceRequest_clone(&this_arg_conv);
66538         LDKExpandedKey key_conv;
66539         key_conv.inner = untag_ptr(key);
66540         key_conv.is_owned = ptr_is_owned(key);
66541         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
66542         key_conv.is_owned = false;
66543         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
66544         *ret_conv = InvoiceRequest_verify(this_arg_conv, &key_conv);
66545         return tag_ptr(ret_conv, true);
66546 }
66547
66548 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
66549         LDKVerifiedInvoiceRequest this_arg_conv;
66550         this_arg_conv.inner = untag_ptr(this_arg);
66551         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66553         this_arg_conv.is_owned = false;
66554         LDKCVec_ThirtyTwoBytesZ ret_var = VerifiedInvoiceRequest_chains(&this_arg_conv);
66555         jobjectArray ret_arr = NULL;
66556         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
66557         ;
66558         for (size_t i = 0; i < ret_var.datalen; i++) {
66559                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
66560                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
66561                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
66562         }
66563         
66564         FREE(ret_var.data);
66565         return ret_arr;
66566 }
66567
66568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
66569         LDKVerifiedInvoiceRequest this_arg_conv;
66570         this_arg_conv.inner = untag_ptr(this_arg);
66571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66573         this_arg_conv.is_owned = false;
66574         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
66575         *ret_copy = VerifiedInvoiceRequest_metadata(&this_arg_conv);
66576         int64_t ret_ref = tag_ptr(ret_copy, true);
66577         return ret_ref;
66578 }
66579
66580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
66581         LDKVerifiedInvoiceRequest this_arg_conv;
66582         this_arg_conv.inner = untag_ptr(this_arg);
66583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66585         this_arg_conv.is_owned = false;
66586         LDKAmount ret_var = VerifiedInvoiceRequest_amount(&this_arg_conv);
66587         int64_t ret_ref = 0;
66588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66590         return ret_ref;
66591 }
66592
66593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
66594         LDKVerifiedInvoiceRequest this_arg_conv;
66595         this_arg_conv.inner = untag_ptr(this_arg);
66596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66598         this_arg_conv.is_owned = false;
66599         LDKPrintableString ret_var = VerifiedInvoiceRequest_description(&this_arg_conv);
66600         int64_t ret_ref = 0;
66601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66603         return ret_ref;
66604 }
66605
66606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
66607         LDKVerifiedInvoiceRequest this_arg_conv;
66608         this_arg_conv.inner = untag_ptr(this_arg);
66609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66611         this_arg_conv.is_owned = false;
66612         LDKOfferFeatures ret_var = VerifiedInvoiceRequest_offer_features(&this_arg_conv);
66613         int64_t ret_ref = 0;
66614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66616         return ret_ref;
66617 }
66618
66619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
66620         LDKVerifiedInvoiceRequest this_arg_conv;
66621         this_arg_conv.inner = untag_ptr(this_arg);
66622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66624         this_arg_conv.is_owned = false;
66625         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66626         *ret_copy = VerifiedInvoiceRequest_absolute_expiry(&this_arg_conv);
66627         int64_t ret_ref = tag_ptr(ret_copy, true);
66628         return ret_ref;
66629 }
66630
66631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
66632         LDKVerifiedInvoiceRequest this_arg_conv;
66633         this_arg_conv.inner = untag_ptr(this_arg);
66634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66636         this_arg_conv.is_owned = false;
66637         LDKPrintableString ret_var = VerifiedInvoiceRequest_issuer(&this_arg_conv);
66638         int64_t ret_ref = 0;
66639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66641         return ret_ref;
66642 }
66643
66644 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
66645         LDKVerifiedInvoiceRequest this_arg_conv;
66646         this_arg_conv.inner = untag_ptr(this_arg);
66647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66649         this_arg_conv.is_owned = false;
66650         LDKCVec_BlindedPathZ ret_var = VerifiedInvoiceRequest_paths(&this_arg_conv);
66651         int64_tArray ret_arr = NULL;
66652         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
66653         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
66654         for (size_t n = 0; n < ret_var.datalen; n++) {
66655                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
66656                 int64_t ret_conv_13_ref = 0;
66657                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
66658                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
66659                 ret_arr_ptr[n] = ret_conv_13_ref;
66660         }
66661         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
66662         FREE(ret_var.data);
66663         return ret_arr;
66664 }
66665
66666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
66667         LDKVerifiedInvoiceRequest this_arg_conv;
66668         this_arg_conv.inner = untag_ptr(this_arg);
66669         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66671         this_arg_conv.is_owned = false;
66672         LDKQuantity ret_var = VerifiedInvoiceRequest_supported_quantity(&this_arg_conv);
66673         int64_t ret_ref = 0;
66674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66676         return ret_ref;
66677 }
66678
66679 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
66680         LDKVerifiedInvoiceRequest this_arg_conv;
66681         this_arg_conv.inner = untag_ptr(this_arg);
66682         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66684         this_arg_conv.is_owned = false;
66685         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
66686         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, VerifiedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
66687         return ret_arr;
66688 }
66689
66690 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
66691         LDKVerifiedInvoiceRequest this_arg_conv;
66692         this_arg_conv.inner = untag_ptr(this_arg);
66693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66695         this_arg_conv.is_owned = false;
66696         LDKu8slice ret_var = VerifiedInvoiceRequest_payer_metadata(&this_arg_conv);
66697         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66698         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66699         return ret_arr;
66700 }
66701
66702 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
66703         LDKVerifiedInvoiceRequest this_arg_conv;
66704         this_arg_conv.inner = untag_ptr(this_arg);
66705         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66707         this_arg_conv.is_owned = false;
66708         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
66709         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, VerifiedInvoiceRequest_chain(&this_arg_conv).data);
66710         return ret_arr;
66711 }
66712
66713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
66714         LDKVerifiedInvoiceRequest this_arg_conv;
66715         this_arg_conv.inner = untag_ptr(this_arg);
66716         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66718         this_arg_conv.is_owned = false;
66719         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66720         *ret_copy = VerifiedInvoiceRequest_amount_msats(&this_arg_conv);
66721         int64_t ret_ref = tag_ptr(ret_copy, true);
66722         return ret_ref;
66723 }
66724
66725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
66726         LDKVerifiedInvoiceRequest this_arg_conv;
66727         this_arg_conv.inner = untag_ptr(this_arg);
66728         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66730         this_arg_conv.is_owned = false;
66731         LDKInvoiceRequestFeatures ret_var = VerifiedInvoiceRequest_invoice_request_features(&this_arg_conv);
66732         int64_t ret_ref = 0;
66733         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66734         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66735         return ret_ref;
66736 }
66737
66738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
66739         LDKVerifiedInvoiceRequest this_arg_conv;
66740         this_arg_conv.inner = untag_ptr(this_arg);
66741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66743         this_arg_conv.is_owned = false;
66744         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66745         *ret_copy = VerifiedInvoiceRequest_quantity(&this_arg_conv);
66746         int64_t ret_ref = tag_ptr(ret_copy, true);
66747         return ret_ref;
66748 }
66749
66750 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
66751         LDKVerifiedInvoiceRequest this_arg_conv;
66752         this_arg_conv.inner = untag_ptr(this_arg);
66753         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66755         this_arg_conv.is_owned = false;
66756         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
66757         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, VerifiedInvoiceRequest_payer_id(&this_arg_conv).compressed_form);
66758         return ret_arr;
66759 }
66760
66761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
66762         LDKVerifiedInvoiceRequest this_arg_conv;
66763         this_arg_conv.inner = untag_ptr(this_arg);
66764         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66766         this_arg_conv.is_owned = false;
66767         LDKPrintableString ret_var = VerifiedInvoiceRequest_payer_note(&this_arg_conv);
66768         int64_t ret_ref = 0;
66769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66771         return ret_ref;
66772 }
66773
66774 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1write(JNIEnv *env, jclass clz, int64_t obj) {
66775         LDKUnsignedInvoiceRequest obj_conv;
66776         obj_conv.inner = untag_ptr(obj);
66777         obj_conv.is_owned = ptr_is_owned(obj);
66778         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66779         obj_conv.is_owned = false;
66780         LDKCVec_u8Z ret_var = UnsignedInvoiceRequest_write(&obj_conv);
66781         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66782         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66783         CVec_u8Z_free(ret_var);
66784         return ret_arr;
66785 }
66786
66787 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1write(JNIEnv *env, jclass clz, int64_t obj) {
66788         LDKInvoiceRequest obj_conv;
66789         obj_conv.inner = untag_ptr(obj);
66790         obj_conv.is_owned = ptr_is_owned(obj);
66791         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66792         obj_conv.is_owned = false;
66793         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
66794         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66795         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66796         CVec_u8Z_free(ret_var);
66797         return ret_arr;
66798 }
66799
66800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TaggedHash_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66801         LDKTaggedHash this_obj_conv;
66802         this_obj_conv.inner = untag_ptr(this_obj);
66803         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66805         TaggedHash_free(this_obj_conv);
66806 }
66807
66808 static inline uint64_t TaggedHash_clone_ptr(LDKTaggedHash *NONNULL_PTR arg) {
66809         LDKTaggedHash ret_var = TaggedHash_clone(arg);
66810         int64_t ret_ref = 0;
66811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66813         return ret_ref;
66814 }
66815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TaggedHash_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66816         LDKTaggedHash arg_conv;
66817         arg_conv.inner = untag_ptr(arg);
66818         arg_conv.is_owned = ptr_is_owned(arg);
66819         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66820         arg_conv.is_owned = false;
66821         int64_t ret_conv = TaggedHash_clone_ptr(&arg_conv);
66822         return ret_conv;
66823 }
66824
66825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TaggedHash_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66826         LDKTaggedHash orig_conv;
66827         orig_conv.inner = untag_ptr(orig);
66828         orig_conv.is_owned = ptr_is_owned(orig);
66829         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66830         orig_conv.is_owned = false;
66831         LDKTaggedHash ret_var = TaggedHash_clone(&orig_conv);
66832         int64_t ret_ref = 0;
66833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66835         return ret_ref;
66836 }
66837
66838 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TaggedHash_1as_1digest(JNIEnv *env, jclass clz, int64_t this_arg) {
66839         LDKTaggedHash this_arg_conv;
66840         this_arg_conv.inner = untag_ptr(this_arg);
66841         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66843         this_arg_conv.is_owned = false;
66844         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
66845         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TaggedHash_as_digest(&this_arg_conv));
66846         return ret_arr;
66847 }
66848
66849 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_TaggedHash_1tag(JNIEnv *env, jclass clz, int64_t this_arg) {
66850         LDKTaggedHash this_arg_conv;
66851         this_arg_conv.inner = untag_ptr(this_arg);
66852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66854         this_arg_conv.is_owned = false;
66855         LDKStr ret_str = TaggedHash_tag(&this_arg_conv);
66856         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
66857         Str_free(ret_str);
66858         return ret_conv;
66859 }
66860
66861 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TaggedHash_1merkle_1root(JNIEnv *env, jclass clz, int64_t this_arg) {
66862         LDKTaggedHash this_arg_conv;
66863         this_arg_conv.inner = untag_ptr(this_arg);
66864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66866         this_arg_conv.is_owned = false;
66867         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
66868         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TaggedHash_merkle_root(&this_arg_conv).data);
66869         return ret_arr;
66870 }
66871
66872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66873         LDKBolt12ParseError this_obj_conv;
66874         this_obj_conv.inner = untag_ptr(this_obj);
66875         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66877         Bolt12ParseError_free(this_obj_conv);
66878 }
66879
66880 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
66881         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
66882         int64_t ret_ref = 0;
66883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66885         return ret_ref;
66886 }
66887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66888         LDKBolt12ParseError arg_conv;
66889         arg_conv.inner = untag_ptr(arg);
66890         arg_conv.is_owned = ptr_is_owned(arg);
66891         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66892         arg_conv.is_owned = false;
66893         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
66894         return ret_conv;
66895 }
66896
66897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66898         LDKBolt12ParseError orig_conv;
66899         orig_conv.inner = untag_ptr(orig);
66900         orig_conv.is_owned = ptr_is_owned(orig);
66901         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66902         orig_conv.is_owned = false;
66903         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
66904         int64_t ret_ref = 0;
66905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66907         return ret_ref;
66908 }
66909
66910 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66911         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
66912         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_clone(orig_conv));
66913         return ret_conv;
66914 }
66915
66916 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1already_1expired(JNIEnv *env, jclass clz) {
66917         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_already_expired());
66918         return ret_conv;
66919 }
66920
66921 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unsupported_1chain(JNIEnv *env, jclass clz) {
66922         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unsupported_chain());
66923         return ret_conv;
66924 }
66925
66926 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1chain(JNIEnv *env, jclass clz) {
66927         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_chain());
66928         return ret_conv;
66929 }
66930
66931 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1amount(JNIEnv *env, jclass clz) {
66932         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_amount());
66933         return ret_conv;
66934 }
66935
66936 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1amount(JNIEnv *env, jclass clz) {
66937         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_amount());
66938         return ret_conv;
66939 }
66940
66941 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1insufficient_1amount(JNIEnv *env, jclass clz) {
66942         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_insufficient_amount());
66943         return ret_conv;
66944 }
66945
66946 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1amount(JNIEnv *env, jclass clz) {
66947         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_amount());
66948         return ret_conv;
66949 }
66950
66951 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unsupported_1currency(JNIEnv *env, jclass clz) {
66952         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unsupported_currency());
66953         return ret_conv;
66954 }
66955
66956 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unknown_1required_1features(JNIEnv *env, jclass clz) {
66957         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unknown_required_features());
66958         return ret_conv;
66959 }
66960
66961 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1features(JNIEnv *env, jclass clz) {
66962         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_features());
66963         return ret_conv;
66964 }
66965
66966 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1description(JNIEnv *env, jclass clz) {
66967         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_description());
66968         return ret_conv;
66969 }
66970
66971 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1signing_1pubkey(JNIEnv *env, jclass clz) {
66972         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_signing_pubkey());
66973         return ret_conv;
66974 }
66975
66976 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1signing_1pubkey(JNIEnv *env, jclass clz) {
66977         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_signing_pubkey());
66978         return ret_conv;
66979 }
66980
66981 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1signing_1pubkey(JNIEnv *env, jclass clz) {
66982         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_signing_pubkey());
66983         return ret_conv;
66984 }
66985
66986 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1quantity(JNIEnv *env, jclass clz) {
66987         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_quantity());
66988         return ret_conv;
66989 }
66990
66991 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1quantity(JNIEnv *env, jclass clz) {
66992         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_quantity());
66993         return ret_conv;
66994 }
66995
66996 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1quantity(JNIEnv *env, jclass clz) {
66997         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_quantity());
66998         return ret_conv;
66999 }
67000
67001 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1metadata(JNIEnv *env, jclass clz) {
67002         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_metadata());
67003         return ret_conv;
67004 }
67005
67006 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1metadata(JNIEnv *env, jclass clz) {
67007         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_metadata());
67008         return ret_conv;
67009 }
67010
67011 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payer_1metadata(JNIEnv *env, jclass clz) {
67012         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payer_metadata());
67013         return ret_conv;
67014 }
67015
67016 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payer_1id(JNIEnv *env, jclass clz) {
67017         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payer_id());
67018         return ret_conv;
67019 }
67020
67021 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1duplicate_1payment_1id(JNIEnv *env, jclass clz) {
67022         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_duplicate_payment_id());
67023         return ret_conv;
67024 }
67025
67026 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1paths(JNIEnv *env, jclass clz) {
67027         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_paths());
67028         return ret_conv;
67029 }
67030
67031 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1pay_1info(JNIEnv *env, jclass clz) {
67032         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_pay_info());
67033         return ret_conv;
67034 }
67035
67036 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1creation_1time(JNIEnv *env, jclass clz) {
67037         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_creation_time());
67038         return ret_conv;
67039 }
67040
67041 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payment_1hash(JNIEnv *env, jclass clz) {
67042         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payment_hash());
67043         return ret_conv;
67044 }
67045
67046 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1signature(JNIEnv *env, jclass clz) {
67047         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_signature());
67048         return ret_conv;
67049 }
67050
67051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Refund_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67052         LDKRefund this_obj_conv;
67053         this_obj_conv.inner = untag_ptr(this_obj);
67054         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67056         Refund_free(this_obj_conv);
67057 }
67058
67059 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
67060         LDKRefund ret_var = Refund_clone(arg);
67061         int64_t ret_ref = 0;
67062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67064         return ret_ref;
67065 }
67066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67067         LDKRefund arg_conv;
67068         arg_conv.inner = untag_ptr(arg);
67069         arg_conv.is_owned = ptr_is_owned(arg);
67070         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67071         arg_conv.is_owned = false;
67072         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
67073         return ret_conv;
67074 }
67075
67076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67077         LDKRefund orig_conv;
67078         orig_conv.inner = untag_ptr(orig);
67079         orig_conv.is_owned = ptr_is_owned(orig);
67080         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67081         orig_conv.is_owned = false;
67082         LDKRefund ret_var = Refund_clone(&orig_conv);
67083         int64_t ret_ref = 0;
67084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67086         return ret_ref;
67087 }
67088
67089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
67090         LDKRefund this_arg_conv;
67091         this_arg_conv.inner = untag_ptr(this_arg);
67092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67094         this_arg_conv.is_owned = false;
67095         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
67096         int64_t ret_ref = 0;
67097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67099         return ret_ref;
67100 }
67101
67102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
67103         LDKRefund this_arg_conv;
67104         this_arg_conv.inner = untag_ptr(this_arg);
67105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67107         this_arg_conv.is_owned = false;
67108         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67109         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
67110         int64_t ret_ref = tag_ptr(ret_copy, true);
67111         return ret_ref;
67112 }
67113
67114 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Refund_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
67115         LDKRefund this_arg_conv;
67116         this_arg_conv.inner = untag_ptr(this_arg);
67117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67119         this_arg_conv.is_owned = false;
67120         jboolean ret_conv = Refund_is_expired(&this_arg_conv);
67121         return ret_conv;
67122 }
67123
67124 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Refund_1is_1expired_1no_1std(JNIEnv *env, jclass clz, int64_t this_arg, int64_t duration_since_epoch) {
67125         LDKRefund this_arg_conv;
67126         this_arg_conv.inner = untag_ptr(this_arg);
67127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67129         this_arg_conv.is_owned = false;
67130         jboolean ret_conv = Refund_is_expired_no_std(&this_arg_conv, duration_since_epoch);
67131         return ret_conv;
67132 }
67133
67134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
67135         LDKRefund this_arg_conv;
67136         this_arg_conv.inner = untag_ptr(this_arg);
67137         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67139         this_arg_conv.is_owned = false;
67140         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
67141         int64_t ret_ref = 0;
67142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67144         return ret_ref;
67145 }
67146
67147 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
67148         LDKRefund this_arg_conv;
67149         this_arg_conv.inner = untag_ptr(this_arg);
67150         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67152         this_arg_conv.is_owned = false;
67153         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
67154         int64_tArray ret_arr = NULL;
67155         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
67156         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
67157         for (size_t n = 0; n < ret_var.datalen; n++) {
67158                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
67159                 int64_t ret_conv_13_ref = 0;
67160                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
67161                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
67162                 ret_arr_ptr[n] = ret_conv_13_ref;
67163         }
67164         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
67165         FREE(ret_var.data);
67166         return ret_arr;
67167 }
67168
67169 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
67170         LDKRefund this_arg_conv;
67171         this_arg_conv.inner = untag_ptr(this_arg);
67172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67174         this_arg_conv.is_owned = false;
67175         LDKu8slice ret_var = Refund_payer_metadata(&this_arg_conv);
67176         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67177         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67178         return ret_arr;
67179 }
67180
67181 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
67182         LDKRefund this_arg_conv;
67183         this_arg_conv.inner = untag_ptr(this_arg);
67184         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67186         this_arg_conv.is_owned = false;
67187         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67188         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Refund_chain(&this_arg_conv).data);
67189         return ret_arr;
67190 }
67191
67192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
67193         LDKRefund this_arg_conv;
67194         this_arg_conv.inner = untag_ptr(this_arg);
67195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67197         this_arg_conv.is_owned = false;
67198         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
67199         return ret_conv;
67200 }
67201
67202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
67203         LDKRefund this_arg_conv;
67204         this_arg_conv.inner = untag_ptr(this_arg);
67205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67207         this_arg_conv.is_owned = false;
67208         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
67209         int64_t ret_ref = 0;
67210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67212         return ret_ref;
67213 }
67214
67215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
67216         LDKRefund this_arg_conv;
67217         this_arg_conv.inner = untag_ptr(this_arg);
67218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67220         this_arg_conv.is_owned = false;
67221         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67222         *ret_copy = Refund_quantity(&this_arg_conv);
67223         int64_t ret_ref = tag_ptr(ret_copy, true);
67224         return ret_ref;
67225 }
67226
67227 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
67228         LDKRefund this_arg_conv;
67229         this_arg_conv.inner = untag_ptr(this_arg);
67230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67232         this_arg_conv.is_owned = false;
67233         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
67234         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Refund_payer_id(&this_arg_conv).compressed_form);
67235         return ret_arr;
67236 }
67237
67238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
67239         LDKRefund this_arg_conv;
67240         this_arg_conv.inner = untag_ptr(this_arg);
67241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67243         this_arg_conv.is_owned = false;
67244         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
67245         int64_t ret_ref = 0;
67246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67248         return ret_ref;
67249 }
67250
67251 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1write(JNIEnv *env, jclass clz, int64_t obj) {
67252         LDKRefund obj_conv;
67253         obj_conv.inner = untag_ptr(obj);
67254         obj_conv.is_owned = ptr_is_owned(obj);
67255         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67256         obj_conv.is_owned = false;
67257         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
67258         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67259         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67260         CVec_u8Z_free(ret_var);
67261         return ret_arr;
67262 }
67263
67264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1from_1str(JNIEnv *env, jclass clz, jstring s) {
67265         LDKStr s_conv = java_to_owned_str(env, s);
67266         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
67267         *ret_conv = Refund_from_str(s_conv);
67268         return tag_ptr(ret_conv, true);
67269 }
67270
67271 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67272         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
67273         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_clone(orig_conv));
67274         return ret_conv;
67275 }
67276
67277 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1chain(JNIEnv *env, jclass clz) {
67278         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_chain());
67279         return ret_conv;
67280 }
67281
67282 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1tx(JNIEnv *env, jclass clz) {
67283         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_tx());
67284         return ret_conv;
67285 }
67286
67287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoResult_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67288         if (!ptr_is_owned(this_ptr)) return;
67289         void* this_ptr_ptr = untag_ptr(this_ptr);
67290         CHECK_ACCESS(this_ptr_ptr);
67291         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
67292         FREE(untag_ptr(this_ptr));
67293         UtxoResult_free(this_ptr_conv);
67294 }
67295
67296 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
67297         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
67298         *ret_copy = UtxoResult_clone(arg);
67299         int64_t ret_ref = tag_ptr(ret_copy, true);
67300         return ret_ref;
67301 }
67302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67303         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
67304         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
67305         return ret_conv;
67306 }
67307
67308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67309         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
67310         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
67311         *ret_copy = UtxoResult_clone(orig_conv);
67312         int64_t ret_ref = tag_ptr(ret_copy, true);
67313         return ret_ref;
67314 }
67315
67316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1sync(JNIEnv *env, jclass clz, int64_t a) {
67317         void* a_ptr = untag_ptr(a);
67318         CHECK_ACCESS(a_ptr);
67319         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
67320         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
67321         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
67322         *ret_copy = UtxoResult_sync(a_conv);
67323         int64_t ret_ref = tag_ptr(ret_copy, true);
67324         return ret_ref;
67325 }
67326
67327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1async(JNIEnv *env, jclass clz, int64_t a) {
67328         LDKUtxoFuture a_conv;
67329         a_conv.inner = untag_ptr(a);
67330         a_conv.is_owned = ptr_is_owned(a);
67331         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67332         a_conv = UtxoFuture_clone(&a_conv);
67333         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
67334         *ret_copy = UtxoResult_async(a_conv);
67335         int64_t ret_ref = tag_ptr(ret_copy, true);
67336         return ret_ref;
67337 }
67338
67339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67340         if (!ptr_is_owned(this_ptr)) return;
67341         void* this_ptr_ptr = untag_ptr(this_ptr);
67342         CHECK_ACCESS(this_ptr_ptr);
67343         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
67344         FREE(untag_ptr(this_ptr));
67345         UtxoLookup_free(this_ptr_conv);
67346 }
67347
67348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67349         LDKUtxoFuture this_obj_conv;
67350         this_obj_conv.inner = untag_ptr(this_obj);
67351         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67353         UtxoFuture_free(this_obj_conv);
67354 }
67355
67356 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
67357         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
67358         int64_t ret_ref = 0;
67359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67361         return ret_ref;
67362 }
67363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67364         LDKUtxoFuture arg_conv;
67365         arg_conv.inner = untag_ptr(arg);
67366         arg_conv.is_owned = ptr_is_owned(arg);
67367         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67368         arg_conv.is_owned = false;
67369         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
67370         return ret_conv;
67371 }
67372
67373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67374         LDKUtxoFuture orig_conv;
67375         orig_conv.inner = untag_ptr(orig);
67376         orig_conv.is_owned = ptr_is_owned(orig);
67377         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67378         orig_conv.is_owned = false;
67379         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
67380         int64_t ret_ref = 0;
67381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67383         return ret_ref;
67384 }
67385
67386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1new(JNIEnv *env, jclass clz) {
67387         LDKUtxoFuture ret_var = UtxoFuture_new();
67388         int64_t ret_ref = 0;
67389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67391         return ret_ref;
67392 }
67393
67394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1resolve_1without_1forwarding(JNIEnv *env, jclass clz, int64_t this_arg, int64_t graph, int64_t result) {
67395         LDKUtxoFuture this_arg_conv;
67396         this_arg_conv.inner = untag_ptr(this_arg);
67397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67399         this_arg_conv.is_owned = false;
67400         LDKNetworkGraph graph_conv;
67401         graph_conv.inner = untag_ptr(graph);
67402         graph_conv.is_owned = ptr_is_owned(graph);
67403         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
67404         graph_conv.is_owned = false;
67405         void* result_ptr = untag_ptr(result);
67406         CHECK_ACCESS(result_ptr);
67407         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
67408         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
67409 }
67410
67411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1resolve(JNIEnv *env, jclass clz, int64_t this_arg, int64_t graph, int64_t gossip, int64_t result) {
67412         LDKUtxoFuture this_arg_conv;
67413         this_arg_conv.inner = untag_ptr(this_arg);
67414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67416         this_arg_conv.is_owned = false;
67417         LDKNetworkGraph graph_conv;
67418         graph_conv.inner = untag_ptr(graph);
67419         graph_conv.is_owned = ptr_is_owned(graph);
67420         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
67421         graph_conv.is_owned = false;
67422         LDKP2PGossipSync gossip_conv;
67423         gossip_conv.inner = untag_ptr(gossip);
67424         gossip_conv.is_owned = ptr_is_owned(gossip);
67425         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
67426         gossip_conv.is_owned = false;
67427         void* result_ptr = untag_ptr(result);
67428         CHECK_ACCESS(result_ptr);
67429         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
67430         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
67431 }
67432
67433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67434         LDKNodeId this_obj_conv;
67435         this_obj_conv.inner = untag_ptr(this_obj);
67436         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67438         NodeId_free(this_obj_conv);
67439 }
67440
67441 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
67442         LDKNodeId ret_var = NodeId_clone(arg);
67443         int64_t ret_ref = 0;
67444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67446         return ret_ref;
67447 }
67448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67449         LDKNodeId arg_conv;
67450         arg_conv.inner = untag_ptr(arg);
67451         arg_conv.is_owned = ptr_is_owned(arg);
67452         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67453         arg_conv.is_owned = false;
67454         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
67455         return ret_conv;
67456 }
67457
67458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67459         LDKNodeId orig_conv;
67460         orig_conv.inner = untag_ptr(orig);
67461         orig_conv.is_owned = ptr_is_owned(orig);
67462         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67463         orig_conv.is_owned = false;
67464         LDKNodeId ret_var = NodeId_clone(&orig_conv);
67465         int64_t ret_ref = 0;
67466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67468         return ret_ref;
67469 }
67470
67471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
67472         LDKPublicKey pubkey_ref;
67473         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
67474         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
67475         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
67476         int64_t ret_ref = 0;
67477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67479         return ret_ref;
67480 }
67481
67482 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
67483         LDKNodeId this_arg_conv;
67484         this_arg_conv.inner = untag_ptr(this_arg);
67485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67487         this_arg_conv.is_owned = false;
67488         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
67489         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67490         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67491         return ret_arr;
67492 }
67493
67494 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1array(JNIEnv *env, jclass clz, int64_t this_arg) {
67495         LDKNodeId this_arg_conv;
67496         this_arg_conv.inner = untag_ptr(this_arg);
67497         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67499         this_arg_conv.is_owned = false;
67500         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
67501         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, *NodeId_as_array(&this_arg_conv));
67502         return ret_arr;
67503 }
67504
67505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
67506         LDKNodeId this_arg_conv;
67507         this_arg_conv.inner = untag_ptr(this_arg);
67508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67510         this_arg_conv.is_owned = false;
67511         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
67512         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
67513         return tag_ptr(ret_conv, true);
67514 }
67515
67516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
67517         LDKNodeId o_conv;
67518         o_conv.inner = untag_ptr(o);
67519         o_conv.is_owned = ptr_is_owned(o);
67520         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67521         o_conv.is_owned = false;
67522         int64_t ret_conv = NodeId_hash(&o_conv);
67523         return ret_conv;
67524 }
67525
67526 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
67527         LDKNodeId obj_conv;
67528         obj_conv.inner = untag_ptr(obj);
67529         obj_conv.is_owned = ptr_is_owned(obj);
67530         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67531         obj_conv.is_owned = false;
67532         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
67533         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67534         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67535         CVec_u8Z_free(ret_var);
67536         return ret_arr;
67537 }
67538
67539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
67540         LDKu8slice ser_ref;
67541         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
67542         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
67543         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
67544         *ret_conv = NodeId_read(ser_ref);
67545         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
67546         return tag_ptr(ret_conv, true);
67547 }
67548
67549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67550         LDKNetworkGraph this_obj_conv;
67551         this_obj_conv.inner = untag_ptr(this_obj);
67552         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67554         NetworkGraph_free(this_obj_conv);
67555 }
67556
67557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67558         LDKReadOnlyNetworkGraph this_obj_conv;
67559         this_obj_conv.inner = untag_ptr(this_obj);
67560         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67562         ReadOnlyNetworkGraph_free(this_obj_conv);
67563 }
67564
67565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67566         if (!ptr_is_owned(this_ptr)) return;
67567         void* this_ptr_ptr = untag_ptr(this_ptr);
67568         CHECK_ACCESS(this_ptr_ptr);
67569         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
67570         FREE(untag_ptr(this_ptr));
67571         NetworkUpdate_free(this_ptr_conv);
67572 }
67573
67574 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
67575         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
67576         *ret_copy = NetworkUpdate_clone(arg);
67577         int64_t ret_ref = tag_ptr(ret_copy, true);
67578         return ret_ref;
67579 }
67580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67581         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
67582         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
67583         return ret_conv;
67584 }
67585
67586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67587         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
67588         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
67589         *ret_copy = NetworkUpdate_clone(orig_conv);
67590         int64_t ret_ref = tag_ptr(ret_copy, true);
67591         return ret_ref;
67592 }
67593
67594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
67595         LDKChannelUpdate msg_conv;
67596         msg_conv.inner = untag_ptr(msg);
67597         msg_conv.is_owned = ptr_is_owned(msg);
67598         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
67599         msg_conv = ChannelUpdate_clone(&msg_conv);
67600         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
67601         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
67602         int64_t ret_ref = tag_ptr(ret_copy, true);
67603         return ret_ref;
67604 }
67605
67606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1failure(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
67607         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
67608         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
67609         int64_t ret_ref = tag_ptr(ret_copy, true);
67610         return ret_ref;
67611 }
67612
67613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
67614         LDKPublicKey node_id_ref;
67615         CHECK((*env)->GetArrayLength(env, node_id) == 33);
67616         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
67617         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
67618         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
67619         int64_t ret_ref = tag_ptr(ret_copy, true);
67620         return ret_ref;
67621 }
67622
67623 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67624         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
67625         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
67626         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
67627         return ret_conv;
67628 }
67629
67630 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
67631         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
67632         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
67633         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
67634         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
67635         CVec_u8Z_free(ret_var);
67636         return ret_arr;
67637 }
67638
67639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
67640         LDKu8slice ser_ref;
67641         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
67642         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
67643         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
67644         *ret_conv = NetworkUpdate_read(ser_ref);
67645         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
67646         return tag_ptr(ret_conv, true);
67647 }
67648
67649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67650         LDKP2PGossipSync this_obj_conv;
67651         this_obj_conv.inner = untag_ptr(this_obj);
67652         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67654         P2PGossipSync_free(this_obj_conv);
67655 }
67656
67657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t utxo_lookup, int64_t logger) {
67658         LDKNetworkGraph network_graph_conv;
67659         network_graph_conv.inner = untag_ptr(network_graph);
67660         network_graph_conv.is_owned = ptr_is_owned(network_graph);
67661         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
67662         network_graph_conv.is_owned = false;
67663         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
67664         CHECK_ACCESS(utxo_lookup_ptr);
67665         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
67666         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
67667         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
67668                 // Manually implement clone for Java trait instances
67669                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
67670                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67671                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
67672                 }
67673         }
67674         void* logger_ptr = untag_ptr(logger);
67675         CHECK_ACCESS(logger_ptr);
67676         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
67677         if (logger_conv.free == LDKLogger_JCalls_free) {
67678                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67679                 LDKLogger_JCalls_cloned(&logger_conv);
67680         }
67681         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
67682         int64_t ret_ref = 0;
67683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67685         return ret_ref;
67686 }
67687
67688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1utxo_1lookup(JNIEnv *env, jclass clz, int64_t this_arg, int64_t utxo_lookup) {
67689         LDKP2PGossipSync this_arg_conv;
67690         this_arg_conv.inner = untag_ptr(this_arg);
67691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67693         this_arg_conv.is_owned = false;
67694         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
67695         CHECK_ACCESS(utxo_lookup_ptr);
67696         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
67697         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
67698         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
67699                 // Manually implement clone for Java trait instances
67700                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
67701                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67702                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
67703                 }
67704         }
67705         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
67706 }
67707
67708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1handle_1network_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_update) {
67709         LDKNetworkGraph this_arg_conv;
67710         this_arg_conv.inner = untag_ptr(this_arg);
67711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67713         this_arg_conv.is_owned = false;
67714         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
67715         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
67716 }
67717
67718 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
67719         LDKNetworkGraph this_arg_conv;
67720         this_arg_conv.inner = untag_ptr(this_arg);
67721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67723         this_arg_conv.is_owned = false;
67724         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
67725         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, NetworkGraph_get_chain_hash(&this_arg_conv).data);
67726         return ret_arr;
67727 }
67728
67729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_verify_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
67730         LDKNodeAnnouncement msg_conv;
67731         msg_conv.inner = untag_ptr(msg);
67732         msg_conv.is_owned = ptr_is_owned(msg);
67733         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
67734         msg_conv.is_owned = false;
67735         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
67736         *ret_conv = verify_node_announcement(&msg_conv);
67737         return tag_ptr(ret_conv, true);
67738 }
67739
67740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_verify_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
67741         LDKChannelAnnouncement msg_conv;
67742         msg_conv.inner = untag_ptr(msg);
67743         msg_conv.is_owned = ptr_is_owned(msg);
67744         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
67745         msg_conv.is_owned = false;
67746         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
67747         *ret_conv = verify_channel_announcement(&msg_conv);
67748         return tag_ptr(ret_conv, true);
67749 }
67750
67751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
67752         LDKP2PGossipSync this_arg_conv;
67753         this_arg_conv.inner = untag_ptr(this_arg);
67754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67756         this_arg_conv.is_owned = false;
67757         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
67758         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
67759         return tag_ptr(ret_ret, true);
67760 }
67761
67762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
67763         LDKP2PGossipSync this_arg_conv;
67764         this_arg_conv.inner = untag_ptr(this_arg);
67765         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67767         this_arg_conv.is_owned = false;
67768         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
67769         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
67770         return tag_ptr(ret_ret, true);
67771 }
67772
67773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67774         LDKChannelUpdateInfo this_obj_conv;
67775         this_obj_conv.inner = untag_ptr(this_obj);
67776         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67778         ChannelUpdateInfo_free(this_obj_conv);
67779 }
67780
67781 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
67782         LDKChannelUpdateInfo this_ptr_conv;
67783         this_ptr_conv.inner = untag_ptr(this_ptr);
67784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67786         this_ptr_conv.is_owned = false;
67787         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
67788         return ret_conv;
67789 }
67790
67791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
67792         LDKChannelUpdateInfo this_ptr_conv;
67793         this_ptr_conv.inner = untag_ptr(this_ptr);
67794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67796         this_ptr_conv.is_owned = false;
67797         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
67798 }
67799
67800 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
67801         LDKChannelUpdateInfo this_ptr_conv;
67802         this_ptr_conv.inner = untag_ptr(this_ptr);
67803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67805         this_ptr_conv.is_owned = false;
67806         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
67807         return ret_conv;
67808 }
67809
67810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
67811         LDKChannelUpdateInfo this_ptr_conv;
67812         this_ptr_conv.inner = untag_ptr(this_ptr);
67813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67815         this_ptr_conv.is_owned = false;
67816         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
67817 }
67818
67819 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
67820         LDKChannelUpdateInfo this_ptr_conv;
67821         this_ptr_conv.inner = untag_ptr(this_ptr);
67822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67824         this_ptr_conv.is_owned = false;
67825         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
67826         return ret_conv;
67827 }
67828
67829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
67830         LDKChannelUpdateInfo this_ptr_conv;
67831         this_ptr_conv.inner = untag_ptr(this_ptr);
67832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67834         this_ptr_conv.is_owned = false;
67835         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
67836 }
67837
67838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
67839         LDKChannelUpdateInfo this_ptr_conv;
67840         this_ptr_conv.inner = untag_ptr(this_ptr);
67841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67843         this_ptr_conv.is_owned = false;
67844         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
67845         return ret_conv;
67846 }
67847
67848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67849         LDKChannelUpdateInfo this_ptr_conv;
67850         this_ptr_conv.inner = untag_ptr(this_ptr);
67851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67853         this_ptr_conv.is_owned = false;
67854         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
67855 }
67856
67857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
67858         LDKChannelUpdateInfo this_ptr_conv;
67859         this_ptr_conv.inner = untag_ptr(this_ptr);
67860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67862         this_ptr_conv.is_owned = false;
67863         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
67864         return ret_conv;
67865 }
67866
67867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67868         LDKChannelUpdateInfo this_ptr_conv;
67869         this_ptr_conv.inner = untag_ptr(this_ptr);
67870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67872         this_ptr_conv.is_owned = false;
67873         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
67874 }
67875
67876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
67877         LDKChannelUpdateInfo this_ptr_conv;
67878         this_ptr_conv.inner = untag_ptr(this_ptr);
67879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67881         this_ptr_conv.is_owned = false;
67882         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
67883         int64_t ret_ref = 0;
67884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67886         return ret_ref;
67887 }
67888
67889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67890         LDKChannelUpdateInfo this_ptr_conv;
67891         this_ptr_conv.inner = untag_ptr(this_ptr);
67892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67894         this_ptr_conv.is_owned = false;
67895         LDKRoutingFees val_conv;
67896         val_conv.inner = untag_ptr(val);
67897         val_conv.is_owned = ptr_is_owned(val);
67898         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67899         val_conv = RoutingFees_clone(&val_conv);
67900         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
67901 }
67902
67903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
67904         LDKChannelUpdateInfo this_ptr_conv;
67905         this_ptr_conv.inner = untag_ptr(this_ptr);
67906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67908         this_ptr_conv.is_owned = false;
67909         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
67910         int64_t ret_ref = 0;
67911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67913         return ret_ref;
67914 }
67915
67916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67917         LDKChannelUpdateInfo this_ptr_conv;
67918         this_ptr_conv.inner = untag_ptr(this_ptr);
67919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67921         this_ptr_conv.is_owned = false;
67922         LDKChannelUpdate val_conv;
67923         val_conv.inner = untag_ptr(val);
67924         val_conv.is_owned = ptr_is_owned(val);
67925         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67926         val_conv = ChannelUpdate_clone(&val_conv);
67927         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
67928 }
67929
67930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1new(JNIEnv *env, jclass clz, int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t fees_arg, int64_t last_update_message_arg) {
67931         LDKRoutingFees fees_arg_conv;
67932         fees_arg_conv.inner = untag_ptr(fees_arg);
67933         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
67934         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
67935         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
67936         LDKChannelUpdate last_update_message_arg_conv;
67937         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
67938         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
67939         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
67940         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
67941         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fees_arg_conv, last_update_message_arg_conv);
67942         int64_t ret_ref = 0;
67943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67945         return ret_ref;
67946 }
67947
67948 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
67949         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
67950         int64_t ret_ref = 0;
67951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67953         return ret_ref;
67954 }
67955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67956         LDKChannelUpdateInfo arg_conv;
67957         arg_conv.inner = untag_ptr(arg);
67958         arg_conv.is_owned = ptr_is_owned(arg);
67959         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67960         arg_conv.is_owned = false;
67961         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
67962         return ret_conv;
67963 }
67964
67965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67966         LDKChannelUpdateInfo orig_conv;
67967         orig_conv.inner = untag_ptr(orig);
67968         orig_conv.is_owned = ptr_is_owned(orig);
67969         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67970         orig_conv.is_owned = false;
67971         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
67972         int64_t ret_ref = 0;
67973         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67974         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67975         return ret_ref;
67976 }
67977
67978 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67979         LDKChannelUpdateInfo a_conv;
67980         a_conv.inner = untag_ptr(a);
67981         a_conv.is_owned = ptr_is_owned(a);
67982         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67983         a_conv.is_owned = false;
67984         LDKChannelUpdateInfo b_conv;
67985         b_conv.inner = untag_ptr(b);
67986         b_conv.is_owned = ptr_is_owned(b);
67987         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67988         b_conv.is_owned = false;
67989         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
67990         return ret_conv;
67991 }
67992
67993 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
67994         LDKChannelUpdateInfo obj_conv;
67995         obj_conv.inner = untag_ptr(obj);
67996         obj_conv.is_owned = ptr_is_owned(obj);
67997         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67998         obj_conv.is_owned = false;
67999         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
68000         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68001         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68002         CVec_u8Z_free(ret_var);
68003         return ret_arr;
68004 }
68005
68006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
68007         LDKu8slice ser_ref;
68008         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68009         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68010         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
68011         *ret_conv = ChannelUpdateInfo_read(ser_ref);
68012         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68013         return tag_ptr(ret_conv, true);
68014 }
68015
68016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68017         LDKChannelInfo this_obj_conv;
68018         this_obj_conv.inner = untag_ptr(this_obj);
68019         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68021         ChannelInfo_free(this_obj_conv);
68022 }
68023
68024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
68025         LDKChannelInfo this_ptr_conv;
68026         this_ptr_conv.inner = untag_ptr(this_ptr);
68027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68029         this_ptr_conv.is_owned = false;
68030         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
68031         int64_t ret_ref = 0;
68032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68034         return ret_ref;
68035 }
68036
68037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68038         LDKChannelInfo this_ptr_conv;
68039         this_ptr_conv.inner = untag_ptr(this_ptr);
68040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68042         this_ptr_conv.is_owned = false;
68043         LDKChannelFeatures val_conv;
68044         val_conv.inner = untag_ptr(val);
68045         val_conv.is_owned = ptr_is_owned(val);
68046         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68047         val_conv = ChannelFeatures_clone(&val_conv);
68048         ChannelInfo_set_features(&this_ptr_conv, val_conv);
68049 }
68050
68051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
68052         LDKChannelInfo this_ptr_conv;
68053         this_ptr_conv.inner = untag_ptr(this_ptr);
68054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68056         this_ptr_conv.is_owned = false;
68057         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
68058         int64_t ret_ref = 0;
68059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68061         return ret_ref;
68062 }
68063
68064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68065         LDKChannelInfo this_ptr_conv;
68066         this_ptr_conv.inner = untag_ptr(this_ptr);
68067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68069         this_ptr_conv.is_owned = false;
68070         LDKNodeId val_conv;
68071         val_conv.inner = untag_ptr(val);
68072         val_conv.is_owned = ptr_is_owned(val);
68073         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68074         val_conv = NodeId_clone(&val_conv);
68075         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
68076 }
68077
68078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
68079         LDKChannelInfo this_ptr_conv;
68080         this_ptr_conv.inner = untag_ptr(this_ptr);
68081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68083         this_ptr_conv.is_owned = false;
68084         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
68085         int64_t ret_ref = 0;
68086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68088         return ret_ref;
68089 }
68090
68091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68092         LDKChannelInfo this_ptr_conv;
68093         this_ptr_conv.inner = untag_ptr(this_ptr);
68094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68096         this_ptr_conv.is_owned = false;
68097         LDKChannelUpdateInfo val_conv;
68098         val_conv.inner = untag_ptr(val);
68099         val_conv.is_owned = ptr_is_owned(val);
68100         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68101         val_conv = ChannelUpdateInfo_clone(&val_conv);
68102         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
68103 }
68104
68105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
68106         LDKChannelInfo this_ptr_conv;
68107         this_ptr_conv.inner = untag_ptr(this_ptr);
68108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68110         this_ptr_conv.is_owned = false;
68111         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
68112         int64_t ret_ref = 0;
68113         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68114         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68115         return ret_ref;
68116 }
68117
68118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68119         LDKChannelInfo this_ptr_conv;
68120         this_ptr_conv.inner = untag_ptr(this_ptr);
68121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68123         this_ptr_conv.is_owned = false;
68124         LDKNodeId val_conv;
68125         val_conv.inner = untag_ptr(val);
68126         val_conv.is_owned = ptr_is_owned(val);
68127         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68128         val_conv = NodeId_clone(&val_conv);
68129         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
68130 }
68131
68132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
68133         LDKChannelInfo this_ptr_conv;
68134         this_ptr_conv.inner = untag_ptr(this_ptr);
68135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68137         this_ptr_conv.is_owned = false;
68138         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
68139         int64_t ret_ref = 0;
68140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68142         return ret_ref;
68143 }
68144
68145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68146         LDKChannelInfo this_ptr_conv;
68147         this_ptr_conv.inner = untag_ptr(this_ptr);
68148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68150         this_ptr_conv.is_owned = false;
68151         LDKChannelUpdateInfo val_conv;
68152         val_conv.inner = untag_ptr(val);
68153         val_conv.is_owned = ptr_is_owned(val);
68154         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68155         val_conv = ChannelUpdateInfo_clone(&val_conv);
68156         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
68157 }
68158
68159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
68160         LDKChannelInfo this_ptr_conv;
68161         this_ptr_conv.inner = untag_ptr(this_ptr);
68162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68164         this_ptr_conv.is_owned = false;
68165         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
68166         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
68167         int64_t ret_ref = tag_ptr(ret_copy, true);
68168         return ret_ref;
68169 }
68170
68171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68172         LDKChannelInfo this_ptr_conv;
68173         this_ptr_conv.inner = untag_ptr(this_ptr);
68174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68176         this_ptr_conv.is_owned = false;
68177         void* val_ptr = untag_ptr(val);
68178         CHECK_ACCESS(val_ptr);
68179         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
68180         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
68181         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
68182 }
68183
68184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
68185         LDKChannelInfo this_ptr_conv;
68186         this_ptr_conv.inner = untag_ptr(this_ptr);
68187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68189         this_ptr_conv.is_owned = false;
68190         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
68191         int64_t ret_ref = 0;
68192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68194         return ret_ref;
68195 }
68196
68197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68198         LDKChannelInfo this_ptr_conv;
68199         this_ptr_conv.inner = untag_ptr(this_ptr);
68200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68202         this_ptr_conv.is_owned = false;
68203         LDKChannelAnnouncement val_conv;
68204         val_conv.inner = untag_ptr(val);
68205         val_conv.is_owned = ptr_is_owned(val);
68206         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68207         val_conv = ChannelAnnouncement_clone(&val_conv);
68208         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
68209 }
68210
68211 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
68212         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
68213         int64_t ret_ref = 0;
68214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68216         return ret_ref;
68217 }
68218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68219         LDKChannelInfo arg_conv;
68220         arg_conv.inner = untag_ptr(arg);
68221         arg_conv.is_owned = ptr_is_owned(arg);
68222         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68223         arg_conv.is_owned = false;
68224         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
68225         return ret_conv;
68226 }
68227
68228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68229         LDKChannelInfo orig_conv;
68230         orig_conv.inner = untag_ptr(orig);
68231         orig_conv.is_owned = ptr_is_owned(orig);
68232         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68233         orig_conv.is_owned = false;
68234         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
68235         int64_t ret_ref = 0;
68236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68238         return ret_ref;
68239 }
68240
68241 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68242         LDKChannelInfo a_conv;
68243         a_conv.inner = untag_ptr(a);
68244         a_conv.is_owned = ptr_is_owned(a);
68245         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68246         a_conv.is_owned = false;
68247         LDKChannelInfo b_conv;
68248         b_conv.inner = untag_ptr(b);
68249         b_conv.is_owned = ptr_is_owned(b);
68250         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68251         b_conv.is_owned = false;
68252         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
68253         return ret_conv;
68254 }
68255
68256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1directional_1info(JNIEnv *env, jclass clz, int64_t this_arg, int8_t channel_flags) {
68257         LDKChannelInfo this_arg_conv;
68258         this_arg_conv.inner = untag_ptr(this_arg);
68259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68261         this_arg_conv.is_owned = false;
68262         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
68263         int64_t ret_ref = 0;
68264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68266         return ret_ref;
68267 }
68268
68269 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
68270         LDKChannelInfo obj_conv;
68271         obj_conv.inner = untag_ptr(obj);
68272         obj_conv.is_owned = ptr_is_owned(obj);
68273         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68274         obj_conv.is_owned = false;
68275         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
68276         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68277         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68278         CVec_u8Z_free(ret_var);
68279         return ret_arr;
68280 }
68281
68282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
68283         LDKu8slice ser_ref;
68284         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68285         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68286         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
68287         *ret_conv = ChannelInfo_read(ser_ref);
68288         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68289         return tag_ptr(ret_conv, true);
68290 }
68291
68292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68293         LDKDirectedChannelInfo this_obj_conv;
68294         this_obj_conv.inner = untag_ptr(this_obj);
68295         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68297         DirectedChannelInfo_free(this_obj_conv);
68298 }
68299
68300 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
68301         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
68302         int64_t ret_ref = 0;
68303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68305         return ret_ref;
68306 }
68307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68308         LDKDirectedChannelInfo arg_conv;
68309         arg_conv.inner = untag_ptr(arg);
68310         arg_conv.is_owned = ptr_is_owned(arg);
68311         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68312         arg_conv.is_owned = false;
68313         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
68314         return ret_conv;
68315 }
68316
68317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68318         LDKDirectedChannelInfo orig_conv;
68319         orig_conv.inner = untag_ptr(orig);
68320         orig_conv.is_owned = ptr_is_owned(orig);
68321         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68322         orig_conv.is_owned = false;
68323         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
68324         int64_t ret_ref = 0;
68325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68327         return ret_ref;
68328 }
68329
68330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
68331         LDKDirectedChannelInfo this_arg_conv;
68332         this_arg_conv.inner = untag_ptr(this_arg);
68333         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68335         this_arg_conv.is_owned = false;
68336         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
68337         int64_t ret_ref = 0;
68338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68340         return ret_ref;
68341 }
68342
68343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
68344         LDKDirectedChannelInfo this_arg_conv;
68345         this_arg_conv.inner = untag_ptr(this_arg);
68346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68348         this_arg_conv.is_owned = false;
68349         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68350         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
68351         int64_t ret_ref = tag_ptr(ret_copy, true);
68352         return ret_ref;
68353 }
68354
68355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68356         if (!ptr_is_owned(this_ptr)) return;
68357         void* this_ptr_ptr = untag_ptr(this_ptr);
68358         CHECK_ACCESS(this_ptr_ptr);
68359         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
68360         FREE(untag_ptr(this_ptr));
68361         EffectiveCapacity_free(this_ptr_conv);
68362 }
68363
68364 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
68365         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68366         *ret_copy = EffectiveCapacity_clone(arg);
68367         int64_t ret_ref = tag_ptr(ret_copy, true);
68368         return ret_ref;
68369 }
68370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68371         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
68372         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
68373         return ret_conv;
68374 }
68375
68376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68377         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
68378         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68379         *ret_copy = EffectiveCapacity_clone(orig_conv);
68380         int64_t ret_ref = tag_ptr(ret_copy, true);
68381         return ret_ref;
68382 }
68383
68384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
68385         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68386         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
68387         int64_t ret_ref = tag_ptr(ret_copy, true);
68388         return ret_ref;
68389 }
68390
68391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1advertised_1max_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
68392         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68393         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
68394         int64_t ret_ref = tag_ptr(ret_copy, true);
68395         return ret_ref;
68396 }
68397
68398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat, int64_t htlc_maximum_msat) {
68399         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68400         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
68401         int64_t ret_ref = tag_ptr(ret_copy, true);
68402         return ret_ref;
68403 }
68404
68405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
68406         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68407         *ret_copy = EffectiveCapacity_infinite();
68408         int64_t ret_ref = tag_ptr(ret_copy, true);
68409         return ret_ref;
68410 }
68411
68412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1hint_1max_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
68413         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68414         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
68415         int64_t ret_ref = tag_ptr(ret_copy, true);
68416         return ret_ref;
68417 }
68418
68419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
68420         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
68421         *ret_copy = EffectiveCapacity_unknown();
68422         int64_t ret_ref = tag_ptr(ret_copy, true);
68423         return ret_ref;
68424 }
68425
68426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
68427         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
68428         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
68429         return ret_conv;
68430 }
68431
68432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68433         LDKRoutingFees this_obj_conv;
68434         this_obj_conv.inner = untag_ptr(this_obj);
68435         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68437         RoutingFees_free(this_obj_conv);
68438 }
68439
68440 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
68441         LDKRoutingFees this_ptr_conv;
68442         this_ptr_conv.inner = untag_ptr(this_ptr);
68443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68445         this_ptr_conv.is_owned = false;
68446         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
68447         return ret_conv;
68448 }
68449
68450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
68451         LDKRoutingFees this_ptr_conv;
68452         this_ptr_conv.inner = untag_ptr(this_ptr);
68453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68455         this_ptr_conv.is_owned = false;
68456         RoutingFees_set_base_msat(&this_ptr_conv, val);
68457 }
68458
68459 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
68460         LDKRoutingFees this_ptr_conv;
68461         this_ptr_conv.inner = untag_ptr(this_ptr);
68462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68464         this_ptr_conv.is_owned = false;
68465         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
68466         return ret_conv;
68467 }
68468
68469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
68470         LDKRoutingFees this_ptr_conv;
68471         this_ptr_conv.inner = untag_ptr(this_ptr);
68472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68474         this_ptr_conv.is_owned = false;
68475         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
68476 }
68477
68478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv *env, jclass clz, int32_t base_msat_arg, int32_t proportional_millionths_arg) {
68479         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
68480         int64_t ret_ref = 0;
68481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68483         return ret_ref;
68484 }
68485
68486 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68487         LDKRoutingFees a_conv;
68488         a_conv.inner = untag_ptr(a);
68489         a_conv.is_owned = ptr_is_owned(a);
68490         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68491         a_conv.is_owned = false;
68492         LDKRoutingFees b_conv;
68493         b_conv.inner = untag_ptr(b);
68494         b_conv.is_owned = ptr_is_owned(b);
68495         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68496         b_conv.is_owned = false;
68497         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
68498         return ret_conv;
68499 }
68500
68501 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
68502         LDKRoutingFees ret_var = RoutingFees_clone(arg);
68503         int64_t ret_ref = 0;
68504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68506         return ret_ref;
68507 }
68508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68509         LDKRoutingFees arg_conv;
68510         arg_conv.inner = untag_ptr(arg);
68511         arg_conv.is_owned = ptr_is_owned(arg);
68512         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68513         arg_conv.is_owned = false;
68514         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
68515         return ret_conv;
68516 }
68517
68518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68519         LDKRoutingFees orig_conv;
68520         orig_conv.inner = untag_ptr(orig);
68521         orig_conv.is_owned = ptr_is_owned(orig);
68522         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68523         orig_conv.is_owned = false;
68524         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
68525         int64_t ret_ref = 0;
68526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68528         return ret_ref;
68529 }
68530
68531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
68532         LDKRoutingFees o_conv;
68533         o_conv.inner = untag_ptr(o);
68534         o_conv.is_owned = ptr_is_owned(o);
68535         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68536         o_conv.is_owned = false;
68537         int64_t ret_conv = RoutingFees_hash(&o_conv);
68538         return ret_conv;
68539 }
68540
68541 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
68542         LDKRoutingFees obj_conv;
68543         obj_conv.inner = untag_ptr(obj);
68544         obj_conv.is_owned = ptr_is_owned(obj);
68545         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68546         obj_conv.is_owned = false;
68547         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
68548         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68549         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68550         CVec_u8Z_free(ret_var);
68551         return ret_arr;
68552 }
68553
68554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
68555         LDKu8slice ser_ref;
68556         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68557         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68558         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
68559         *ret_conv = RoutingFees_read(ser_ref);
68560         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68561         return tag_ptr(ret_conv, true);
68562 }
68563
68564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68565         LDKNodeAnnouncementInfo this_obj_conv;
68566         this_obj_conv.inner = untag_ptr(this_obj);
68567         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68569         NodeAnnouncementInfo_free(this_obj_conv);
68570 }
68571
68572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
68573         LDKNodeAnnouncementInfo this_ptr_conv;
68574         this_ptr_conv.inner = untag_ptr(this_ptr);
68575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68577         this_ptr_conv.is_owned = false;
68578         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
68579         int64_t ret_ref = 0;
68580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68582         return ret_ref;
68583 }
68584
68585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68586         LDKNodeAnnouncementInfo this_ptr_conv;
68587         this_ptr_conv.inner = untag_ptr(this_ptr);
68588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68590         this_ptr_conv.is_owned = false;
68591         LDKNodeFeatures val_conv;
68592         val_conv.inner = untag_ptr(val);
68593         val_conv.is_owned = ptr_is_owned(val);
68594         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68595         val_conv = NodeFeatures_clone(&val_conv);
68596         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
68597 }
68598
68599 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
68600         LDKNodeAnnouncementInfo this_ptr_conv;
68601         this_ptr_conv.inner = untag_ptr(this_ptr);
68602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68604         this_ptr_conv.is_owned = false;
68605         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
68606         return ret_conv;
68607 }
68608
68609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
68610         LDKNodeAnnouncementInfo this_ptr_conv;
68611         this_ptr_conv.inner = untag_ptr(this_ptr);
68612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68614         this_ptr_conv.is_owned = false;
68615         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
68616 }
68617
68618 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
68619         LDKNodeAnnouncementInfo this_ptr_conv;
68620         this_ptr_conv.inner = untag_ptr(this_ptr);
68621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68623         this_ptr_conv.is_owned = false;
68624         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
68625         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
68626         return ret_arr;
68627 }
68628
68629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68630         LDKNodeAnnouncementInfo this_ptr_conv;
68631         this_ptr_conv.inner = untag_ptr(this_ptr);
68632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68634         this_ptr_conv.is_owned = false;
68635         LDKThreeBytes val_ref;
68636         CHECK((*env)->GetArrayLength(env, val) == 3);
68637         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
68638         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
68639 }
68640
68641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
68642         LDKNodeAnnouncementInfo this_ptr_conv;
68643         this_ptr_conv.inner = untag_ptr(this_ptr);
68644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68646         this_ptr_conv.is_owned = false;
68647         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
68648         int64_t ret_ref = 0;
68649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68651         return ret_ref;
68652 }
68653
68654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68655         LDKNodeAnnouncementInfo this_ptr_conv;
68656         this_ptr_conv.inner = untag_ptr(this_ptr);
68657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68659         this_ptr_conv.is_owned = false;
68660         LDKNodeAlias val_conv;
68661         val_conv.inner = untag_ptr(val);
68662         val_conv.is_owned = ptr_is_owned(val);
68663         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68664         val_conv = NodeAlias_clone(&val_conv);
68665         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
68666 }
68667
68668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
68669         LDKNodeAnnouncementInfo this_ptr_conv;
68670         this_ptr_conv.inner = untag_ptr(this_ptr);
68671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68673         this_ptr_conv.is_owned = false;
68674         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
68675         int64_t ret_ref = 0;
68676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68678         return ret_ref;
68679 }
68680
68681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68682         LDKNodeAnnouncementInfo this_ptr_conv;
68683         this_ptr_conv.inner = untag_ptr(this_ptr);
68684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68686         this_ptr_conv.is_owned = false;
68687         LDKNodeAnnouncement val_conv;
68688         val_conv.inner = untag_ptr(val);
68689         val_conv.is_owned = ptr_is_owned(val);
68690         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68691         val_conv = NodeAnnouncement_clone(&val_conv);
68692         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
68693 }
68694
68695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1new(JNIEnv *env, jclass clz, int64_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, int64_t alias_arg, int64_t announcement_message_arg) {
68696         LDKNodeFeatures features_arg_conv;
68697         features_arg_conv.inner = untag_ptr(features_arg);
68698         features_arg_conv.is_owned = ptr_is_owned(features_arg);
68699         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
68700         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
68701         LDKThreeBytes rgb_arg_ref;
68702         CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
68703         (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
68704         LDKNodeAlias alias_arg_conv;
68705         alias_arg_conv.inner = untag_ptr(alias_arg);
68706         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
68707         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
68708         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
68709         LDKNodeAnnouncement announcement_message_arg_conv;
68710         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
68711         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
68712         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
68713         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
68714         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
68715         int64_t ret_ref = 0;
68716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68718         return ret_ref;
68719 }
68720
68721 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
68722         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
68723         int64_t ret_ref = 0;
68724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68726         return ret_ref;
68727 }
68728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68729         LDKNodeAnnouncementInfo arg_conv;
68730         arg_conv.inner = untag_ptr(arg);
68731         arg_conv.is_owned = ptr_is_owned(arg);
68732         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68733         arg_conv.is_owned = false;
68734         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
68735         return ret_conv;
68736 }
68737
68738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68739         LDKNodeAnnouncementInfo orig_conv;
68740         orig_conv.inner = untag_ptr(orig);
68741         orig_conv.is_owned = ptr_is_owned(orig);
68742         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68743         orig_conv.is_owned = false;
68744         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
68745         int64_t ret_ref = 0;
68746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68748         return ret_ref;
68749 }
68750
68751 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68752         LDKNodeAnnouncementInfo a_conv;
68753         a_conv.inner = untag_ptr(a);
68754         a_conv.is_owned = ptr_is_owned(a);
68755         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68756         a_conv.is_owned = false;
68757         LDKNodeAnnouncementInfo b_conv;
68758         b_conv.inner = untag_ptr(b);
68759         b_conv.is_owned = ptr_is_owned(b);
68760         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68761         b_conv.is_owned = false;
68762         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
68763         return ret_conv;
68764 }
68765
68766 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1addresses(JNIEnv *env, jclass clz, int64_t this_arg) {
68767         LDKNodeAnnouncementInfo this_arg_conv;
68768         this_arg_conv.inner = untag_ptr(this_arg);
68769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68771         this_arg_conv.is_owned = false;
68772         LDKCVec_SocketAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
68773         int64_tArray ret_arr = NULL;
68774         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
68775         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
68776         for (size_t p = 0; p < ret_var.datalen; p++) {
68777                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
68778                 *ret_conv_15_copy = ret_var.data[p];
68779                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
68780                 ret_arr_ptr[p] = ret_conv_15_ref;
68781         }
68782         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
68783         FREE(ret_var.data);
68784         return ret_arr;
68785 }
68786
68787 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
68788         LDKNodeAnnouncementInfo obj_conv;
68789         obj_conv.inner = untag_ptr(obj);
68790         obj_conv.is_owned = ptr_is_owned(obj);
68791         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68792         obj_conv.is_owned = false;
68793         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
68794         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68795         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68796         CVec_u8Z_free(ret_var);
68797         return ret_arr;
68798 }
68799
68800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
68801         LDKu8slice ser_ref;
68802         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68803         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68804         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
68805         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
68806         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68807         return tag_ptr(ret_conv, true);
68808 }
68809
68810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68811         LDKNodeAlias this_obj_conv;
68812         this_obj_conv.inner = untag_ptr(this_obj);
68813         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68815         NodeAlias_free(this_obj_conv);
68816 }
68817
68818 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
68819         LDKNodeAlias this_ptr_conv;
68820         this_ptr_conv.inner = untag_ptr(this_ptr);
68821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68823         this_ptr_conv.is_owned = false;
68824         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68825         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAlias_get_a(&this_ptr_conv));
68826         return ret_arr;
68827 }
68828
68829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68830         LDKNodeAlias this_ptr_conv;
68831         this_ptr_conv.inner = untag_ptr(this_ptr);
68832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68834         this_ptr_conv.is_owned = false;
68835         LDKThirtyTwoBytes val_ref;
68836         CHECK((*env)->GetArrayLength(env, val) == 32);
68837         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
68838         NodeAlias_set_a(&this_ptr_conv, val_ref);
68839 }
68840
68841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
68842         LDKThirtyTwoBytes a_arg_ref;
68843         CHECK((*env)->GetArrayLength(env, a_arg) == 32);
68844         (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
68845         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
68846         int64_t ret_ref = 0;
68847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68849         return ret_ref;
68850 }
68851
68852 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
68853         LDKNodeAlias ret_var = NodeAlias_clone(arg);
68854         int64_t ret_ref = 0;
68855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68857         return ret_ref;
68858 }
68859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68860         LDKNodeAlias arg_conv;
68861         arg_conv.inner = untag_ptr(arg);
68862         arg_conv.is_owned = ptr_is_owned(arg);
68863         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68864         arg_conv.is_owned = false;
68865         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
68866         return ret_conv;
68867 }
68868
68869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68870         LDKNodeAlias orig_conv;
68871         orig_conv.inner = untag_ptr(orig);
68872         orig_conv.is_owned = ptr_is_owned(orig);
68873         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68874         orig_conv.is_owned = false;
68875         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
68876         int64_t ret_ref = 0;
68877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68879         return ret_ref;
68880 }
68881
68882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1hash(JNIEnv *env, jclass clz, int64_t o) {
68883         LDKNodeAlias o_conv;
68884         o_conv.inner = untag_ptr(o);
68885         o_conv.is_owned = ptr_is_owned(o);
68886         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68887         o_conv.is_owned = false;
68888         int64_t ret_conv = NodeAlias_hash(&o_conv);
68889         return ret_conv;
68890 }
68891
68892 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAlias_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68893         LDKNodeAlias a_conv;
68894         a_conv.inner = untag_ptr(a);
68895         a_conv.is_owned = ptr_is_owned(a);
68896         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68897         a_conv.is_owned = false;
68898         LDKNodeAlias b_conv;
68899         b_conv.inner = untag_ptr(b);
68900         b_conv.is_owned = ptr_is_owned(b);
68901         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68902         b_conv.is_owned = false;
68903         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
68904         return ret_conv;
68905 }
68906
68907 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1write(JNIEnv *env, jclass clz, int64_t obj) {
68908         LDKNodeAlias obj_conv;
68909         obj_conv.inner = untag_ptr(obj);
68910         obj_conv.is_owned = ptr_is_owned(obj);
68911         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68912         obj_conv.is_owned = false;
68913         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
68914         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68915         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68916         CVec_u8Z_free(ret_var);
68917         return ret_arr;
68918 }
68919
68920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
68921         LDKu8slice ser_ref;
68922         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68923         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68924         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
68925         *ret_conv = NodeAlias_read(ser_ref);
68926         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68927         return tag_ptr(ret_conv, true);
68928 }
68929
68930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68931         LDKNodeInfo this_obj_conv;
68932         this_obj_conv.inner = untag_ptr(this_obj);
68933         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68935         NodeInfo_free(this_obj_conv);
68936 }
68937
68938 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
68939         LDKNodeInfo this_ptr_conv;
68940         this_ptr_conv.inner = untag_ptr(this_ptr);
68941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68943         this_ptr_conv.is_owned = false;
68944         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
68945         int64_tArray ret_arr = NULL;
68946         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
68947         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
68948         for (size_t g = 0; g < ret_var.datalen; g++) {
68949                 int64_t ret_conv_6_conv = ret_var.data[g];
68950                 ret_arr_ptr[g] = ret_conv_6_conv;
68951         }
68952         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
68953         FREE(ret_var.data);
68954         return ret_arr;
68955 }
68956
68957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
68958         LDKNodeInfo this_ptr_conv;
68959         this_ptr_conv.inner = untag_ptr(this_ptr);
68960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68962         this_ptr_conv.is_owned = false;
68963         LDKCVec_u64Z val_constr;
68964         val_constr.datalen = (*env)->GetArrayLength(env, val);
68965         if (val_constr.datalen > 0)
68966                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
68967         else
68968                 val_constr.data = NULL;
68969         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
68970         for (size_t g = 0; g < val_constr.datalen; g++) {
68971                 int64_t val_conv_6 = val_vals[g];
68972                 val_constr.data[g] = val_conv_6;
68973         }
68974         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
68975         NodeInfo_set_channels(&this_ptr_conv, val_constr);
68976 }
68977
68978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
68979         LDKNodeInfo this_ptr_conv;
68980         this_ptr_conv.inner = untag_ptr(this_ptr);
68981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68983         this_ptr_conv.is_owned = false;
68984         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
68985         int64_t ret_ref = 0;
68986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68988         return ret_ref;
68989 }
68990
68991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68992         LDKNodeInfo this_ptr_conv;
68993         this_ptr_conv.inner = untag_ptr(this_ptr);
68994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68996         this_ptr_conv.is_owned = false;
68997         LDKNodeAnnouncementInfo val_conv;
68998         val_conv.inner = untag_ptr(val);
68999         val_conv.is_owned = ptr_is_owned(val);
69000         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69001         val_conv = NodeAnnouncementInfo_clone(&val_conv);
69002         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
69003 }
69004
69005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t announcement_info_arg) {
69006         LDKCVec_u64Z channels_arg_constr;
69007         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
69008         if (channels_arg_constr.datalen > 0)
69009                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
69010         else
69011                 channels_arg_constr.data = NULL;
69012         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
69013         for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
69014                 int64_t channels_arg_conv_6 = channels_arg_vals[g];
69015                 channels_arg_constr.data[g] = channels_arg_conv_6;
69016         }
69017         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
69018         LDKNodeAnnouncementInfo announcement_info_arg_conv;
69019         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
69020         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
69021         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
69022         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
69023         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
69024         int64_t ret_ref = 0;
69025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69027         return ret_ref;
69028 }
69029
69030 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
69031         LDKNodeInfo ret_var = NodeInfo_clone(arg);
69032         int64_t ret_ref = 0;
69033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69035         return ret_ref;
69036 }
69037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69038         LDKNodeInfo arg_conv;
69039         arg_conv.inner = untag_ptr(arg);
69040         arg_conv.is_owned = ptr_is_owned(arg);
69041         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69042         arg_conv.is_owned = false;
69043         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
69044         return ret_conv;
69045 }
69046
69047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69048         LDKNodeInfo orig_conv;
69049         orig_conv.inner = untag_ptr(orig);
69050         orig_conv.is_owned = ptr_is_owned(orig);
69051         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69052         orig_conv.is_owned = false;
69053         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
69054         int64_t ret_ref = 0;
69055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69057         return ret_ref;
69058 }
69059
69060 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69061         LDKNodeInfo a_conv;
69062         a_conv.inner = untag_ptr(a);
69063         a_conv.is_owned = ptr_is_owned(a);
69064         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69065         a_conv.is_owned = false;
69066         LDKNodeInfo b_conv;
69067         b_conv.inner = untag_ptr(b);
69068         b_conv.is_owned = ptr_is_owned(b);
69069         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69070         b_conv.is_owned = false;
69071         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
69072         return ret_conv;
69073 }
69074
69075 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
69076         LDKNodeInfo obj_conv;
69077         obj_conv.inner = untag_ptr(obj);
69078         obj_conv.is_owned = ptr_is_owned(obj);
69079         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69080         obj_conv.is_owned = false;
69081         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
69082         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69083         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69084         CVec_u8Z_free(ret_var);
69085         return ret_arr;
69086 }
69087
69088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
69089         LDKu8slice ser_ref;
69090         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69091         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69092         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
69093         *ret_conv = NodeInfo_read(ser_ref);
69094         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69095         return tag_ptr(ret_conv, true);
69096 }
69097
69098 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
69099         LDKNetworkGraph obj_conv;
69100         obj_conv.inner = untag_ptr(obj);
69101         obj_conv.is_owned = ptr_is_owned(obj);
69102         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69103         obj_conv.is_owned = false;
69104         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
69105         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69106         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69107         CVec_u8Z_free(ret_var);
69108         return ret_arr;
69109 }
69110
69111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
69112         LDKu8slice ser_ref;
69113         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69114         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69115         void* arg_ptr = untag_ptr(arg);
69116         CHECK_ACCESS(arg_ptr);
69117         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
69118         if (arg_conv.free == LDKLogger_JCalls_free) {
69119                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69120                 LDKLogger_JCalls_cloned(&arg_conv);
69121         }
69122         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
69123         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
69124         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69125         return tag_ptr(ret_conv, true);
69126 }
69127
69128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, jclass network, int64_t logger) {
69129         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
69130         void* logger_ptr = untag_ptr(logger);
69131         CHECK_ACCESS(logger_ptr);
69132         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69133         if (logger_conv.free == LDKLogger_JCalls_free) {
69134                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69135                 LDKLogger_JCalls_cloned(&logger_conv);
69136         }
69137         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
69138         int64_t ret_ref = 0;
69139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69141         return ret_ref;
69142 }
69143
69144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
69145         LDKNetworkGraph this_arg_conv;
69146         this_arg_conv.inner = untag_ptr(this_arg);
69147         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69149         this_arg_conv.is_owned = false;
69150         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
69151         int64_t ret_ref = 0;
69152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69154         return ret_ref;
69155 }
69156
69157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
69158         LDKNetworkGraph this_arg_conv;
69159         this_arg_conv.inner = untag_ptr(this_arg);
69160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69162         this_arg_conv.is_owned = false;
69163         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
69164         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
69165         int64_t ret_ref = tag_ptr(ret_copy, true);
69166         return ret_ref;
69167 }
69168
69169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1set_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg, int32_t last_rapid_gossip_sync_timestamp) {
69170         LDKNetworkGraph this_arg_conv;
69171         this_arg_conv.inner = untag_ptr(this_arg);
69172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69174         this_arg_conv.is_owned = false;
69175         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
69176 }
69177
69178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1node_1from_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
69179         LDKNetworkGraph this_arg_conv;
69180         this_arg_conv.inner = untag_ptr(this_arg);
69181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69183         this_arg_conv.is_owned = false;
69184         LDKNodeAnnouncement msg_conv;
69185         msg_conv.inner = untag_ptr(msg);
69186         msg_conv.is_owned = ptr_is_owned(msg);
69187         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69188         msg_conv.is_owned = false;
69189         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69190         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
69191         return tag_ptr(ret_conv, true);
69192 }
69193
69194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1node_1from_1unsigned_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
69195         LDKNetworkGraph this_arg_conv;
69196         this_arg_conv.inner = untag_ptr(this_arg);
69197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69199         this_arg_conv.is_owned = false;
69200         LDKUnsignedNodeAnnouncement msg_conv;
69201         msg_conv.inner = untag_ptr(msg);
69202         msg_conv.is_owned = ptr_is_owned(msg);
69203         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69204         msg_conv.is_owned = false;
69205         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69206         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
69207         return tag_ptr(ret_conv, true);
69208 }
69209
69210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int64_t utxo_lookup) {
69211         LDKNetworkGraph this_arg_conv;
69212         this_arg_conv.inner = untag_ptr(this_arg);
69213         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69215         this_arg_conv.is_owned = false;
69216         LDKChannelAnnouncement msg_conv;
69217         msg_conv.inner = untag_ptr(msg);
69218         msg_conv.is_owned = ptr_is_owned(msg);
69219         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69220         msg_conv.is_owned = false;
69221         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
69222         CHECK_ACCESS(utxo_lookup_ptr);
69223         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
69224         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
69225         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
69226                 // Manually implement clone for Java trait instances
69227                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
69228                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69229                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
69230                 }
69231         }
69232         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69233         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
69234         return tag_ptr(ret_conv, true);
69235 }
69236
69237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1announcement_1no_1lookup(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
69238         LDKNetworkGraph this_arg_conv;
69239         this_arg_conv.inner = untag_ptr(this_arg);
69240         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69242         this_arg_conv.is_owned = false;
69243         LDKChannelAnnouncement msg_conv;
69244         msg_conv.inner = untag_ptr(msg);
69245         msg_conv.is_owned = ptr_is_owned(msg);
69246         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69247         msg_conv.is_owned = false;
69248         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69249         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
69250         return tag_ptr(ret_conv, true);
69251 }
69252
69253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1unsigned_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int64_t utxo_lookup) {
69254         LDKNetworkGraph this_arg_conv;
69255         this_arg_conv.inner = untag_ptr(this_arg);
69256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69258         this_arg_conv.is_owned = false;
69259         LDKUnsignedChannelAnnouncement msg_conv;
69260         msg_conv.inner = untag_ptr(msg);
69261         msg_conv.is_owned = ptr_is_owned(msg);
69262         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69263         msg_conv.is_owned = false;
69264         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
69265         CHECK_ACCESS(utxo_lookup_ptr);
69266         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
69267         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
69268         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
69269                 // Manually implement clone for Java trait instances
69270                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
69271                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69272                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
69273                 }
69274         }
69275         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69276         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
69277         return tag_ptr(ret_conv, true);
69278 }
69279
69280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1add_1channel_1from_1partial_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, int64_t timestamp, int64_t features, int8_tArray node_id_1, int8_tArray node_id_2) {
69281         LDKNetworkGraph this_arg_conv;
69282         this_arg_conv.inner = untag_ptr(this_arg);
69283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69285         this_arg_conv.is_owned = false;
69286         LDKChannelFeatures features_conv;
69287         features_conv.inner = untag_ptr(features);
69288         features_conv.is_owned = ptr_is_owned(features);
69289         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
69290         features_conv = ChannelFeatures_clone(&features_conv);
69291         LDKPublicKey node_id_1_ref;
69292         CHECK((*env)->GetArrayLength(env, node_id_1) == 33);
69293         (*env)->GetByteArrayRegion(env, node_id_1, 0, 33, node_id_1_ref.compressed_form);
69294         LDKPublicKey node_id_2_ref;
69295         CHECK((*env)->GetArrayLength(env, node_id_2) == 33);
69296         (*env)->GetByteArrayRegion(env, node_id_2, 0, 33, node_id_2_ref.compressed_form);
69297         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69298         *ret_conv = NetworkGraph_add_channel_from_partial_announcement(&this_arg_conv, short_channel_id, timestamp, features_conv, node_id_1_ref, node_id_2_ref);
69299         return tag_ptr(ret_conv, true);
69300 }
69301
69302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1channel_1failed_1permanent(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
69303         LDKNetworkGraph this_arg_conv;
69304         this_arg_conv.inner = untag_ptr(this_arg);
69305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69307         this_arg_conv.is_owned = false;
69308         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
69309 }
69310
69311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1node_1failed_1permanent(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray node_id) {
69312         LDKNetworkGraph this_arg_conv;
69313         this_arg_conv.inner = untag_ptr(this_arg);
69314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69316         this_arg_conv.is_owned = false;
69317         LDKPublicKey node_id_ref;
69318         CHECK((*env)->GetArrayLength(env, node_id) == 33);
69319         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
69320         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
69321 }
69322
69323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels_1and_1tracking(JNIEnv *env, jclass clz, int64_t this_arg) {
69324         LDKNetworkGraph this_arg_conv;
69325         this_arg_conv.inner = untag_ptr(this_arg);
69326         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69328         this_arg_conv.is_owned = false;
69329         NetworkGraph_remove_stale_channels_and_tracking(&this_arg_conv);
69330 }
69331
69332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels_1and_1tracking_1with_1time(JNIEnv *env, jclass clz, int64_t this_arg, int64_t current_time_unix) {
69333         LDKNetworkGraph this_arg_conv;
69334         this_arg_conv.inner = untag_ptr(this_arg);
69335         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69337         this_arg_conv.is_owned = false;
69338         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
69339 }
69340
69341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
69342         LDKNetworkGraph this_arg_conv;
69343         this_arg_conv.inner = untag_ptr(this_arg);
69344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69346         this_arg_conv.is_owned = false;
69347         LDKChannelUpdate msg_conv;
69348         msg_conv.inner = untag_ptr(msg);
69349         msg_conv.is_owned = ptr_is_owned(msg);
69350         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69351         msg_conv.is_owned = false;
69352         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69353         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
69354         return tag_ptr(ret_conv, true);
69355 }
69356
69357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
69358         LDKNetworkGraph this_arg_conv;
69359         this_arg_conv.inner = untag_ptr(this_arg);
69360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69362         this_arg_conv.is_owned = false;
69363         LDKUnsignedChannelUpdate msg_conv;
69364         msg_conv.inner = untag_ptr(msg);
69365         msg_conv.is_owned = ptr_is_owned(msg);
69366         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69367         msg_conv.is_owned = false;
69368         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69369         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
69370         return tag_ptr(ret_conv, true);
69371 }
69372
69373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1verify_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
69374         LDKNetworkGraph this_arg_conv;
69375         this_arg_conv.inner = untag_ptr(this_arg);
69376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69378         this_arg_conv.is_owned = false;
69379         LDKChannelUpdate msg_conv;
69380         msg_conv.inner = untag_ptr(msg);
69381         msg_conv.is_owned = ptr_is_owned(msg);
69382         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69383         msg_conv.is_owned = false;
69384         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69385         *ret_conv = NetworkGraph_verify_channel_update(&this_arg_conv, &msg_conv);
69386         return tag_ptr(ret_conv, true);
69387 }
69388
69389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
69390         LDKReadOnlyNetworkGraph this_arg_conv;
69391         this_arg_conv.inner = untag_ptr(this_arg);
69392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69394         this_arg_conv.is_owned = false;
69395         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
69396         int64_t ret_ref = 0;
69397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69399         return ret_ref;
69400 }
69401
69402 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
69403         LDKReadOnlyNetworkGraph this_arg_conv;
69404         this_arg_conv.inner = untag_ptr(this_arg);
69405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69407         this_arg_conv.is_owned = false;
69408         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
69409         int64_tArray ret_arr = NULL;
69410         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
69411         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
69412         for (size_t g = 0; g < ret_var.datalen; g++) {
69413                 int64_t ret_conv_6_conv = ret_var.data[g];
69414                 ret_arr_ptr[g] = ret_conv_6_conv;
69415         }
69416         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
69417         FREE(ret_var.data);
69418         return ret_arr;
69419 }
69420
69421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1node(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
69422         LDKReadOnlyNetworkGraph this_arg_conv;
69423         this_arg_conv.inner = untag_ptr(this_arg);
69424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69426         this_arg_conv.is_owned = false;
69427         LDKNodeId node_id_conv;
69428         node_id_conv.inner = untag_ptr(node_id);
69429         node_id_conv.is_owned = ptr_is_owned(node_id);
69430         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
69431         node_id_conv.is_owned = false;
69432         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
69433         int64_t ret_ref = 0;
69434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69436         return ret_ref;
69437 }
69438
69439 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1nodes(JNIEnv *env, jclass clz, int64_t this_arg) {
69440         LDKReadOnlyNetworkGraph this_arg_conv;
69441         this_arg_conv.inner = untag_ptr(this_arg);
69442         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69444         this_arg_conv.is_owned = false;
69445         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
69446         int64_tArray ret_arr = NULL;
69447         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
69448         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
69449         for (size_t i = 0; i < ret_var.datalen; i++) {
69450                 LDKNodeId ret_conv_8_var = ret_var.data[i];
69451                 int64_t ret_conv_8_ref = 0;
69452                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
69453                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
69454                 ret_arr_ptr[i] = ret_conv_8_ref;
69455         }
69456         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
69457         FREE(ret_var.data);
69458         return ret_arr;
69459 }
69460
69461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
69462         LDKReadOnlyNetworkGraph this_arg_conv;
69463         this_arg_conv.inner = untag_ptr(this_arg);
69464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69466         this_arg_conv.is_owned = false;
69467         LDKPublicKey pubkey_ref;
69468         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
69469         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
69470         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
69471         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
69472         int64_t ret_ref = tag_ptr(ret_copy, true);
69473         return ret_ref;
69474 }
69475
69476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69477         LDKDefaultRouter this_obj_conv;
69478         this_obj_conv.inner = untag_ptr(this_obj);
69479         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69481         DefaultRouter_free(this_obj_conv);
69482 }
69483
69484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger, int64_t entropy_source, int64_t scorer, int64_t score_params) {
69485         LDKNetworkGraph network_graph_conv;
69486         network_graph_conv.inner = untag_ptr(network_graph);
69487         network_graph_conv.is_owned = ptr_is_owned(network_graph);
69488         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
69489         network_graph_conv.is_owned = false;
69490         void* logger_ptr = untag_ptr(logger);
69491         CHECK_ACCESS(logger_ptr);
69492         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69493         if (logger_conv.free == LDKLogger_JCalls_free) {
69494                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69495                 LDKLogger_JCalls_cloned(&logger_conv);
69496         }
69497         void* entropy_source_ptr = untag_ptr(entropy_source);
69498         CHECK_ACCESS(entropy_source_ptr);
69499         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69500         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69501                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69502                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69503         }
69504         void* scorer_ptr = untag_ptr(scorer);
69505         CHECK_ACCESS(scorer_ptr);
69506         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
69507         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
69508                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69509                 LDKLockableScore_JCalls_cloned(&scorer_conv);
69510         }
69511         LDKProbabilisticScoringFeeParameters score_params_conv;
69512         score_params_conv.inner = untag_ptr(score_params);
69513         score_params_conv.is_owned = ptr_is_owned(score_params);
69514         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
69515         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
69516         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, entropy_source_conv, scorer_conv, score_params_conv);
69517         int64_t ret_ref = 0;
69518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69520         return ret_ref;
69521 }
69522
69523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
69524         LDKDefaultRouter this_arg_conv;
69525         this_arg_conv.inner = untag_ptr(this_arg);
69526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69528         this_arg_conv.is_owned = false;
69529         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
69530         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
69531         return tag_ptr(ret_ret, true);
69532 }
69533
69534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1MessageRouter(JNIEnv *env, jclass clz, int64_t this_arg) {
69535         LDKDefaultRouter this_arg_conv;
69536         this_arg_conv.inner = untag_ptr(this_arg);
69537         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69539         this_arg_conv.is_owned = false;
69540         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
69541         *ret_ret = DefaultRouter_as_MessageRouter(&this_arg_conv);
69542         return tag_ptr(ret_ret, true);
69543 }
69544
69545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69546         if (!ptr_is_owned(this_ptr)) return;
69547         void* this_ptr_ptr = untag_ptr(this_ptr);
69548         CHECK_ACCESS(this_ptr_ptr);
69549         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
69550         FREE(untag_ptr(this_ptr));
69551         Router_free(this_ptr_conv);
69552 }
69553
69554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69555         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
69556         this_obj_conv.inner = untag_ptr(this_obj);
69557         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69559         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
69560 }
69561
69562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1new(JNIEnv *env, jclass clz, int64_t scorer, int64_t inflight_htlcs) {
69563         void* scorer_ptr = untag_ptr(scorer);
69564         CHECK_ACCESS(scorer_ptr);
69565         LDKScoreLookUp scorer_conv = *(LDKScoreLookUp*)(scorer_ptr);
69566         if (scorer_conv.free == LDKScoreLookUp_JCalls_free) {
69567                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69568                 LDKScoreLookUp_JCalls_cloned(&scorer_conv);
69569         }
69570         LDKInFlightHtlcs inflight_htlcs_conv;
69571         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
69572         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
69573         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
69574         inflight_htlcs_conv.is_owned = false;
69575         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
69576         int64_t ret_ref = 0;
69577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69579         return ret_ref;
69580 }
69581
69582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
69583         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
69584         this_arg_conv.inner = untag_ptr(this_arg);
69585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69587         this_arg_conv.is_owned = false;
69588         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
69589         *ret_ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&this_arg_conv);
69590         return tag_ptr(ret_ret, true);
69591 }
69592
69593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69594         LDKInFlightHtlcs this_obj_conv;
69595         this_obj_conv.inner = untag_ptr(this_obj);
69596         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69598         InFlightHtlcs_free(this_obj_conv);
69599 }
69600
69601 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
69602         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
69603         int64_t ret_ref = 0;
69604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69606         return ret_ref;
69607 }
69608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69609         LDKInFlightHtlcs arg_conv;
69610         arg_conv.inner = untag_ptr(arg);
69611         arg_conv.is_owned = ptr_is_owned(arg);
69612         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69613         arg_conv.is_owned = false;
69614         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
69615         return ret_conv;
69616 }
69617
69618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69619         LDKInFlightHtlcs orig_conv;
69620         orig_conv.inner = untag_ptr(orig);
69621         orig_conv.is_owned = ptr_is_owned(orig);
69622         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69623         orig_conv.is_owned = false;
69624         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
69625         int64_t ret_ref = 0;
69626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69628         return ret_ref;
69629 }
69630
69631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1new(JNIEnv *env, jclass clz) {
69632         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
69633         int64_t ret_ref = 0;
69634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69636         return ret_ref;
69637 }
69638
69639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1process_1path(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path, int8_tArray payer_node_id) {
69640         LDKInFlightHtlcs this_arg_conv;
69641         this_arg_conv.inner = untag_ptr(this_arg);
69642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69644         this_arg_conv.is_owned = false;
69645         LDKPath path_conv;
69646         path_conv.inner = untag_ptr(path);
69647         path_conv.is_owned = ptr_is_owned(path);
69648         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
69649         path_conv.is_owned = false;
69650         LDKPublicKey payer_node_id_ref;
69651         CHECK((*env)->GetArrayLength(env, payer_node_id) == 33);
69652         (*env)->GetByteArrayRegion(env, payer_node_id, 0, 33, payer_node_id_ref.compressed_form);
69653         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
69654 }
69655
69656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1add_1inflight_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int64_t source, int64_t target, int64_t channel_scid, int64_t used_msat) {
69657         LDKInFlightHtlcs this_arg_conv;
69658         this_arg_conv.inner = untag_ptr(this_arg);
69659         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69661         this_arg_conv.is_owned = false;
69662         LDKNodeId source_conv;
69663         source_conv.inner = untag_ptr(source);
69664         source_conv.is_owned = ptr_is_owned(source);
69665         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
69666         source_conv.is_owned = false;
69667         LDKNodeId target_conv;
69668         target_conv.inner = untag_ptr(target);
69669         target_conv.is_owned = ptr_is_owned(target);
69670         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
69671         target_conv.is_owned = false;
69672         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
69673 }
69674
69675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1used_1liquidity_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t source, int64_t target, int64_t channel_scid) {
69676         LDKInFlightHtlcs this_arg_conv;
69677         this_arg_conv.inner = untag_ptr(this_arg);
69678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69680         this_arg_conv.is_owned = false;
69681         LDKNodeId source_conv;
69682         source_conv.inner = untag_ptr(source);
69683         source_conv.is_owned = ptr_is_owned(source);
69684         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
69685         source_conv.is_owned = false;
69686         LDKNodeId target_conv;
69687         target_conv.inner = untag_ptr(target);
69688         target_conv.is_owned = ptr_is_owned(target);
69689         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
69690         target_conv.is_owned = false;
69691         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
69692         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
69693         int64_t ret_ref = tag_ptr(ret_copy, true);
69694         return ret_ref;
69695 }
69696
69697 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1write(JNIEnv *env, jclass clz, int64_t obj) {
69698         LDKInFlightHtlcs obj_conv;
69699         obj_conv.inner = untag_ptr(obj);
69700         obj_conv.is_owned = ptr_is_owned(obj);
69701         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69702         obj_conv.is_owned = false;
69703         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
69704         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69705         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69706         CVec_u8Z_free(ret_var);
69707         return ret_arr;
69708 }
69709
69710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
69711         LDKu8slice ser_ref;
69712         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69713         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69714         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
69715         *ret_conv = InFlightHtlcs_read(ser_ref);
69716         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69717         return tag_ptr(ret_conv, true);
69718 }
69719
69720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69721         LDKRouteHop this_obj_conv;
69722         this_obj_conv.inner = untag_ptr(this_obj);
69723         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69725         RouteHop_free(this_obj_conv);
69726 }
69727
69728 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
69729         LDKRouteHop this_ptr_conv;
69730         this_ptr_conv.inner = untag_ptr(this_ptr);
69731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69733         this_ptr_conv.is_owned = false;
69734         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
69735         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
69736         return ret_arr;
69737 }
69738
69739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69740         LDKRouteHop this_ptr_conv;
69741         this_ptr_conv.inner = untag_ptr(this_ptr);
69742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69744         this_ptr_conv.is_owned = false;
69745         LDKPublicKey val_ref;
69746         CHECK((*env)->GetArrayLength(env, val) == 33);
69747         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
69748         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
69749 }
69750
69751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
69752         LDKRouteHop this_ptr_conv;
69753         this_ptr_conv.inner = untag_ptr(this_ptr);
69754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69756         this_ptr_conv.is_owned = false;
69757         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
69758         int64_t ret_ref = 0;
69759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69761         return ret_ref;
69762 }
69763
69764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69765         LDKRouteHop this_ptr_conv;
69766         this_ptr_conv.inner = untag_ptr(this_ptr);
69767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69769         this_ptr_conv.is_owned = false;
69770         LDKNodeFeatures val_conv;
69771         val_conv.inner = untag_ptr(val);
69772         val_conv.is_owned = ptr_is_owned(val);
69773         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69774         val_conv = NodeFeatures_clone(&val_conv);
69775         RouteHop_set_node_features(&this_ptr_conv, val_conv);
69776 }
69777
69778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
69779         LDKRouteHop this_ptr_conv;
69780         this_ptr_conv.inner = untag_ptr(this_ptr);
69781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69783         this_ptr_conv.is_owned = false;
69784         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
69785         return ret_conv;
69786 }
69787
69788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69789         LDKRouteHop this_ptr_conv;
69790         this_ptr_conv.inner = untag_ptr(this_ptr);
69791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69793         this_ptr_conv.is_owned = false;
69794         RouteHop_set_short_channel_id(&this_ptr_conv, val);
69795 }
69796
69797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
69798         LDKRouteHop this_ptr_conv;
69799         this_ptr_conv.inner = untag_ptr(this_ptr);
69800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69802         this_ptr_conv.is_owned = false;
69803         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
69804         int64_t ret_ref = 0;
69805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69807         return ret_ref;
69808 }
69809
69810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69811         LDKRouteHop this_ptr_conv;
69812         this_ptr_conv.inner = untag_ptr(this_ptr);
69813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69815         this_ptr_conv.is_owned = false;
69816         LDKChannelFeatures val_conv;
69817         val_conv.inner = untag_ptr(val);
69818         val_conv.is_owned = ptr_is_owned(val);
69819         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
69820         val_conv = ChannelFeatures_clone(&val_conv);
69821         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
69822 }
69823
69824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
69825         LDKRouteHop this_ptr_conv;
69826         this_ptr_conv.inner = untag_ptr(this_ptr);
69827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69829         this_ptr_conv.is_owned = false;
69830         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
69831         return ret_conv;
69832 }
69833
69834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69835         LDKRouteHop this_ptr_conv;
69836         this_ptr_conv.inner = untag_ptr(this_ptr);
69837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69839         this_ptr_conv.is_owned = false;
69840         RouteHop_set_fee_msat(&this_ptr_conv, val);
69841 }
69842
69843 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
69844         LDKRouteHop this_ptr_conv;
69845         this_ptr_conv.inner = untag_ptr(this_ptr);
69846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69848         this_ptr_conv.is_owned = false;
69849         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
69850         return ret_conv;
69851 }
69852
69853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
69854         LDKRouteHop this_ptr_conv;
69855         this_ptr_conv.inner = untag_ptr(this_ptr);
69856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69858         this_ptr_conv.is_owned = false;
69859         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
69860 }
69861
69862 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1maybe_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
69863         LDKRouteHop this_ptr_conv;
69864         this_ptr_conv.inner = untag_ptr(this_ptr);
69865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69867         this_ptr_conv.is_owned = false;
69868         jboolean ret_conv = RouteHop_get_maybe_announced_channel(&this_ptr_conv);
69869         return ret_conv;
69870 }
69871
69872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1maybe_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
69873         LDKRouteHop this_ptr_conv;
69874         this_ptr_conv.inner = untag_ptr(this_ptr);
69875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69877         this_ptr_conv.is_owned = false;
69878         RouteHop_set_maybe_announced_channel(&this_ptr_conv, val);
69879 }
69880
69881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1new(JNIEnv *env, jclass clz, int8_tArray pubkey_arg, int64_t node_features_arg, int64_t short_channel_id_arg, int64_t channel_features_arg, int64_t fee_msat_arg, int32_t cltv_expiry_delta_arg, jboolean maybe_announced_channel_arg) {
69882         LDKPublicKey pubkey_arg_ref;
69883         CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
69884         (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
69885         LDKNodeFeatures node_features_arg_conv;
69886         node_features_arg_conv.inner = untag_ptr(node_features_arg);
69887         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
69888         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
69889         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
69890         LDKChannelFeatures channel_features_arg_conv;
69891         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
69892         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
69893         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
69894         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
69895         LDKRouteHop ret_var = RouteHop_new(pubkey_arg_ref, node_features_arg_conv, short_channel_id_arg, channel_features_arg_conv, fee_msat_arg, cltv_expiry_delta_arg, maybe_announced_channel_arg);
69896         int64_t ret_ref = 0;
69897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69899         return ret_ref;
69900 }
69901
69902 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
69903         LDKRouteHop ret_var = RouteHop_clone(arg);
69904         int64_t ret_ref = 0;
69905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69907         return ret_ref;
69908 }
69909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69910         LDKRouteHop arg_conv;
69911         arg_conv.inner = untag_ptr(arg);
69912         arg_conv.is_owned = ptr_is_owned(arg);
69913         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69914         arg_conv.is_owned = false;
69915         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
69916         return ret_conv;
69917 }
69918
69919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69920         LDKRouteHop orig_conv;
69921         orig_conv.inner = untag_ptr(orig);
69922         orig_conv.is_owned = ptr_is_owned(orig);
69923         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69924         orig_conv.is_owned = false;
69925         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
69926         int64_t ret_ref = 0;
69927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69929         return ret_ref;
69930 }
69931
69932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
69933         LDKRouteHop o_conv;
69934         o_conv.inner = untag_ptr(o);
69935         o_conv.is_owned = ptr_is_owned(o);
69936         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69937         o_conv.is_owned = false;
69938         int64_t ret_conv = RouteHop_hash(&o_conv);
69939         return ret_conv;
69940 }
69941
69942 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69943         LDKRouteHop a_conv;
69944         a_conv.inner = untag_ptr(a);
69945         a_conv.is_owned = ptr_is_owned(a);
69946         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69947         a_conv.is_owned = false;
69948         LDKRouteHop b_conv;
69949         b_conv.inner = untag_ptr(b);
69950         b_conv.is_owned = ptr_is_owned(b);
69951         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69952         b_conv.is_owned = false;
69953         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
69954         return ret_conv;
69955 }
69956
69957 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
69958         LDKRouteHop obj_conv;
69959         obj_conv.inner = untag_ptr(obj);
69960         obj_conv.is_owned = ptr_is_owned(obj);
69961         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69962         obj_conv.is_owned = false;
69963         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
69964         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69965         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69966         CVec_u8Z_free(ret_var);
69967         return ret_arr;
69968 }
69969
69970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
69971         LDKu8slice ser_ref;
69972         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69973         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69974         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
69975         *ret_conv = RouteHop_read(ser_ref);
69976         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69977         return tag_ptr(ret_conv, true);
69978 }
69979
69980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69981         LDKBlindedTail this_obj_conv;
69982         this_obj_conv.inner = untag_ptr(this_obj);
69983         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69985         BlindedTail_free(this_obj_conv);
69986 }
69987
69988 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
69989         LDKBlindedTail this_ptr_conv;
69990         this_ptr_conv.inner = untag_ptr(this_ptr);
69991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69993         this_ptr_conv.is_owned = false;
69994         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
69995         int64_tArray ret_arr = NULL;
69996         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
69997         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
69998         for (size_t m = 0; m < ret_var.datalen; m++) {
69999                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
70000                 int64_t ret_conv_12_ref = 0;
70001                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
70002                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
70003                 ret_arr_ptr[m] = ret_conv_12_ref;
70004         }
70005         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
70006         FREE(ret_var.data);
70007         return ret_arr;
70008 }
70009
70010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
70011         LDKBlindedTail this_ptr_conv;
70012         this_ptr_conv.inner = untag_ptr(this_ptr);
70013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70015         this_ptr_conv.is_owned = false;
70016         LDKCVec_BlindedHopZ val_constr;
70017         val_constr.datalen = (*env)->GetArrayLength(env, val);
70018         if (val_constr.datalen > 0)
70019                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
70020         else
70021                 val_constr.data = NULL;
70022         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
70023         for (size_t m = 0; m < val_constr.datalen; m++) {
70024                 int64_t val_conv_12 = val_vals[m];
70025                 LDKBlindedHop val_conv_12_conv;
70026                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
70027                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
70028                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
70029                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
70030                 val_constr.data[m] = val_conv_12_conv;
70031         }
70032         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
70033         BlindedTail_set_hops(&this_ptr_conv, val_constr);
70034 }
70035
70036 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
70037         LDKBlindedTail this_ptr_conv;
70038         this_ptr_conv.inner = untag_ptr(this_ptr);
70039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70041         this_ptr_conv.is_owned = false;
70042         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
70043         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form);
70044         return ret_arr;
70045 }
70046
70047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
70048         LDKBlindedTail this_ptr_conv;
70049         this_ptr_conv.inner = untag_ptr(this_ptr);
70050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70052         this_ptr_conv.is_owned = false;
70053         LDKPublicKey val_ref;
70054         CHECK((*env)->GetArrayLength(env, val) == 33);
70055         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
70056         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
70057 }
70058
70059 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1excess_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
70060         LDKBlindedTail this_ptr_conv;
70061         this_ptr_conv.inner = untag_ptr(this_ptr);
70062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70064         this_ptr_conv.is_owned = false;
70065         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
70066         return ret_conv;
70067 }
70068
70069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1excess_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
70070         LDKBlindedTail this_ptr_conv;
70071         this_ptr_conv.inner = untag_ptr(this_ptr);
70072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70074         this_ptr_conv.is_owned = false;
70075         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
70076 }
70077
70078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
70079         LDKBlindedTail this_ptr_conv;
70080         this_ptr_conv.inner = untag_ptr(this_ptr);
70081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70083         this_ptr_conv.is_owned = false;
70084         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
70085         return ret_conv;
70086 }
70087
70088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70089         LDKBlindedTail this_ptr_conv;
70090         this_ptr_conv.inner = untag_ptr(this_ptr);
70091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70093         this_ptr_conv.is_owned = false;
70094         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
70095 }
70096
70097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1new(JNIEnv *env, jclass clz, int64_tArray hops_arg, int8_tArray blinding_point_arg, int32_t excess_final_cltv_expiry_delta_arg, int64_t final_value_msat_arg) {
70098         LDKCVec_BlindedHopZ hops_arg_constr;
70099         hops_arg_constr.datalen = (*env)->GetArrayLength(env, hops_arg);
70100         if (hops_arg_constr.datalen > 0)
70101                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
70102         else
70103                 hops_arg_constr.data = NULL;
70104         int64_t* hops_arg_vals = (*env)->GetLongArrayElements (env, hops_arg, NULL);
70105         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
70106                 int64_t hops_arg_conv_12 = hops_arg_vals[m];
70107                 LDKBlindedHop hops_arg_conv_12_conv;
70108                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
70109                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
70110                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
70111                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
70112                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
70113         }
70114         (*env)->ReleaseLongArrayElements(env, hops_arg, hops_arg_vals, 0);
70115         LDKPublicKey blinding_point_arg_ref;
70116         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
70117         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
70118         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
70119         int64_t ret_ref = 0;
70120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70122         return ret_ref;
70123 }
70124
70125 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
70126         LDKBlindedTail ret_var = BlindedTail_clone(arg);
70127         int64_t ret_ref = 0;
70128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70130         return ret_ref;
70131 }
70132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70133         LDKBlindedTail arg_conv;
70134         arg_conv.inner = untag_ptr(arg);
70135         arg_conv.is_owned = ptr_is_owned(arg);
70136         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70137         arg_conv.is_owned = false;
70138         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
70139         return ret_conv;
70140 }
70141
70142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70143         LDKBlindedTail orig_conv;
70144         orig_conv.inner = untag_ptr(orig);
70145         orig_conv.is_owned = ptr_is_owned(orig);
70146         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70147         orig_conv.is_owned = false;
70148         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
70149         int64_t ret_ref = 0;
70150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70152         return ret_ref;
70153 }
70154
70155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1hash(JNIEnv *env, jclass clz, int64_t o) {
70156         LDKBlindedTail o_conv;
70157         o_conv.inner = untag_ptr(o);
70158         o_conv.is_owned = ptr_is_owned(o);
70159         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70160         o_conv.is_owned = false;
70161         int64_t ret_conv = BlindedTail_hash(&o_conv);
70162         return ret_conv;
70163 }
70164
70165 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedTail_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70166         LDKBlindedTail a_conv;
70167         a_conv.inner = untag_ptr(a);
70168         a_conv.is_owned = ptr_is_owned(a);
70169         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70170         a_conv.is_owned = false;
70171         LDKBlindedTail b_conv;
70172         b_conv.inner = untag_ptr(b);
70173         b_conv.is_owned = ptr_is_owned(b);
70174         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70175         b_conv.is_owned = false;
70176         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
70177         return ret_conv;
70178 }
70179
70180 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1write(JNIEnv *env, jclass clz, int64_t obj) {
70181         LDKBlindedTail obj_conv;
70182         obj_conv.inner = untag_ptr(obj);
70183         obj_conv.is_owned = ptr_is_owned(obj);
70184         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70185         obj_conv.is_owned = false;
70186         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
70187         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70188         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70189         CVec_u8Z_free(ret_var);
70190         return ret_arr;
70191 }
70192
70193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70194         LDKu8slice ser_ref;
70195         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70196         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70197         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
70198         *ret_conv = BlindedTail_read(ser_ref);
70199         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70200         return tag_ptr(ret_conv, true);
70201 }
70202
70203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70204         LDKPath this_obj_conv;
70205         this_obj_conv.inner = untag_ptr(this_obj);
70206         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70208         Path_free(this_obj_conv);
70209 }
70210
70211 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Path_1get_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
70212         LDKPath this_ptr_conv;
70213         this_ptr_conv.inner = untag_ptr(this_ptr);
70214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70216         this_ptr_conv.is_owned = false;
70217         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
70218         int64_tArray ret_arr = NULL;
70219         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
70220         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
70221         for (size_t k = 0; k < ret_var.datalen; k++) {
70222                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
70223                 int64_t ret_conv_10_ref = 0;
70224                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
70225                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
70226                 ret_arr_ptr[k] = ret_conv_10_ref;
70227         }
70228         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
70229         FREE(ret_var.data);
70230         return ret_arr;
70231 }
70232
70233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1set_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
70234         LDKPath this_ptr_conv;
70235         this_ptr_conv.inner = untag_ptr(this_ptr);
70236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70238         this_ptr_conv.is_owned = false;
70239         LDKCVec_RouteHopZ val_constr;
70240         val_constr.datalen = (*env)->GetArrayLength(env, val);
70241         if (val_constr.datalen > 0)
70242                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
70243         else
70244                 val_constr.data = NULL;
70245         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
70246         for (size_t k = 0; k < val_constr.datalen; k++) {
70247                 int64_t val_conv_10 = val_vals[k];
70248                 LDKRouteHop val_conv_10_conv;
70249                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
70250                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
70251                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
70252                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
70253                 val_constr.data[k] = val_conv_10_conv;
70254         }
70255         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
70256         Path_set_hops(&this_ptr_conv, val_constr);
70257 }
70258
70259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1get_1blinded_1tail(JNIEnv *env, jclass clz, int64_t this_ptr) {
70260         LDKPath this_ptr_conv;
70261         this_ptr_conv.inner = untag_ptr(this_ptr);
70262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70264         this_ptr_conv.is_owned = false;
70265         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
70266         int64_t ret_ref = 0;
70267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70269         return ret_ref;
70270 }
70271
70272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1set_1blinded_1tail(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70273         LDKPath this_ptr_conv;
70274         this_ptr_conv.inner = untag_ptr(this_ptr);
70275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70277         this_ptr_conv.is_owned = false;
70278         LDKBlindedTail val_conv;
70279         val_conv.inner = untag_ptr(val);
70280         val_conv.is_owned = ptr_is_owned(val);
70281         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70282         val_conv = BlindedTail_clone(&val_conv);
70283         Path_set_blinded_tail(&this_ptr_conv, val_conv);
70284 }
70285
70286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1new(JNIEnv *env, jclass clz, int64_tArray hops_arg, int64_t blinded_tail_arg) {
70287         LDKCVec_RouteHopZ hops_arg_constr;
70288         hops_arg_constr.datalen = (*env)->GetArrayLength(env, hops_arg);
70289         if (hops_arg_constr.datalen > 0)
70290                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
70291         else
70292                 hops_arg_constr.data = NULL;
70293         int64_t* hops_arg_vals = (*env)->GetLongArrayElements (env, hops_arg, NULL);
70294         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
70295                 int64_t hops_arg_conv_10 = hops_arg_vals[k];
70296                 LDKRouteHop hops_arg_conv_10_conv;
70297                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
70298                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
70299                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
70300                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
70301                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
70302         }
70303         (*env)->ReleaseLongArrayElements(env, hops_arg, hops_arg_vals, 0);
70304         LDKBlindedTail blinded_tail_arg_conv;
70305         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
70306         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
70307         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
70308         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
70309         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
70310         int64_t ret_ref = 0;
70311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70313         return ret_ref;
70314 }
70315
70316 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
70317         LDKPath ret_var = Path_clone(arg);
70318         int64_t ret_ref = 0;
70319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70321         return ret_ref;
70322 }
70323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70324         LDKPath arg_conv;
70325         arg_conv.inner = untag_ptr(arg);
70326         arg_conv.is_owned = ptr_is_owned(arg);
70327         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70328         arg_conv.is_owned = false;
70329         int64_t ret_conv = Path_clone_ptr(&arg_conv);
70330         return ret_conv;
70331 }
70332
70333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70334         LDKPath orig_conv;
70335         orig_conv.inner = untag_ptr(orig);
70336         orig_conv.is_owned = ptr_is_owned(orig);
70337         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70338         orig_conv.is_owned = false;
70339         LDKPath ret_var = Path_clone(&orig_conv);
70340         int64_t ret_ref = 0;
70341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70343         return ret_ref;
70344 }
70345
70346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1hash(JNIEnv *env, jclass clz, int64_t o) {
70347         LDKPath o_conv;
70348         o_conv.inner = untag_ptr(o);
70349         o_conv.is_owned = ptr_is_owned(o);
70350         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70351         o_conv.is_owned = false;
70352         int64_t ret_conv = Path_hash(&o_conv);
70353         return ret_conv;
70354 }
70355
70356 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Path_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70357         LDKPath a_conv;
70358         a_conv.inner = untag_ptr(a);
70359         a_conv.is_owned = ptr_is_owned(a);
70360         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70361         a_conv.is_owned = false;
70362         LDKPath b_conv;
70363         b_conv.inner = untag_ptr(b);
70364         b_conv.is_owned = ptr_is_owned(b);
70365         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70366         b_conv.is_owned = false;
70367         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
70368         return ret_conv;
70369 }
70370
70371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
70372         LDKPath this_arg_conv;
70373         this_arg_conv.inner = untag_ptr(this_arg);
70374         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70376         this_arg_conv.is_owned = false;
70377         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
70378         return ret_conv;
70379 }
70380
70381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
70382         LDKPath this_arg_conv;
70383         this_arg_conv.inner = untag_ptr(this_arg);
70384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70386         this_arg_conv.is_owned = false;
70387         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
70388         return ret_conv;
70389 }
70390
70391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
70392         LDKPath this_arg_conv;
70393         this_arg_conv.inner = untag_ptr(this_arg);
70394         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70396         this_arg_conv.is_owned = false;
70397         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
70398         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
70399         int64_t ret_ref = tag_ptr(ret_copy, true);
70400         return ret_ref;
70401 }
70402
70403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70404         LDKRoute this_obj_conv;
70405         this_obj_conv.inner = untag_ptr(this_obj);
70406         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70408         Route_free(this_obj_conv);
70409 }
70410
70411 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
70412         LDKRoute this_ptr_conv;
70413         this_ptr_conv.inner = untag_ptr(this_ptr);
70414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70416         this_ptr_conv.is_owned = false;
70417         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
70418         int64_tArray ret_arr = NULL;
70419         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
70420         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
70421         for (size_t g = 0; g < ret_var.datalen; g++) {
70422                 LDKPath ret_conv_6_var = ret_var.data[g];
70423                 int64_t ret_conv_6_ref = 0;
70424                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
70425                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
70426                 ret_arr_ptr[g] = ret_conv_6_ref;
70427         }
70428         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
70429         FREE(ret_var.data);
70430         return ret_arr;
70431 }
70432
70433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
70434         LDKRoute this_ptr_conv;
70435         this_ptr_conv.inner = untag_ptr(this_ptr);
70436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70438         this_ptr_conv.is_owned = false;
70439         LDKCVec_PathZ val_constr;
70440         val_constr.datalen = (*env)->GetArrayLength(env, val);
70441         if (val_constr.datalen > 0)
70442                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
70443         else
70444                 val_constr.data = NULL;
70445         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
70446         for (size_t g = 0; g < val_constr.datalen; g++) {
70447                 int64_t val_conv_6 = val_vals[g];
70448                 LDKPath val_conv_6_conv;
70449                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
70450                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
70451                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
70452                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
70453                 val_constr.data[g] = val_conv_6_conv;
70454         }
70455         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
70456         Route_set_paths(&this_ptr_conv, val_constr);
70457 }
70458
70459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1route_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
70460         LDKRoute this_ptr_conv;
70461         this_ptr_conv.inner = untag_ptr(this_ptr);
70462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70464         this_ptr_conv.is_owned = false;
70465         LDKRouteParameters ret_var = Route_get_route_params(&this_ptr_conv);
70466         int64_t ret_ref = 0;
70467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70469         return ret_ref;
70470 }
70471
70472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1route_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70473         LDKRoute this_ptr_conv;
70474         this_ptr_conv.inner = untag_ptr(this_ptr);
70475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70477         this_ptr_conv.is_owned = false;
70478         LDKRouteParameters val_conv;
70479         val_conv.inner = untag_ptr(val);
70480         val_conv.is_owned = ptr_is_owned(val);
70481         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70482         val_conv = RouteParameters_clone(&val_conv);
70483         Route_set_route_params(&this_ptr_conv, val_conv);
70484 }
70485
70486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, int64_tArray paths_arg, int64_t route_params_arg) {
70487         LDKCVec_PathZ paths_arg_constr;
70488         paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
70489         if (paths_arg_constr.datalen > 0)
70490                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
70491         else
70492                 paths_arg_constr.data = NULL;
70493         int64_t* paths_arg_vals = (*env)->GetLongArrayElements (env, paths_arg, NULL);
70494         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
70495                 int64_t paths_arg_conv_6 = paths_arg_vals[g];
70496                 LDKPath paths_arg_conv_6_conv;
70497                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
70498                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
70499                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
70500                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
70501                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
70502         }
70503         (*env)->ReleaseLongArrayElements(env, paths_arg, paths_arg_vals, 0);
70504         LDKRouteParameters route_params_arg_conv;
70505         route_params_arg_conv.inner = untag_ptr(route_params_arg);
70506         route_params_arg_conv.is_owned = ptr_is_owned(route_params_arg);
70507         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_arg_conv);
70508         route_params_arg_conv = RouteParameters_clone(&route_params_arg_conv);
70509         LDKRoute ret_var = Route_new(paths_arg_constr, route_params_arg_conv);
70510         int64_t ret_ref = 0;
70511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70513         return ret_ref;
70514 }
70515
70516 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
70517         LDKRoute ret_var = Route_clone(arg);
70518         int64_t ret_ref = 0;
70519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70521         return ret_ref;
70522 }
70523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70524         LDKRoute arg_conv;
70525         arg_conv.inner = untag_ptr(arg);
70526         arg_conv.is_owned = ptr_is_owned(arg);
70527         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70528         arg_conv.is_owned = false;
70529         int64_t ret_conv = Route_clone_ptr(&arg_conv);
70530         return ret_conv;
70531 }
70532
70533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70534         LDKRoute orig_conv;
70535         orig_conv.inner = untag_ptr(orig);
70536         orig_conv.is_owned = ptr_is_owned(orig);
70537         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70538         orig_conv.is_owned = false;
70539         LDKRoute ret_var = Route_clone(&orig_conv);
70540         int64_t ret_ref = 0;
70541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70543         return ret_ref;
70544 }
70545
70546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
70547         LDKRoute o_conv;
70548         o_conv.inner = untag_ptr(o);
70549         o_conv.is_owned = ptr_is_owned(o);
70550         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70551         o_conv.is_owned = false;
70552         int64_t ret_conv = Route_hash(&o_conv);
70553         return ret_conv;
70554 }
70555
70556 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70557         LDKRoute a_conv;
70558         a_conv.inner = untag_ptr(a);
70559         a_conv.is_owned = ptr_is_owned(a);
70560         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70561         a_conv.is_owned = false;
70562         LDKRoute b_conv;
70563         b_conv.inner = untag_ptr(b);
70564         b_conv.is_owned = ptr_is_owned(b);
70565         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70566         b_conv.is_owned = false;
70567         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
70568         return ret_conv;
70569 }
70570
70571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
70572         LDKRoute this_arg_conv;
70573         this_arg_conv.inner = untag_ptr(this_arg);
70574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70576         this_arg_conv.is_owned = false;
70577         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
70578         return ret_conv;
70579 }
70580
70581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
70582         LDKRoute this_arg_conv;
70583         this_arg_conv.inner = untag_ptr(this_arg);
70584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70586         this_arg_conv.is_owned = false;
70587         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
70588         return ret_conv;
70589 }
70590
70591 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
70592         LDKRoute obj_conv;
70593         obj_conv.inner = untag_ptr(obj);
70594         obj_conv.is_owned = ptr_is_owned(obj);
70595         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70596         obj_conv.is_owned = false;
70597         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
70598         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70599         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70600         CVec_u8Z_free(ret_var);
70601         return ret_arr;
70602 }
70603
70604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70605         LDKu8slice ser_ref;
70606         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70607         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70608         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
70609         *ret_conv = Route_read(ser_ref);
70610         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70611         return tag_ptr(ret_conv, true);
70612 }
70613
70614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70615         LDKRouteParameters this_obj_conv;
70616         this_obj_conv.inner = untag_ptr(this_obj);
70617         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70619         RouteParameters_free(this_obj_conv);
70620 }
70621
70622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
70623         LDKRouteParameters this_ptr_conv;
70624         this_ptr_conv.inner = untag_ptr(this_ptr);
70625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70627         this_ptr_conv.is_owned = false;
70628         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
70629         int64_t ret_ref = 0;
70630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70632         return ret_ref;
70633 }
70634
70635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70636         LDKRouteParameters this_ptr_conv;
70637         this_ptr_conv.inner = untag_ptr(this_ptr);
70638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70640         this_ptr_conv.is_owned = false;
70641         LDKPaymentParameters val_conv;
70642         val_conv.inner = untag_ptr(val);
70643         val_conv.is_owned = ptr_is_owned(val);
70644         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70645         val_conv = PaymentParameters_clone(&val_conv);
70646         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
70647 }
70648
70649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
70650         LDKRouteParameters this_ptr_conv;
70651         this_ptr_conv.inner = untag_ptr(this_ptr);
70652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70654         this_ptr_conv.is_owned = false;
70655         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
70656         return ret_conv;
70657 }
70658
70659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70660         LDKRouteParameters this_ptr_conv;
70661         this_ptr_conv.inner = untag_ptr(this_ptr);
70662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70664         this_ptr_conv.is_owned = false;
70665         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
70666 }
70667
70668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1max_1total_1routing_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
70669         LDKRouteParameters this_ptr_conv;
70670         this_ptr_conv.inner = untag_ptr(this_ptr);
70671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70673         this_ptr_conv.is_owned = false;
70674         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
70675         *ret_copy = RouteParameters_get_max_total_routing_fee_msat(&this_ptr_conv);
70676         int64_t ret_ref = tag_ptr(ret_copy, true);
70677         return ret_ref;
70678 }
70679
70680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1max_1total_1routing_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70681         LDKRouteParameters this_ptr_conv;
70682         this_ptr_conv.inner = untag_ptr(this_ptr);
70683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70685         this_ptr_conv.is_owned = false;
70686         void* val_ptr = untag_ptr(val);
70687         CHECK_ACCESS(val_ptr);
70688         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
70689         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
70690         RouteParameters_set_max_total_routing_fee_msat(&this_ptr_conv, val_conv);
70691 }
70692
70693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1new(JNIEnv *env, jclass clz, int64_t payment_params_arg, int64_t final_value_msat_arg, int64_t max_total_routing_fee_msat_arg) {
70694         LDKPaymentParameters payment_params_arg_conv;
70695         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
70696         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
70697         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
70698         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
70699         void* max_total_routing_fee_msat_arg_ptr = untag_ptr(max_total_routing_fee_msat_arg);
70700         CHECK_ACCESS(max_total_routing_fee_msat_arg_ptr);
70701         LDKCOption_u64Z max_total_routing_fee_msat_arg_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_arg_ptr);
70702         max_total_routing_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat_arg));
70703         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, max_total_routing_fee_msat_arg_conv);
70704         int64_t ret_ref = 0;
70705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70707         return ret_ref;
70708 }
70709
70710 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
70711         LDKRouteParameters ret_var = RouteParameters_clone(arg);
70712         int64_t ret_ref = 0;
70713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70715         return ret_ref;
70716 }
70717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70718         LDKRouteParameters arg_conv;
70719         arg_conv.inner = untag_ptr(arg);
70720         arg_conv.is_owned = ptr_is_owned(arg);
70721         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70722         arg_conv.is_owned = false;
70723         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
70724         return ret_conv;
70725 }
70726
70727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70728         LDKRouteParameters orig_conv;
70729         orig_conv.inner = untag_ptr(orig);
70730         orig_conv.is_owned = ptr_is_owned(orig);
70731         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70732         orig_conv.is_owned = false;
70733         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
70734         int64_t ret_ref = 0;
70735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70737         return ret_ref;
70738 }
70739
70740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
70741         LDKRouteParameters o_conv;
70742         o_conv.inner = untag_ptr(o);
70743         o_conv.is_owned = ptr_is_owned(o);
70744         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70745         o_conv.is_owned = false;
70746         int64_t ret_conv = RouteParameters_hash(&o_conv);
70747         return ret_conv;
70748 }
70749
70750 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
70751         LDKRouteParameters a_conv;
70752         a_conv.inner = untag_ptr(a);
70753         a_conv.is_owned = ptr_is_owned(a);
70754         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70755         a_conv.is_owned = false;
70756         LDKRouteParameters b_conv;
70757         b_conv.inner = untag_ptr(b);
70758         b_conv.is_owned = ptr_is_owned(b);
70759         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70760         b_conv.is_owned = false;
70761         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
70762         return ret_conv;
70763 }
70764
70765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1from_1payment_1params_1and_1value(JNIEnv *env, jclass clz, int64_t payment_params, int64_t final_value_msat) {
70766         LDKPaymentParameters payment_params_conv;
70767         payment_params_conv.inner = untag_ptr(payment_params);
70768         payment_params_conv.is_owned = ptr_is_owned(payment_params);
70769         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_conv);
70770         payment_params_conv = PaymentParameters_clone(&payment_params_conv);
70771         LDKRouteParameters ret_var = RouteParameters_from_payment_params_and_value(payment_params_conv, final_value_msat);
70772         int64_t ret_ref = 0;
70773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70775         return ret_ref;
70776 }
70777
70778 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
70779         LDKRouteParameters obj_conv;
70780         obj_conv.inner = untag_ptr(obj);
70781         obj_conv.is_owned = ptr_is_owned(obj);
70782         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70783         obj_conv.is_owned = false;
70784         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
70785         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70786         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70787         CVec_u8Z_free(ret_var);
70788         return ret_arr;
70789 }
70790
70791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
70792         LDKu8slice ser_ref;
70793         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
70794         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
70795         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
70796         *ret_conv = RouteParameters_read(ser_ref);
70797         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
70798         return tag_ptr(ret_conv, true);
70799 }
70800
70801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70802         LDKPaymentParameters this_obj_conv;
70803         this_obj_conv.inner = untag_ptr(this_obj);
70804         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70806         PaymentParameters_free(this_obj_conv);
70807 }
70808
70809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee(JNIEnv *env, jclass clz, int64_t this_ptr) {
70810         LDKPaymentParameters this_ptr_conv;
70811         this_ptr_conv.inner = untag_ptr(this_ptr);
70812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70814         this_ptr_conv.is_owned = false;
70815         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
70816         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
70817         int64_t ret_ref = tag_ptr(ret_copy, true);
70818         return ret_ref;
70819 }
70820
70821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70822         LDKPaymentParameters this_ptr_conv;
70823         this_ptr_conv.inner = untag_ptr(this_ptr);
70824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70826         this_ptr_conv.is_owned = false;
70827         void* val_ptr = untag_ptr(val);
70828         CHECK_ACCESS(val_ptr);
70829         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
70830         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
70831         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
70832 }
70833
70834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
70835         LDKPaymentParameters this_ptr_conv;
70836         this_ptr_conv.inner = untag_ptr(this_ptr);
70837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70839         this_ptr_conv.is_owned = false;
70840         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
70841         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
70842         int64_t ret_ref = tag_ptr(ret_copy, true);
70843         return ret_ref;
70844 }
70845
70846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
70847         LDKPaymentParameters this_ptr_conv;
70848         this_ptr_conv.inner = untag_ptr(this_ptr);
70849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70851         this_ptr_conv.is_owned = false;
70852         void* val_ptr = untag_ptr(val);
70853         CHECK_ACCESS(val_ptr);
70854         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
70855         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
70856         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
70857 }
70858
70859 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
70860         LDKPaymentParameters this_ptr_conv;
70861         this_ptr_conv.inner = untag_ptr(this_ptr);
70862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70864         this_ptr_conv.is_owned = false;
70865         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
70866         return ret_conv;
70867 }
70868
70869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
70870         LDKPaymentParameters this_ptr_conv;
70871         this_ptr_conv.inner = untag_ptr(this_ptr);
70872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70874         this_ptr_conv.is_owned = false;
70875         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
70876 }
70877
70878 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr) {
70879         LDKPaymentParameters this_ptr_conv;
70880         this_ptr_conv.inner = untag_ptr(this_ptr);
70881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70883         this_ptr_conv.is_owned = false;
70884         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
70885         return ret_conv;
70886 }
70887
70888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
70889         LDKPaymentParameters this_ptr_conv;
70890         this_ptr_conv.inner = untag_ptr(this_ptr);
70891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70893         this_ptr_conv.is_owned = false;
70894         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
70895 }
70896
70897 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1channel_1saturation_1power_1of_1half(JNIEnv *env, jclass clz, int64_t this_ptr) {
70898         LDKPaymentParameters this_ptr_conv;
70899         this_ptr_conv.inner = untag_ptr(this_ptr);
70900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70902         this_ptr_conv.is_owned = false;
70903         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
70904         return ret_conv;
70905 }
70906
70907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1channel_1saturation_1power_1of_1half(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
70908         LDKPaymentParameters this_ptr_conv;
70909         this_ptr_conv.inner = untag_ptr(this_ptr);
70910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70912         this_ptr_conv.is_owned = false;
70913         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
70914 }
70915
70916 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
70917         LDKPaymentParameters this_ptr_conv;
70918         this_ptr_conv.inner = untag_ptr(this_ptr);
70919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70921         this_ptr_conv.is_owned = false;
70922         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
70923         int64_tArray ret_arr = NULL;
70924         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
70925         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
70926         for (size_t g = 0; g < ret_var.datalen; g++) {
70927                 int64_t ret_conv_6_conv = ret_var.data[g];
70928                 ret_arr_ptr[g] = ret_conv_6_conv;
70929         }
70930         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
70931         FREE(ret_var.data);
70932         return ret_arr;
70933 }
70934
70935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
70936         LDKPaymentParameters this_ptr_conv;
70937         this_ptr_conv.inner = untag_ptr(this_ptr);
70938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70940         this_ptr_conv.is_owned = false;
70941         LDKCVec_u64Z val_constr;
70942         val_constr.datalen = (*env)->GetArrayLength(env, val);
70943         if (val_constr.datalen > 0)
70944                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
70945         else
70946                 val_constr.data = NULL;
70947         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
70948         for (size_t g = 0; g < val_constr.datalen; g++) {
70949                 int64_t val_conv_6 = val_vals[g];
70950                 val_constr.data[g] = val_conv_6;
70951         }
70952         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
70953         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
70954 }
70955
70956 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1previously_1failed_1blinded_1path_1idxs(JNIEnv *env, jclass clz, int64_t this_ptr) {
70957         LDKPaymentParameters this_ptr_conv;
70958         this_ptr_conv.inner = untag_ptr(this_ptr);
70959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70961         this_ptr_conv.is_owned = false;
70962         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_blinded_path_idxs(&this_ptr_conv);
70963         int64_tArray ret_arr = NULL;
70964         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
70965         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
70966         for (size_t g = 0; g < ret_var.datalen; g++) {
70967                 int64_t ret_conv_6_conv = ret_var.data[g];
70968                 ret_arr_ptr[g] = ret_conv_6_conv;
70969         }
70970         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
70971         FREE(ret_var.data);
70972         return ret_arr;
70973 }
70974
70975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1blinded_1path_1idxs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
70976         LDKPaymentParameters this_ptr_conv;
70977         this_ptr_conv.inner = untag_ptr(this_ptr);
70978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70980         this_ptr_conv.is_owned = false;
70981         LDKCVec_u64Z val_constr;
70982         val_constr.datalen = (*env)->GetArrayLength(env, val);
70983         if (val_constr.datalen > 0)
70984                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
70985         else
70986                 val_constr.data = NULL;
70987         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
70988         for (size_t g = 0; g < val_constr.datalen; g++) {
70989                 int64_t val_conv_6 = val_vals[g];
70990                 val_constr.data[g] = val_conv_6;
70991         }
70992         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
70993         PaymentParameters_set_previously_failed_blinded_path_idxs(&this_ptr_conv, val_constr);
70994 }
70995
70996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1new(JNIEnv *env, jclass clz, int64_t payee_arg, int64_t expiry_time_arg, int32_t max_total_cltv_expiry_delta_arg, int8_t max_path_count_arg, int8_t max_channel_saturation_power_of_half_arg, int64_tArray previously_failed_channels_arg, int64_tArray previously_failed_blinded_path_idxs_arg) {
70997         void* payee_arg_ptr = untag_ptr(payee_arg);
70998         CHECK_ACCESS(payee_arg_ptr);
70999         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
71000         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
71001         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
71002         CHECK_ACCESS(expiry_time_arg_ptr);
71003         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
71004         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
71005         LDKCVec_u64Z previously_failed_channels_arg_constr;
71006         previously_failed_channels_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_channels_arg);
71007         if (previously_failed_channels_arg_constr.datalen > 0)
71008                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
71009         else
71010                 previously_failed_channels_arg_constr.data = NULL;
71011         int64_t* previously_failed_channels_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_channels_arg, NULL);
71012         for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) {
71013                 int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g];
71014                 previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6;
71015         }
71016         (*env)->ReleaseLongArrayElements(env, previously_failed_channels_arg, previously_failed_channels_arg_vals, 0);
71017         LDKCVec_u64Z previously_failed_blinded_path_idxs_arg_constr;
71018         previously_failed_blinded_path_idxs_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_blinded_path_idxs_arg);
71019         if (previously_failed_blinded_path_idxs_arg_constr.datalen > 0)
71020                 previously_failed_blinded_path_idxs_arg_constr.data = MALLOC(previously_failed_blinded_path_idxs_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
71021         else
71022                 previously_failed_blinded_path_idxs_arg_constr.data = NULL;
71023         int64_t* previously_failed_blinded_path_idxs_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_blinded_path_idxs_arg, NULL);
71024         for (size_t g = 0; g < previously_failed_blinded_path_idxs_arg_constr.datalen; g++) {
71025                 int64_t previously_failed_blinded_path_idxs_arg_conv_6 = previously_failed_blinded_path_idxs_arg_vals[g];
71026                 previously_failed_blinded_path_idxs_arg_constr.data[g] = previously_failed_blinded_path_idxs_arg_conv_6;
71027         }
71028         (*env)->ReleaseLongArrayElements(env, previously_failed_blinded_path_idxs_arg, previously_failed_blinded_path_idxs_arg_vals, 0);
71029         LDKPaymentParameters ret_var = PaymentParameters_new(payee_arg_conv, expiry_time_arg_conv, max_total_cltv_expiry_delta_arg, max_path_count_arg, max_channel_saturation_power_of_half_arg, previously_failed_channels_arg_constr, previously_failed_blinded_path_idxs_arg_constr);
71030         int64_t ret_ref = 0;
71031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71033         return ret_ref;
71034 }
71035
71036 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
71037         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
71038         int64_t ret_ref = 0;
71039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71041         return ret_ref;
71042 }
71043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71044         LDKPaymentParameters arg_conv;
71045         arg_conv.inner = untag_ptr(arg);
71046         arg_conv.is_owned = ptr_is_owned(arg);
71047         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71048         arg_conv.is_owned = false;
71049         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
71050         return ret_conv;
71051 }
71052
71053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71054         LDKPaymentParameters orig_conv;
71055         orig_conv.inner = untag_ptr(orig);
71056         orig_conv.is_owned = ptr_is_owned(orig);
71057         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71058         orig_conv.is_owned = false;
71059         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
71060         int64_t ret_ref = 0;
71061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71063         return ret_ref;
71064 }
71065
71066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
71067         LDKPaymentParameters o_conv;
71068         o_conv.inner = untag_ptr(o);
71069         o_conv.is_owned = ptr_is_owned(o);
71070         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71071         o_conv.is_owned = false;
71072         int64_t ret_conv = PaymentParameters_hash(&o_conv);
71073         return ret_conv;
71074 }
71075
71076 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71077         LDKPaymentParameters a_conv;
71078         a_conv.inner = untag_ptr(a);
71079         a_conv.is_owned = ptr_is_owned(a);
71080         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71081         a_conv.is_owned = false;
71082         LDKPaymentParameters b_conv;
71083         b_conv.inner = untag_ptr(b);
71084         b_conv.is_owned = ptr_is_owned(b);
71085         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71086         b_conv.is_owned = false;
71087         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
71088         return ret_conv;
71089 }
71090
71091 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
71092         LDKPaymentParameters obj_conv;
71093         obj_conv.inner = untag_ptr(obj);
71094         obj_conv.is_owned = ptr_is_owned(obj);
71095         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71096         obj_conv.is_owned = false;
71097         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
71098         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71099         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71100         CVec_u8Z_free(ret_var);
71101         return ret_arr;
71102 }
71103
71104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser, int32_t arg) {
71105         LDKu8slice ser_ref;
71106         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71107         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71108         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
71109         *ret_conv = PaymentParameters_read(ser_ref, arg);
71110         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71111         return tag_ptr(ret_conv, true);
71112 }
71113
71114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta) {
71115         LDKPublicKey payee_pubkey_ref;
71116         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
71117         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
71118         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
71119         int64_t ret_ref = 0;
71120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71122         return ret_ref;
71123 }
71124
71125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta, jboolean allow_mpp) {
71126         LDKPublicKey payee_pubkey_ref;
71127         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
71128         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
71129         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
71130         int64_t ret_ref = 0;
71131         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71132         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71133         return ret_ref;
71134 }
71135
71136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1bolt12_1invoice(JNIEnv *env, jclass clz, int64_t invoice) {
71137         LDKBolt12Invoice invoice_conv;
71138         invoice_conv.inner = untag_ptr(invoice);
71139         invoice_conv.is_owned = ptr_is_owned(invoice);
71140         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
71141         invoice_conv.is_owned = false;
71142         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
71143         int64_t ret_ref = 0;
71144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71146         return ret_ref;
71147 }
71148
71149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1blinded(JNIEnv *env, jclass clz, int64_tArray blinded_route_hints) {
71150         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints_constr;
71151         blinded_route_hints_constr.datalen = (*env)->GetArrayLength(env, blinded_route_hints);
71152         if (blinded_route_hints_constr.datalen > 0)
71153                 blinded_route_hints_constr.data = MALLOC(blinded_route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
71154         else
71155                 blinded_route_hints_constr.data = NULL;
71156         int64_t* blinded_route_hints_vals = (*env)->GetLongArrayElements (env, blinded_route_hints, NULL);
71157         for (size_t l = 0; l < blinded_route_hints_constr.datalen; l++) {
71158                 int64_t blinded_route_hints_conv_37 = blinded_route_hints_vals[l];
71159                 void* blinded_route_hints_conv_37_ptr = untag_ptr(blinded_route_hints_conv_37);
71160                 CHECK_ACCESS(blinded_route_hints_conv_37_ptr);
71161                 LDKC2Tuple_BlindedPayInfoBlindedPathZ blinded_route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(blinded_route_hints_conv_37_ptr);
71162                 blinded_route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(blinded_route_hints_conv_37));
71163                 blinded_route_hints_constr.data[l] = blinded_route_hints_conv_37_conv;
71164         }
71165         (*env)->ReleaseLongArrayElements(env, blinded_route_hints, blinded_route_hints_vals, 0);
71166         LDKPaymentParameters ret_var = PaymentParameters_blinded(blinded_route_hints_constr);
71167         int64_t ret_ref = 0;
71168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71170         return ret_ref;
71171 }
71172
71173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71174         if (!ptr_is_owned(this_ptr)) return;
71175         void* this_ptr_ptr = untag_ptr(this_ptr);
71176         CHECK_ACCESS(this_ptr_ptr);
71177         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
71178         FREE(untag_ptr(this_ptr));
71179         Payee_free(this_ptr_conv);
71180 }
71181
71182 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
71183         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
71184         *ret_copy = Payee_clone(arg);
71185         int64_t ret_ref = tag_ptr(ret_copy, true);
71186         return ret_ref;
71187 }
71188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71189         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
71190         int64_t ret_conv = Payee_clone_ptr(arg_conv);
71191         return ret_conv;
71192 }
71193
71194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71195         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
71196         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
71197         *ret_copy = Payee_clone(orig_conv);
71198         int64_t ret_ref = tag_ptr(ret_copy, true);
71199         return ret_ref;
71200 }
71201
71202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1blinded(JNIEnv *env, jclass clz, int64_tArray route_hints, int64_t features) {
71203         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
71204         route_hints_constr.datalen = (*env)->GetArrayLength(env, route_hints);
71205         if (route_hints_constr.datalen > 0)
71206                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
71207         else
71208                 route_hints_constr.data = NULL;
71209         int64_t* route_hints_vals = (*env)->GetLongArrayElements (env, route_hints, NULL);
71210         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
71211                 int64_t route_hints_conv_37 = route_hints_vals[l];
71212                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
71213                 CHECK_ACCESS(route_hints_conv_37_ptr);
71214                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
71215                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
71216                 route_hints_constr.data[l] = route_hints_conv_37_conv;
71217         }
71218         (*env)->ReleaseLongArrayElements(env, route_hints, route_hints_vals, 0);
71219         LDKBolt12InvoiceFeatures features_conv;
71220         features_conv.inner = untag_ptr(features);
71221         features_conv.is_owned = ptr_is_owned(features);
71222         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
71223         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
71224         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
71225         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
71226         int64_t ret_ref = tag_ptr(ret_copy, true);
71227         return ret_ref;
71228 }
71229
71230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clear(JNIEnv *env, jclass clz, int8_tArray node_id, int64_tArray route_hints, int64_t features, int32_t final_cltv_expiry_delta) {
71231         LDKPublicKey node_id_ref;
71232         CHECK((*env)->GetArrayLength(env, node_id) == 33);
71233         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
71234         LDKCVec_RouteHintZ route_hints_constr;
71235         route_hints_constr.datalen = (*env)->GetArrayLength(env, route_hints);
71236         if (route_hints_constr.datalen > 0)
71237                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
71238         else
71239                 route_hints_constr.data = NULL;
71240         int64_t* route_hints_vals = (*env)->GetLongArrayElements (env, route_hints, NULL);
71241         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
71242                 int64_t route_hints_conv_11 = route_hints_vals[l];
71243                 LDKRouteHint route_hints_conv_11_conv;
71244                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
71245                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
71246                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
71247                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
71248                 route_hints_constr.data[l] = route_hints_conv_11_conv;
71249         }
71250         (*env)->ReleaseLongArrayElements(env, route_hints, route_hints_vals, 0);
71251         LDKBolt11InvoiceFeatures features_conv;
71252         features_conv.inner = untag_ptr(features);
71253         features_conv.is_owned = ptr_is_owned(features);
71254         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
71255         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
71256         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
71257         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
71258         int64_t ret_ref = tag_ptr(ret_copy, true);
71259         return ret_ref;
71260 }
71261
71262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1hash(JNIEnv *env, jclass clz, int64_t o) {
71263         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
71264         int64_t ret_conv = Payee_hash(o_conv);
71265         return ret_conv;
71266 }
71267
71268 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Payee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71269         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
71270         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
71271         jboolean ret_conv = Payee_eq(a_conv, b_conv);
71272         return ret_conv;
71273 }
71274
71275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71276         LDKRouteHint this_obj_conv;
71277         this_obj_conv.inner = untag_ptr(this_obj);
71278         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71280         RouteHint_free(this_obj_conv);
71281 }
71282
71283 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
71284         LDKRouteHint this_ptr_conv;
71285         this_ptr_conv.inner = untag_ptr(this_ptr);
71286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71288         this_ptr_conv.is_owned = false;
71289         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
71290         int64_tArray ret_arr = NULL;
71291         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
71292         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
71293         for (size_t o = 0; o < ret_var.datalen; o++) {
71294                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
71295                 int64_t ret_conv_14_ref = 0;
71296                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
71297                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
71298                 ret_arr_ptr[o] = ret_conv_14_ref;
71299         }
71300         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
71301         FREE(ret_var.data);
71302         return ret_arr;
71303 }
71304
71305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
71306         LDKRouteHint this_ptr_conv;
71307         this_ptr_conv.inner = untag_ptr(this_ptr);
71308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71310         this_ptr_conv.is_owned = false;
71311         LDKCVec_RouteHintHopZ val_constr;
71312         val_constr.datalen = (*env)->GetArrayLength(env, val);
71313         if (val_constr.datalen > 0)
71314                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
71315         else
71316                 val_constr.data = NULL;
71317         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
71318         for (size_t o = 0; o < val_constr.datalen; o++) {
71319                 int64_t val_conv_14 = val_vals[o];
71320                 LDKRouteHintHop val_conv_14_conv;
71321                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
71322                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
71323                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
71324                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
71325                 val_constr.data[o] = val_conv_14_conv;
71326         }
71327         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
71328         RouteHint_set_a(&this_ptr_conv, val_constr);
71329 }
71330
71331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
71332         LDKCVec_RouteHintHopZ a_arg_constr;
71333         a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
71334         if (a_arg_constr.datalen > 0)
71335                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
71336         else
71337                 a_arg_constr.data = NULL;
71338         int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
71339         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
71340                 int64_t a_arg_conv_14 = a_arg_vals[o];
71341                 LDKRouteHintHop a_arg_conv_14_conv;
71342                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
71343                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
71344                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
71345                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
71346                 a_arg_constr.data[o] = a_arg_conv_14_conv;
71347         }
71348         (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
71349         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
71350         int64_t ret_ref = 0;
71351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71353         return ret_ref;
71354 }
71355
71356 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
71357         LDKRouteHint ret_var = RouteHint_clone(arg);
71358         int64_t ret_ref = 0;
71359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71361         return ret_ref;
71362 }
71363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71364         LDKRouteHint arg_conv;
71365         arg_conv.inner = untag_ptr(arg);
71366         arg_conv.is_owned = ptr_is_owned(arg);
71367         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71368         arg_conv.is_owned = false;
71369         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
71370         return ret_conv;
71371 }
71372
71373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71374         LDKRouteHint orig_conv;
71375         orig_conv.inner = untag_ptr(orig);
71376         orig_conv.is_owned = ptr_is_owned(orig);
71377         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71378         orig_conv.is_owned = false;
71379         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
71380         int64_t ret_ref = 0;
71381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71383         return ret_ref;
71384 }
71385
71386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
71387         LDKRouteHint o_conv;
71388         o_conv.inner = untag_ptr(o);
71389         o_conv.is_owned = ptr_is_owned(o);
71390         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71391         o_conv.is_owned = false;
71392         int64_t ret_conv = RouteHint_hash(&o_conv);
71393         return ret_conv;
71394 }
71395
71396 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71397         LDKRouteHint a_conv;
71398         a_conv.inner = untag_ptr(a);
71399         a_conv.is_owned = ptr_is_owned(a);
71400         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71401         a_conv.is_owned = false;
71402         LDKRouteHint b_conv;
71403         b_conv.inner = untag_ptr(b);
71404         b_conv.is_owned = ptr_is_owned(b);
71405         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71406         b_conv.is_owned = false;
71407         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
71408         return ret_conv;
71409 }
71410
71411 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
71412         LDKRouteHint obj_conv;
71413         obj_conv.inner = untag_ptr(obj);
71414         obj_conv.is_owned = ptr_is_owned(obj);
71415         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71416         obj_conv.is_owned = false;
71417         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
71418         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71419         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71420         CVec_u8Z_free(ret_var);
71421         return ret_arr;
71422 }
71423
71424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71425         LDKu8slice ser_ref;
71426         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71427         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71428         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
71429         *ret_conv = RouteHint_read(ser_ref);
71430         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71431         return tag_ptr(ret_conv, true);
71432 }
71433
71434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71435         LDKRouteHintHop this_obj_conv;
71436         this_obj_conv.inner = untag_ptr(this_obj);
71437         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71439         RouteHintHop_free(this_obj_conv);
71440 }
71441
71442 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
71443         LDKRouteHintHop this_ptr_conv;
71444         this_ptr_conv.inner = untag_ptr(this_ptr);
71445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71447         this_ptr_conv.is_owned = false;
71448         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
71449         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
71450         return ret_arr;
71451 }
71452
71453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
71454         LDKRouteHintHop this_ptr_conv;
71455         this_ptr_conv.inner = untag_ptr(this_ptr);
71456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71458         this_ptr_conv.is_owned = false;
71459         LDKPublicKey val_ref;
71460         CHECK((*env)->GetArrayLength(env, val) == 33);
71461         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
71462         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
71463 }
71464
71465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
71466         LDKRouteHintHop this_ptr_conv;
71467         this_ptr_conv.inner = untag_ptr(this_ptr);
71468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71470         this_ptr_conv.is_owned = false;
71471         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
71472         return ret_conv;
71473 }
71474
71475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71476         LDKRouteHintHop this_ptr_conv;
71477         this_ptr_conv.inner = untag_ptr(this_ptr);
71478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71480         this_ptr_conv.is_owned = false;
71481         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
71482 }
71483
71484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
71485         LDKRouteHintHop this_ptr_conv;
71486         this_ptr_conv.inner = untag_ptr(this_ptr);
71487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71489         this_ptr_conv.is_owned = false;
71490         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
71491         int64_t ret_ref = 0;
71492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71494         return ret_ref;
71495 }
71496
71497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71498         LDKRouteHintHop this_ptr_conv;
71499         this_ptr_conv.inner = untag_ptr(this_ptr);
71500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71502         this_ptr_conv.is_owned = false;
71503         LDKRoutingFees val_conv;
71504         val_conv.inner = untag_ptr(val);
71505         val_conv.is_owned = ptr_is_owned(val);
71506         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71507         val_conv = RoutingFees_clone(&val_conv);
71508         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
71509 }
71510
71511 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
71512         LDKRouteHintHop this_ptr_conv;
71513         this_ptr_conv.inner = untag_ptr(this_ptr);
71514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71516         this_ptr_conv.is_owned = false;
71517         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
71518         return ret_conv;
71519 }
71520
71521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
71522         LDKRouteHintHop this_ptr_conv;
71523         this_ptr_conv.inner = untag_ptr(this_ptr);
71524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71526         this_ptr_conv.is_owned = false;
71527         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
71528 }
71529
71530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
71531         LDKRouteHintHop this_ptr_conv;
71532         this_ptr_conv.inner = untag_ptr(this_ptr);
71533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71535         this_ptr_conv.is_owned = false;
71536         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71537         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
71538         int64_t ret_ref = tag_ptr(ret_copy, true);
71539         return ret_ref;
71540 }
71541
71542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71543         LDKRouteHintHop this_ptr_conv;
71544         this_ptr_conv.inner = untag_ptr(this_ptr);
71545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71547         this_ptr_conv.is_owned = false;
71548         void* val_ptr = untag_ptr(val);
71549         CHECK_ACCESS(val_ptr);
71550         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
71551         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
71552         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
71553 }
71554
71555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
71556         LDKRouteHintHop this_ptr_conv;
71557         this_ptr_conv.inner = untag_ptr(this_ptr);
71558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71560         this_ptr_conv.is_owned = false;
71561         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71562         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
71563         int64_t ret_ref = tag_ptr(ret_copy, true);
71564         return ret_ref;
71565 }
71566
71567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71568         LDKRouteHintHop this_ptr_conv;
71569         this_ptr_conv.inner = untag_ptr(this_ptr);
71570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71572         this_ptr_conv.is_owned = false;
71573         void* val_ptr = untag_ptr(val);
71574         CHECK_ACCESS(val_ptr);
71575         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
71576         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
71577         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
71578 }
71579
71580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1new(JNIEnv *env, jclass clz, int8_tArray src_node_id_arg, int64_t short_channel_id_arg, int64_t fees_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg) {
71581         LDKPublicKey src_node_id_arg_ref;
71582         CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
71583         (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
71584         LDKRoutingFees fees_arg_conv;
71585         fees_arg_conv.inner = untag_ptr(fees_arg);
71586         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
71587         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
71588         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
71589         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
71590         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
71591         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
71592         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
71593         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
71594         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
71595         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
71596         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
71597         LDKRouteHintHop ret_var = RouteHintHop_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg_conv, htlc_maximum_msat_arg_conv);
71598         int64_t ret_ref = 0;
71599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71601         return ret_ref;
71602 }
71603
71604 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
71605         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
71606         int64_t ret_ref = 0;
71607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71609         return ret_ref;
71610 }
71611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71612         LDKRouteHintHop arg_conv;
71613         arg_conv.inner = untag_ptr(arg);
71614         arg_conv.is_owned = ptr_is_owned(arg);
71615         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71616         arg_conv.is_owned = false;
71617         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
71618         return ret_conv;
71619 }
71620
71621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71622         LDKRouteHintHop orig_conv;
71623         orig_conv.inner = untag_ptr(orig);
71624         orig_conv.is_owned = ptr_is_owned(orig);
71625         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71626         orig_conv.is_owned = false;
71627         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
71628         int64_t ret_ref = 0;
71629         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71630         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71631         return ret_ref;
71632 }
71633
71634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
71635         LDKRouteHintHop o_conv;
71636         o_conv.inner = untag_ptr(o);
71637         o_conv.is_owned = ptr_is_owned(o);
71638         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71639         o_conv.is_owned = false;
71640         int64_t ret_conv = RouteHintHop_hash(&o_conv);
71641         return ret_conv;
71642 }
71643
71644 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71645         LDKRouteHintHop a_conv;
71646         a_conv.inner = untag_ptr(a);
71647         a_conv.is_owned = ptr_is_owned(a);
71648         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71649         a_conv.is_owned = false;
71650         LDKRouteHintHop b_conv;
71651         b_conv.inner = untag_ptr(b);
71652         b_conv.is_owned = ptr_is_owned(b);
71653         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71654         b_conv.is_owned = false;
71655         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
71656         return ret_conv;
71657 }
71658
71659 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
71660         LDKRouteHintHop obj_conv;
71661         obj_conv.inner = untag_ptr(obj);
71662         obj_conv.is_owned = ptr_is_owned(obj);
71663         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71664         obj_conv.is_owned = false;
71665         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
71666         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71667         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71668         CVec_u8Z_free(ret_var);
71669         return ret_arr;
71670 }
71671
71672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71673         LDKu8slice ser_ref;
71674         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71675         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71676         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
71677         *ret_conv = RouteHintHop_read(ser_ref);
71678         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71679         return tag_ptr(ret_conv, true);
71680 }
71681
71682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FirstHopCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71683         LDKFirstHopCandidate this_obj_conv;
71684         this_obj_conv.inner = untag_ptr(this_obj);
71685         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71687         FirstHopCandidate_free(this_obj_conv);
71688 }
71689
71690 static inline uint64_t FirstHopCandidate_clone_ptr(LDKFirstHopCandidate *NONNULL_PTR arg) {
71691         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(arg);
71692         int64_t ret_ref = 0;
71693         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71694         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71695         return ret_ref;
71696 }
71697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FirstHopCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71698         LDKFirstHopCandidate arg_conv;
71699         arg_conv.inner = untag_ptr(arg);
71700         arg_conv.is_owned = ptr_is_owned(arg);
71701         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71702         arg_conv.is_owned = false;
71703         int64_t ret_conv = FirstHopCandidate_clone_ptr(&arg_conv);
71704         return ret_conv;
71705 }
71706
71707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FirstHopCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71708         LDKFirstHopCandidate orig_conv;
71709         orig_conv.inner = untag_ptr(orig);
71710         orig_conv.is_owned = ptr_is_owned(orig);
71711         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71712         orig_conv.is_owned = false;
71713         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(&orig_conv);
71714         int64_t ret_ref = 0;
71715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71717         return ret_ref;
71718 }
71719
71720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71721         LDKPublicHopCandidate this_obj_conv;
71722         this_obj_conv.inner = untag_ptr(this_obj);
71723         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71725         PublicHopCandidate_free(this_obj_conv);
71726 }
71727
71728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
71729         LDKPublicHopCandidate this_ptr_conv;
71730         this_ptr_conv.inner = untag_ptr(this_ptr);
71731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71733         this_ptr_conv.is_owned = false;
71734         int64_t ret_conv = PublicHopCandidate_get_short_channel_id(&this_ptr_conv);
71735         return ret_conv;
71736 }
71737
71738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71739         LDKPublicHopCandidate this_ptr_conv;
71740         this_ptr_conv.inner = untag_ptr(this_ptr);
71741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71743         this_ptr_conv.is_owned = false;
71744         PublicHopCandidate_set_short_channel_id(&this_ptr_conv, val);
71745 }
71746
71747 static inline uint64_t PublicHopCandidate_clone_ptr(LDKPublicHopCandidate *NONNULL_PTR arg) {
71748         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(arg);
71749         int64_t ret_ref = 0;
71750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71752         return ret_ref;
71753 }
71754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71755         LDKPublicHopCandidate arg_conv;
71756         arg_conv.inner = untag_ptr(arg);
71757         arg_conv.is_owned = ptr_is_owned(arg);
71758         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71759         arg_conv.is_owned = false;
71760         int64_t ret_conv = PublicHopCandidate_clone_ptr(&arg_conv);
71761         return ret_conv;
71762 }
71763
71764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71765         LDKPublicHopCandidate orig_conv;
71766         orig_conv.inner = untag_ptr(orig);
71767         orig_conv.is_owned = ptr_is_owned(orig);
71768         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71769         orig_conv.is_owned = false;
71770         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(&orig_conv);
71771         int64_t ret_ref = 0;
71772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71774         return ret_ref;
71775 }
71776
71777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateHopCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71778         LDKPrivateHopCandidate this_obj_conv;
71779         this_obj_conv.inner = untag_ptr(this_obj);
71780         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71782         PrivateHopCandidate_free(this_obj_conv);
71783 }
71784
71785 static inline uint64_t PrivateHopCandidate_clone_ptr(LDKPrivateHopCandidate *NONNULL_PTR arg) {
71786         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(arg);
71787         int64_t ret_ref = 0;
71788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71790         return ret_ref;
71791 }
71792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateHopCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71793         LDKPrivateHopCandidate arg_conv;
71794         arg_conv.inner = untag_ptr(arg);
71795         arg_conv.is_owned = ptr_is_owned(arg);
71796         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71797         arg_conv.is_owned = false;
71798         int64_t ret_conv = PrivateHopCandidate_clone_ptr(&arg_conv);
71799         return ret_conv;
71800 }
71801
71802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateHopCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71803         LDKPrivateHopCandidate orig_conv;
71804         orig_conv.inner = untag_ptr(orig);
71805         orig_conv.is_owned = ptr_is_owned(orig);
71806         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71807         orig_conv.is_owned = false;
71808         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(&orig_conv);
71809         int64_t ret_ref = 0;
71810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71812         return ret_ref;
71813 }
71814
71815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPathCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71816         LDKBlindedPathCandidate this_obj_conv;
71817         this_obj_conv.inner = untag_ptr(this_obj);
71818         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71820         BlindedPathCandidate_free(this_obj_conv);
71821 }
71822
71823 static inline uint64_t BlindedPathCandidate_clone_ptr(LDKBlindedPathCandidate *NONNULL_PTR arg) {
71824         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(arg);
71825         int64_t ret_ref = 0;
71826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71828         return ret_ref;
71829 }
71830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPathCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71831         LDKBlindedPathCandidate arg_conv;
71832         arg_conv.inner = untag_ptr(arg);
71833         arg_conv.is_owned = ptr_is_owned(arg);
71834         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71835         arg_conv.is_owned = false;
71836         int64_t ret_conv = BlindedPathCandidate_clone_ptr(&arg_conv);
71837         return ret_conv;
71838 }
71839
71840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPathCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71841         LDKBlindedPathCandidate orig_conv;
71842         orig_conv.inner = untag_ptr(orig);
71843         orig_conv.is_owned = ptr_is_owned(orig);
71844         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71845         orig_conv.is_owned = false;
71846         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(&orig_conv);
71847         int64_t ret_ref = 0;
71848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71850         return ret_ref;
71851 }
71852
71853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OneHopBlindedPathCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71854         LDKOneHopBlindedPathCandidate this_obj_conv;
71855         this_obj_conv.inner = untag_ptr(this_obj);
71856         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71858         OneHopBlindedPathCandidate_free(this_obj_conv);
71859 }
71860
71861 static inline uint64_t OneHopBlindedPathCandidate_clone_ptr(LDKOneHopBlindedPathCandidate *NONNULL_PTR arg) {
71862         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(arg);
71863         int64_t ret_ref = 0;
71864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71866         return ret_ref;
71867 }
71868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OneHopBlindedPathCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71869         LDKOneHopBlindedPathCandidate arg_conv;
71870         arg_conv.inner = untag_ptr(arg);
71871         arg_conv.is_owned = ptr_is_owned(arg);
71872         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71873         arg_conv.is_owned = false;
71874         int64_t ret_conv = OneHopBlindedPathCandidate_clone_ptr(&arg_conv);
71875         return ret_conv;
71876 }
71877
71878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OneHopBlindedPathCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71879         LDKOneHopBlindedPathCandidate orig_conv;
71880         orig_conv.inner = untag_ptr(orig);
71881         orig_conv.is_owned = ptr_is_owned(orig);
71882         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71883         orig_conv.is_owned = false;
71884         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(&orig_conv);
71885         int64_t ret_ref = 0;
71886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71888         return ret_ref;
71889 }
71890
71891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71892         if (!ptr_is_owned(this_ptr)) return;
71893         void* this_ptr_ptr = untag_ptr(this_ptr);
71894         CHECK_ACCESS(this_ptr_ptr);
71895         LDKCandidateRouteHop this_ptr_conv = *(LDKCandidateRouteHop*)(this_ptr_ptr);
71896         FREE(untag_ptr(this_ptr));
71897         CandidateRouteHop_free(this_ptr_conv);
71898 }
71899
71900 static inline uint64_t CandidateRouteHop_clone_ptr(LDKCandidateRouteHop *NONNULL_PTR arg) {
71901         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
71902         *ret_copy = CandidateRouteHop_clone(arg);
71903         int64_t ret_ref = tag_ptr(ret_copy, true);
71904         return ret_ref;
71905 }
71906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71907         LDKCandidateRouteHop* arg_conv = (LDKCandidateRouteHop*)untag_ptr(arg);
71908         int64_t ret_conv = CandidateRouteHop_clone_ptr(arg_conv);
71909         return ret_conv;
71910 }
71911
71912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71913         LDKCandidateRouteHop* orig_conv = (LDKCandidateRouteHop*)untag_ptr(orig);
71914         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
71915         *ret_copy = CandidateRouteHop_clone(orig_conv);
71916         int64_t ret_ref = tag_ptr(ret_copy, true);
71917         return ret_ref;
71918 }
71919
71920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1first_1hop(JNIEnv *env, jclass clz, int64_t a) {
71921         LDKFirstHopCandidate a_conv;
71922         a_conv.inner = untag_ptr(a);
71923         a_conv.is_owned = ptr_is_owned(a);
71924         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71925         a_conv = FirstHopCandidate_clone(&a_conv);
71926         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
71927         *ret_copy = CandidateRouteHop_first_hop(a_conv);
71928         int64_t ret_ref = tag_ptr(ret_copy, true);
71929         return ret_ref;
71930 }
71931
71932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1public_1hop(JNIEnv *env, jclass clz, int64_t a) {
71933         LDKPublicHopCandidate a_conv;
71934         a_conv.inner = untag_ptr(a);
71935         a_conv.is_owned = ptr_is_owned(a);
71936         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71937         a_conv = PublicHopCandidate_clone(&a_conv);
71938         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
71939         *ret_copy = CandidateRouteHop_public_hop(a_conv);
71940         int64_t ret_ref = tag_ptr(ret_copy, true);
71941         return ret_ref;
71942 }
71943
71944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1private_1hop(JNIEnv *env, jclass clz, int64_t a) {
71945         LDKPrivateHopCandidate a_conv;
71946         a_conv.inner = untag_ptr(a);
71947         a_conv.is_owned = ptr_is_owned(a);
71948         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71949         a_conv = PrivateHopCandidate_clone(&a_conv);
71950         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
71951         *ret_copy = CandidateRouteHop_private_hop(a_conv);
71952         int64_t ret_ref = tag_ptr(ret_copy, true);
71953         return ret_ref;
71954 }
71955
71956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1blinded(JNIEnv *env, jclass clz, int64_t a) {
71957         LDKBlindedPathCandidate a_conv;
71958         a_conv.inner = untag_ptr(a);
71959         a_conv.is_owned = ptr_is_owned(a);
71960         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71961         a_conv = BlindedPathCandidate_clone(&a_conv);
71962         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
71963         *ret_copy = CandidateRouteHop_blinded(a_conv);
71964         int64_t ret_ref = tag_ptr(ret_copy, true);
71965         return ret_ref;
71966 }
71967
71968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1one_1hop_1blinded(JNIEnv *env, jclass clz, int64_t a) {
71969         LDKOneHopBlindedPathCandidate a_conv;
71970         a_conv.inner = untag_ptr(a);
71971         a_conv.is_owned = ptr_is_owned(a);
71972         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71973         a_conv = OneHopBlindedPathCandidate_clone(&a_conv);
71974         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
71975         *ret_copy = CandidateRouteHop_one_hop_blinded(a_conv);
71976         int64_t ret_ref = tag_ptr(ret_copy, true);
71977         return ret_ref;
71978 }
71979
71980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1globally_1unique_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
71981         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
71982         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71983         *ret_copy = CandidateRouteHop_globally_unique_short_channel_id(this_arg_conv);
71984         int64_t ret_ref = tag_ptr(ret_copy, true);
71985         return ret_ref;
71986 }
71987
71988 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
71989         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
71990         int32_t ret_conv = CandidateRouteHop_cltv_expiry_delta(this_arg_conv);
71991         return ret_conv;
71992 }
71993
71994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
71995         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
71996         int64_t ret_conv = CandidateRouteHop_htlc_minimum_msat(this_arg_conv);
71997         return ret_conv;
71998 }
71999
72000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
72001         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72002         LDKRoutingFees ret_var = CandidateRouteHop_fees(this_arg_conv);
72003         int64_t ret_ref = 0;
72004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72006         return ret_ref;
72007 }
72008
72009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1source(JNIEnv *env, jclass clz, int64_t this_arg) {
72010         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72011         LDKNodeId ret_var = CandidateRouteHop_source(this_arg_conv);
72012         int64_t ret_ref = 0;
72013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72015         return ret_ref;
72016 }
72017
72018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1target(JNIEnv *env, jclass clz, int64_t this_arg) {
72019         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
72020         LDKNodeId ret_var = CandidateRouteHop_target(this_arg_conv);
72021         int64_t ret_ref = 0;
72022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72024         return ret_ref;
72025 }
72026
72027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t route_params, int64_t network_graph, int64_tArray first_hops, int64_t logger, int64_t scorer, int64_t score_params, int8_tArray random_seed_bytes) {
72028         LDKPublicKey our_node_pubkey_ref;
72029         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
72030         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
72031         LDKRouteParameters route_params_conv;
72032         route_params_conv.inner = untag_ptr(route_params);
72033         route_params_conv.is_owned = ptr_is_owned(route_params);
72034         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
72035         route_params_conv.is_owned = false;
72036         LDKNetworkGraph network_graph_conv;
72037         network_graph_conv.inner = untag_ptr(network_graph);
72038         network_graph_conv.is_owned = ptr_is_owned(network_graph);
72039         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
72040         network_graph_conv.is_owned = false;
72041         LDKCVec_ChannelDetailsZ first_hops_constr;
72042         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
72043         if (first_hops != NULL) {
72044                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
72045                 if (first_hops_constr.datalen > 0)
72046                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
72047                 else
72048                         first_hops_constr.data = NULL;
72049                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
72050                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
72051                         int64_t first_hops_conv_16 = first_hops_vals[q];
72052                         LDKChannelDetails first_hops_conv_16_conv;
72053                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
72054                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
72055                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
72056                         first_hops_conv_16_conv.is_owned = false;
72057                         first_hops_constr.data[q] = first_hops_conv_16_conv;
72058                 }
72059                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
72060                 first_hops_ptr = &first_hops_constr;
72061         }
72062         void* logger_ptr = untag_ptr(logger);
72063         CHECK_ACCESS(logger_ptr);
72064         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
72065         if (logger_conv.free == LDKLogger_JCalls_free) {
72066                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72067                 LDKLogger_JCalls_cloned(&logger_conv);
72068         }
72069         void* scorer_ptr = untag_ptr(scorer);
72070         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
72071         LDKScoreLookUp* scorer_conv = (LDKScoreLookUp*)scorer_ptr;
72072         LDKProbabilisticScoringFeeParameters score_params_conv;
72073         score_params_conv.inner = untag_ptr(score_params);
72074         score_params_conv.is_owned = ptr_is_owned(score_params);
72075         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
72076         score_params_conv.is_owned = false;
72077         uint8_t random_seed_bytes_arr[32];
72078         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
72079         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
72080         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
72081         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
72082         *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_graph_conv, first_hops_ptr, logger_conv, scorer_conv, &score_params_conv, random_seed_bytes_ref);
72083         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
72084         return tag_ptr(ret_conv, true);
72085 }
72086
72087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_build_1route_1from_1hops(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, jobjectArray hops, int64_t route_params, int64_t network_graph, int64_t logger, int8_tArray random_seed_bytes) {
72088         LDKPublicKey our_node_pubkey_ref;
72089         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
72090         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
72091         LDKCVec_PublicKeyZ hops_constr;
72092         hops_constr.datalen = (*env)->GetArrayLength(env, hops);
72093         if (hops_constr.datalen > 0)
72094                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
72095         else
72096                 hops_constr.data = NULL;
72097         for (size_t i = 0; i < hops_constr.datalen; i++) {
72098                 int8_tArray hops_conv_8 = (*env)->GetObjectArrayElement(env, hops, i);
72099                 LDKPublicKey hops_conv_8_ref;
72100                 CHECK((*env)->GetArrayLength(env, hops_conv_8) == 33);
72101                 (*env)->GetByteArrayRegion(env, hops_conv_8, 0, 33, hops_conv_8_ref.compressed_form);
72102                 hops_constr.data[i] = hops_conv_8_ref;
72103         }
72104         LDKRouteParameters route_params_conv;
72105         route_params_conv.inner = untag_ptr(route_params);
72106         route_params_conv.is_owned = ptr_is_owned(route_params);
72107         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
72108         route_params_conv.is_owned = false;
72109         LDKNetworkGraph network_graph_conv;
72110         network_graph_conv.inner = untag_ptr(network_graph);
72111         network_graph_conv.is_owned = ptr_is_owned(network_graph);
72112         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
72113         network_graph_conv.is_owned = false;
72114         void* logger_ptr = untag_ptr(logger);
72115         CHECK_ACCESS(logger_ptr);
72116         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
72117         if (logger_conv.free == LDKLogger_JCalls_free) {
72118                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72119                 LDKLogger_JCalls_cloned(&logger_conv);
72120         }
72121         uint8_t random_seed_bytes_arr[32];
72122         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
72123         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
72124         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
72125         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
72126         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
72127         return tag_ptr(ret_conv, true);
72128 }
72129
72130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreLookUp_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72131         if (!ptr_is_owned(this_ptr)) return;
72132         void* this_ptr_ptr = untag_ptr(this_ptr);
72133         CHECK_ACCESS(this_ptr_ptr);
72134         LDKScoreLookUp this_ptr_conv = *(LDKScoreLookUp*)(this_ptr_ptr);
72135         FREE(untag_ptr(this_ptr));
72136         ScoreLookUp_free(this_ptr_conv);
72137 }
72138
72139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72140         if (!ptr_is_owned(this_ptr)) return;
72141         void* this_ptr_ptr = untag_ptr(this_ptr);
72142         CHECK_ACCESS(this_ptr_ptr);
72143         LDKScoreUpdate this_ptr_conv = *(LDKScoreUpdate*)(this_ptr_ptr);
72144         FREE(untag_ptr(this_ptr));
72145         ScoreUpdate_free(this_ptr_conv);
72146 }
72147
72148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72149         if (!ptr_is_owned(this_ptr)) return;
72150         void* this_ptr_ptr = untag_ptr(this_ptr);
72151         CHECK_ACCESS(this_ptr_ptr);
72152         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
72153         FREE(untag_ptr(this_ptr));
72154         Score_free(this_ptr_conv);
72155 }
72156
72157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72158         if (!ptr_is_owned(this_ptr)) return;
72159         void* this_ptr_ptr = untag_ptr(this_ptr);
72160         CHECK_ACCESS(this_ptr_ptr);
72161         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
72162         FREE(untag_ptr(this_ptr));
72163         LockableScore_free(this_ptr_conv);
72164 }
72165
72166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72167         if (!ptr_is_owned(this_ptr)) return;
72168         void* this_ptr_ptr = untag_ptr(this_ptr);
72169         CHECK_ACCESS(this_ptr_ptr);
72170         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
72171         FREE(untag_ptr(this_ptr));
72172         WriteableScore_free(this_ptr_conv);
72173 }
72174
72175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72176         LDKMultiThreadedLockableScore this_obj_conv;
72177         this_obj_conv.inner = untag_ptr(this_obj);
72178         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72180         MultiThreadedLockableScore_free(this_obj_conv);
72181 }
72182
72183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1LockableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
72184         LDKMultiThreadedLockableScore this_arg_conv;
72185         this_arg_conv.inner = untag_ptr(this_arg);
72186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72188         this_arg_conv.is_owned = false;
72189         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
72190         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
72191         return tag_ptr(ret_ret, true);
72192 }
72193
72194 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) {
72195         LDKMultiThreadedLockableScore obj_conv;
72196         obj_conv.inner = untag_ptr(obj);
72197         obj_conv.is_owned = ptr_is_owned(obj);
72198         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72199         obj_conv.is_owned = false;
72200         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
72201         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72202         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72203         CVec_u8Z_free(ret_var);
72204         return ret_arr;
72205 }
72206
72207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1WriteableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
72208         LDKMultiThreadedLockableScore this_arg_conv;
72209         this_arg_conv.inner = untag_ptr(this_arg);
72210         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72212         this_arg_conv.is_owned = false;
72213         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
72214         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
72215         return tag_ptr(ret_ret, true);
72216 }
72217
72218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
72219         void* score_ptr = untag_ptr(score);
72220         CHECK_ACCESS(score_ptr);
72221         LDKScore score_conv = *(LDKScore*)(score_ptr);
72222         if (score_conv.free == LDKScore_JCalls_free) {
72223                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72224                 LDKScore_JCalls_cloned(&score_conv);
72225         }
72226         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
72227         int64_t ret_ref = 0;
72228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72230         return ret_ref;
72231 }
72232
72233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockRead_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72234         LDKMultiThreadedScoreLockRead this_obj_conv;
72235         this_obj_conv.inner = untag_ptr(this_obj);
72236         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72238         MultiThreadedScoreLockRead_free(this_obj_conv);
72239 }
72240
72241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72242         LDKMultiThreadedScoreLockWrite this_obj_conv;
72243         this_obj_conv.inner = untag_ptr(this_obj);
72244         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72246         MultiThreadedScoreLockWrite_free(this_obj_conv);
72247 }
72248
72249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockRead_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
72250         LDKMultiThreadedScoreLockRead this_arg_conv;
72251         this_arg_conv.inner = untag_ptr(this_arg);
72252         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72254         this_arg_conv.is_owned = false;
72255         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
72256         *ret_ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&this_arg_conv);
72257         return tag_ptr(ret_ret, true);
72258 }
72259
72260 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1write(JNIEnv *env, jclass clz, int64_t obj) {
72261         LDKMultiThreadedScoreLockWrite obj_conv;
72262         obj_conv.inner = untag_ptr(obj);
72263         obj_conv.is_owned = ptr_is_owned(obj);
72264         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72265         obj_conv.is_owned = false;
72266         LDKCVec_u8Z ret_var = MultiThreadedScoreLockWrite_write(&obj_conv);
72267         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72268         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72269         CVec_u8Z_free(ret_var);
72270         return ret_arr;
72271 }
72272
72273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
72274         LDKMultiThreadedScoreLockWrite this_arg_conv;
72275         this_arg_conv.inner = untag_ptr(this_arg);
72276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72278         this_arg_conv.is_owned = false;
72279         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
72280         *ret_ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&this_arg_conv);
72281         return tag_ptr(ret_ret, true);
72282 }
72283
72284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72285         LDKChannelUsage this_obj_conv;
72286         this_obj_conv.inner = untag_ptr(this_obj);
72287         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72289         ChannelUsage_free(this_obj_conv);
72290 }
72291
72292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
72293         LDKChannelUsage this_ptr_conv;
72294         this_ptr_conv.inner = untag_ptr(this_ptr);
72295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72297         this_ptr_conv.is_owned = false;
72298         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
72299         return ret_conv;
72300 }
72301
72302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72303         LDKChannelUsage this_ptr_conv;
72304         this_ptr_conv.inner = untag_ptr(this_ptr);
72305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72307         this_ptr_conv.is_owned = false;
72308         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
72309 }
72310
72311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
72312         LDKChannelUsage this_ptr_conv;
72313         this_ptr_conv.inner = untag_ptr(this_ptr);
72314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72316         this_ptr_conv.is_owned = false;
72317         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
72318         return ret_conv;
72319 }
72320
72321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72322         LDKChannelUsage this_ptr_conv;
72323         this_ptr_conv.inner = untag_ptr(this_ptr);
72324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72326         this_ptr_conv.is_owned = false;
72327         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
72328 }
72329
72330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr) {
72331         LDKChannelUsage this_ptr_conv;
72332         this_ptr_conv.inner = untag_ptr(this_ptr);
72333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72335         this_ptr_conv.is_owned = false;
72336         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
72337         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
72338         int64_t ret_ref = tag_ptr(ret_copy, true);
72339         return ret_ref;
72340 }
72341
72342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72343         LDKChannelUsage this_ptr_conv;
72344         this_ptr_conv.inner = untag_ptr(this_ptr);
72345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72347         this_ptr_conv.is_owned = false;
72348         void* val_ptr = untag_ptr(val);
72349         CHECK_ACCESS(val_ptr);
72350         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
72351         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
72352         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
72353 }
72354
72355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1new(JNIEnv *env, jclass clz, int64_t amount_msat_arg, int64_t inflight_htlc_msat_arg, int64_t effective_capacity_arg) {
72356         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
72357         CHECK_ACCESS(effective_capacity_arg_ptr);
72358         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
72359         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
72360         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
72361         int64_t ret_ref = 0;
72362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72364         return ret_ref;
72365 }
72366
72367 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
72368         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
72369         int64_t ret_ref = 0;
72370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72372         return ret_ref;
72373 }
72374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72375         LDKChannelUsage arg_conv;
72376         arg_conv.inner = untag_ptr(arg);
72377         arg_conv.is_owned = ptr_is_owned(arg);
72378         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72379         arg_conv.is_owned = false;
72380         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
72381         return ret_conv;
72382 }
72383
72384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72385         LDKChannelUsage orig_conv;
72386         orig_conv.inner = untag_ptr(orig);
72387         orig_conv.is_owned = ptr_is_owned(orig);
72388         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72389         orig_conv.is_owned = false;
72390         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
72391         int64_t ret_ref = 0;
72392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72394         return ret_ref;
72395 }
72396
72397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72398         LDKFixedPenaltyScorer this_obj_conv;
72399         this_obj_conv.inner = untag_ptr(this_obj);
72400         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72402         FixedPenaltyScorer_free(this_obj_conv);
72403 }
72404
72405 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
72406         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
72407         int64_t ret_ref = 0;
72408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72410         return ret_ref;
72411 }
72412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72413         LDKFixedPenaltyScorer arg_conv;
72414         arg_conv.inner = untag_ptr(arg);
72415         arg_conv.is_owned = ptr_is_owned(arg);
72416         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72417         arg_conv.is_owned = false;
72418         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
72419         return ret_conv;
72420 }
72421
72422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72423         LDKFixedPenaltyScorer orig_conv;
72424         orig_conv.inner = untag_ptr(orig);
72425         orig_conv.is_owned = ptr_is_owned(orig);
72426         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72427         orig_conv.is_owned = false;
72428         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
72429         int64_t ret_ref = 0;
72430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72432         return ret_ref;
72433 }
72434
72435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
72436         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
72437         int64_t ret_ref = 0;
72438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72440         return ret_ref;
72441 }
72442
72443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
72444         LDKFixedPenaltyScorer this_arg_conv;
72445         this_arg_conv.inner = untag_ptr(this_arg);
72446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72448         this_arg_conv.is_owned = false;
72449         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
72450         *ret_ret = FixedPenaltyScorer_as_ScoreLookUp(&this_arg_conv);
72451         return tag_ptr(ret_ret, true);
72452 }
72453
72454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
72455         LDKFixedPenaltyScorer this_arg_conv;
72456         this_arg_conv.inner = untag_ptr(this_arg);
72457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72459         this_arg_conv.is_owned = false;
72460         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
72461         *ret_ret = FixedPenaltyScorer_as_ScoreUpdate(&this_arg_conv);
72462         return tag_ptr(ret_ret, true);
72463 }
72464
72465 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
72466         LDKFixedPenaltyScorer obj_conv;
72467         obj_conv.inner = untag_ptr(obj);
72468         obj_conv.is_owned = ptr_is_owned(obj);
72469         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72470         obj_conv.is_owned = false;
72471         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
72472         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72473         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72474         CVec_u8Z_free(ret_var);
72475         return ret_arr;
72476 }
72477
72478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
72479         LDKu8slice ser_ref;
72480         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
72481         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
72482         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
72483         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
72484         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
72485         return tag_ptr(ret_conv, true);
72486 }
72487
72488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72489         LDKProbabilisticScorer this_obj_conv;
72490         this_obj_conv.inner = untag_ptr(this_obj);
72491         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72493         ProbabilisticScorer_free(this_obj_conv);
72494 }
72495
72496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72497         LDKProbabilisticScoringFeeParameters this_obj_conv;
72498         this_obj_conv.inner = untag_ptr(this_obj);
72499         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72501         ProbabilisticScoringFeeParameters_free(this_obj_conv);
72502 }
72503
72504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
72505         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72506         this_ptr_conv.inner = untag_ptr(this_ptr);
72507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72509         this_ptr_conv.is_owned = false;
72510         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
72511         return ret_conv;
72512 }
72513
72514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72515         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72516         this_ptr_conv.inner = untag_ptr(this_ptr);
72517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72519         this_ptr_conv.is_owned = false;
72520         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
72521 }
72522
72523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
72524         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72525         this_ptr_conv.inner = untag_ptr(this_ptr);
72526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72528         this_ptr_conv.is_owned = false;
72529         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
72530         return ret_conv;
72531 }
72532
72533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72534         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72535         this_ptr_conv.inner = untag_ptr(this_ptr);
72536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72538         this_ptr_conv.is_owned = false;
72539         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
72540 }
72541
72542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
72543         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72544         this_ptr_conv.inner = untag_ptr(this_ptr);
72545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72547         this_ptr_conv.is_owned = false;
72548         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
72549         return ret_conv;
72550 }
72551
72552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72553         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72554         this_ptr_conv.inner = untag_ptr(this_ptr);
72555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72557         this_ptr_conv.is_owned = false;
72558         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
72559 }
72560
72561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
72562         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72563         this_ptr_conv.inner = untag_ptr(this_ptr);
72564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72566         this_ptr_conv.is_owned = false;
72567         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
72568         return ret_conv;
72569 }
72570
72571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72572         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72573         this_ptr_conv.inner = untag_ptr(this_ptr);
72574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72576         this_ptr_conv.is_owned = false;
72577         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
72578 }
72579
72580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1historical_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
72581         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72582         this_ptr_conv.inner = untag_ptr(this_ptr);
72583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72585         this_ptr_conv.is_owned = false;
72586         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
72587         return ret_conv;
72588 }
72589
72590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1historical_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72591         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72592         this_ptr_conv.inner = untag_ptr(this_ptr);
72593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72595         this_ptr_conv.is_owned = false;
72596         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
72597 }
72598
72599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1historical_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
72600         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72601         this_ptr_conv.inner = untag_ptr(this_ptr);
72602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72604         this_ptr_conv.is_owned = false;
72605         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
72606         return ret_conv;
72607 }
72608
72609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1historical_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72610         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72611         this_ptr_conv.inner = untag_ptr(this_ptr);
72612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72614         this_ptr_conv.is_owned = false;
72615         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
72616 }
72617
72618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
72619         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72620         this_ptr_conv.inner = untag_ptr(this_ptr);
72621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72623         this_ptr_conv.is_owned = false;
72624         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
72625         return ret_conv;
72626 }
72627
72628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72629         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72630         this_ptr_conv.inner = untag_ptr(this_ptr);
72631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72633         this_ptr_conv.is_owned = false;
72634         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
72635 }
72636
72637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
72638         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72639         this_ptr_conv.inner = untag_ptr(this_ptr);
72640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72642         this_ptr_conv.is_owned = false;
72643         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
72644         return ret_conv;
72645 }
72646
72647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72648         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72649         this_ptr_conv.inner = untag_ptr(this_ptr);
72650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72652         this_ptr_conv.is_owned = false;
72653         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
72654 }
72655
72656 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1linear_1success_1probability(JNIEnv *env, jclass clz, int64_t this_ptr) {
72657         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72658         this_ptr_conv.inner = untag_ptr(this_ptr);
72659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72661         this_ptr_conv.is_owned = false;
72662         jboolean ret_conv = ProbabilisticScoringFeeParameters_get_linear_success_probability(&this_ptr_conv);
72663         return ret_conv;
72664 }
72665
72666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1linear_1success_1probability(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
72667         LDKProbabilisticScoringFeeParameters this_ptr_conv;
72668         this_ptr_conv.inner = untag_ptr(this_ptr);
72669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72671         this_ptr_conv.is_owned = false;
72672         ProbabilisticScoringFeeParameters_set_linear_success_probability(&this_ptr_conv, val);
72673 }
72674
72675 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
72676         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
72677         int64_t ret_ref = 0;
72678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72680         return ret_ref;
72681 }
72682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72683         LDKProbabilisticScoringFeeParameters arg_conv;
72684         arg_conv.inner = untag_ptr(arg);
72685         arg_conv.is_owned = ptr_is_owned(arg);
72686         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72687         arg_conv.is_owned = false;
72688         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
72689         return ret_conv;
72690 }
72691
72692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72693         LDKProbabilisticScoringFeeParameters orig_conv;
72694         orig_conv.inner = untag_ptr(orig);
72695         orig_conv.is_owned = ptr_is_owned(orig);
72696         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72697         orig_conv.is_owned = false;
72698         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
72699         int64_t ret_ref = 0;
72700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72702         return ret_ref;
72703 }
72704
72705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1default(JNIEnv *env, jclass clz) {
72706         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
72707         int64_t ret_ref = 0;
72708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72710         return ret_ref;
72711 }
72712
72713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1add_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
72714         LDKProbabilisticScoringFeeParameters this_arg_conv;
72715         this_arg_conv.inner = untag_ptr(this_arg);
72716         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72718         this_arg_conv.is_owned = false;
72719         LDKNodeId node_id_conv;
72720         node_id_conv.inner = untag_ptr(node_id);
72721         node_id_conv.is_owned = ptr_is_owned(node_id);
72722         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
72723         node_id_conv.is_owned = false;
72724         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
72725 }
72726
72727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1add_1banned_1from_1list(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray node_ids) {
72728         LDKProbabilisticScoringFeeParameters this_arg_conv;
72729         this_arg_conv.inner = untag_ptr(this_arg);
72730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72732         this_arg_conv.is_owned = false;
72733         LDKCVec_NodeIdZ node_ids_constr;
72734         node_ids_constr.datalen = (*env)->GetArrayLength(env, node_ids);
72735         if (node_ids_constr.datalen > 0)
72736                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
72737         else
72738                 node_ids_constr.data = NULL;
72739         int64_t* node_ids_vals = (*env)->GetLongArrayElements (env, node_ids, NULL);
72740         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
72741                 int64_t node_ids_conv_8 = node_ids_vals[i];
72742                 LDKNodeId node_ids_conv_8_conv;
72743                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
72744                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
72745                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
72746                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
72747                 node_ids_constr.data[i] = node_ids_conv_8_conv;
72748         }
72749         (*env)->ReleaseLongArrayElements(env, node_ids, node_ids_vals, 0);
72750         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
72751 }
72752
72753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1remove_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
72754         LDKProbabilisticScoringFeeParameters this_arg_conv;
72755         this_arg_conv.inner = untag_ptr(this_arg);
72756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72758         this_arg_conv.is_owned = false;
72759         LDKNodeId node_id_conv;
72760         node_id_conv.inner = untag_ptr(node_id);
72761         node_id_conv.is_owned = ptr_is_owned(node_id);
72762         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
72763         node_id_conv.is_owned = false;
72764         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
72765 }
72766
72767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id, int64_t penalty) {
72768         LDKProbabilisticScoringFeeParameters this_arg_conv;
72769         this_arg_conv.inner = untag_ptr(this_arg);
72770         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72772         this_arg_conv.is_owned = false;
72773         LDKNodeId node_id_conv;
72774         node_id_conv.inner = untag_ptr(node_id);
72775         node_id_conv.is_owned = ptr_is_owned(node_id);
72776         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
72777         node_id_conv.is_owned = false;
72778         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
72779 }
72780
72781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1remove_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
72782         LDKProbabilisticScoringFeeParameters this_arg_conv;
72783         this_arg_conv.inner = untag_ptr(this_arg);
72784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72786         this_arg_conv.is_owned = false;
72787         LDKNodeId node_id_conv;
72788         node_id_conv.inner = untag_ptr(node_id);
72789         node_id_conv.is_owned = ptr_is_owned(node_id);
72790         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
72791         node_id_conv.is_owned = false;
72792         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
72793 }
72794
72795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clear_1manual_1penalties(JNIEnv *env, jclass clz, int64_t this_arg) {
72796         LDKProbabilisticScoringFeeParameters this_arg_conv;
72797         this_arg_conv.inner = untag_ptr(this_arg);
72798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72800         this_arg_conv.is_owned = false;
72801         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
72802 }
72803
72804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72805         LDKProbabilisticScoringDecayParameters this_obj_conv;
72806         this_obj_conv.inner = untag_ptr(this_obj);
72807         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72809         ProbabilisticScoringDecayParameters_free(this_obj_conv);
72810 }
72811
72812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1get_1historical_1no_1updates_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
72813         LDKProbabilisticScoringDecayParameters this_ptr_conv;
72814         this_ptr_conv.inner = untag_ptr(this_ptr);
72815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72817         this_ptr_conv.is_owned = false;
72818         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
72819         return ret_conv;
72820 }
72821
72822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1set_1historical_1no_1updates_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72823         LDKProbabilisticScoringDecayParameters this_ptr_conv;
72824         this_ptr_conv.inner = untag_ptr(this_ptr);
72825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72827         this_ptr_conv.is_owned = false;
72828         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
72829 }
72830
72831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
72832         LDKProbabilisticScoringDecayParameters this_ptr_conv;
72833         this_ptr_conv.inner = untag_ptr(this_ptr);
72834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72836         this_ptr_conv.is_owned = false;
72837         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
72838         return ret_conv;
72839 }
72840
72841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1set_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72842         LDKProbabilisticScoringDecayParameters this_ptr_conv;
72843         this_ptr_conv.inner = untag_ptr(this_ptr);
72844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72846         this_ptr_conv.is_owned = false;
72847         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
72848 }
72849
72850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1new(JNIEnv *env, jclass clz, int64_t historical_no_updates_half_life_arg, int64_t liquidity_offset_half_life_arg) {
72851         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
72852         int64_t ret_ref = 0;
72853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72855         return ret_ref;
72856 }
72857
72858 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
72859         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
72860         int64_t ret_ref = 0;
72861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72863         return ret_ref;
72864 }
72865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72866         LDKProbabilisticScoringDecayParameters arg_conv;
72867         arg_conv.inner = untag_ptr(arg);
72868         arg_conv.is_owned = ptr_is_owned(arg);
72869         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72870         arg_conv.is_owned = false;
72871         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
72872         return ret_conv;
72873 }
72874
72875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72876         LDKProbabilisticScoringDecayParameters orig_conv;
72877         orig_conv.inner = untag_ptr(orig);
72878         orig_conv.is_owned = ptr_is_owned(orig);
72879         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72880         orig_conv.is_owned = false;
72881         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
72882         int64_t ret_ref = 0;
72883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72885         return ret_ref;
72886 }
72887
72888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1default(JNIEnv *env, jclass clz) {
72889         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
72890         int64_t ret_ref = 0;
72891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72893         return ret_ref;
72894 }
72895
72896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1new(JNIEnv *env, jclass clz, int64_t decay_params, int64_t network_graph, int64_t logger) {
72897         LDKProbabilisticScoringDecayParameters decay_params_conv;
72898         decay_params_conv.inner = untag_ptr(decay_params);
72899         decay_params_conv.is_owned = ptr_is_owned(decay_params);
72900         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
72901         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
72902         LDKNetworkGraph network_graph_conv;
72903         network_graph_conv.inner = untag_ptr(network_graph);
72904         network_graph_conv.is_owned = ptr_is_owned(network_graph);
72905         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
72906         network_graph_conv.is_owned = false;
72907         void* logger_ptr = untag_ptr(logger);
72908         CHECK_ACCESS(logger_ptr);
72909         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
72910         if (logger_conv.free == LDKLogger_JCalls_free) {
72911                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
72912                 LDKLogger_JCalls_cloned(&logger_conv);
72913         }
72914         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
72915         int64_t ret_ref = 0;
72916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72918         return ret_ref;
72919 }
72920
72921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1debug_1log_1liquidity_1stats(JNIEnv *env, jclass clz, int64_t this_arg) {
72922         LDKProbabilisticScorer this_arg_conv;
72923         this_arg_conv.inner = untag_ptr(this_arg);
72924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72926         this_arg_conv.is_owned = false;
72927         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
72928 }
72929
72930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1estimated_1channel_1liquidity_1range(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scid, int64_t target) {
72931         LDKProbabilisticScorer this_arg_conv;
72932         this_arg_conv.inner = untag_ptr(this_arg);
72933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72935         this_arg_conv.is_owned = false;
72936         LDKNodeId target_conv;
72937         target_conv.inner = untag_ptr(target);
72938         target_conv.is_owned = ptr_is_owned(target);
72939         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
72940         target_conv.is_owned = false;
72941         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
72942         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
72943         int64_t ret_ref = tag_ptr(ret_copy, true);
72944         return ret_ref;
72945 }
72946
72947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1historical_1estimated_1channel_1liquidity_1probabilities(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scid, int64_t target) {
72948         LDKProbabilisticScorer this_arg_conv;
72949         this_arg_conv.inner = untag_ptr(this_arg);
72950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72952         this_arg_conv.is_owned = false;
72953         LDKNodeId target_conv;
72954         target_conv.inner = untag_ptr(target);
72955         target_conv.is_owned = ptr_is_owned(target);
72956         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
72957         target_conv.is_owned = false;
72958         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
72959         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
72960         int64_t ret_ref = tag_ptr(ret_copy, true);
72961         return ret_ref;
72962 }
72963
72964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1historical_1estimated_1payment_1success_1probability(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scid, int64_t target, int64_t amount_msat, int64_t params) {
72965         LDKProbabilisticScorer this_arg_conv;
72966         this_arg_conv.inner = untag_ptr(this_arg);
72967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72969         this_arg_conv.is_owned = false;
72970         LDKNodeId target_conv;
72971         target_conv.inner = untag_ptr(target);
72972         target_conv.is_owned = ptr_is_owned(target);
72973         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
72974         target_conv.is_owned = false;
72975         LDKProbabilisticScoringFeeParameters params_conv;
72976         params_conv.inner = untag_ptr(params);
72977         params_conv.is_owned = ptr_is_owned(params);
72978         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
72979         params_conv.is_owned = false;
72980         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
72981         *ret_copy = ProbabilisticScorer_historical_estimated_payment_success_probability(&this_arg_conv, scid, &target_conv, amount_msat, &params_conv);
72982         int64_t ret_ref = tag_ptr(ret_copy, true);
72983         return ret_ref;
72984 }
72985
72986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
72987         LDKProbabilisticScorer this_arg_conv;
72988         this_arg_conv.inner = untag_ptr(this_arg);
72989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72991         this_arg_conv.is_owned = false;
72992         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
72993         *ret_ret = ProbabilisticScorer_as_ScoreLookUp(&this_arg_conv);
72994         return tag_ptr(ret_ret, true);
72995 }
72996
72997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
72998         LDKProbabilisticScorer this_arg_conv;
72999         this_arg_conv.inner = untag_ptr(this_arg);
73000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73002         this_arg_conv.is_owned = false;
73003         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
73004         *ret_ret = ProbabilisticScorer_as_ScoreUpdate(&this_arg_conv);
73005         return tag_ptr(ret_ret, true);
73006 }
73007
73008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
73009         LDKProbabilisticScorer this_arg_conv;
73010         this_arg_conv.inner = untag_ptr(this_arg);
73011         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73013         this_arg_conv.is_owned = false;
73014         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
73015         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
73016         return tag_ptr(ret_ret, true);
73017 }
73018
73019 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
73020         LDKProbabilisticScorer obj_conv;
73021         obj_conv.inner = untag_ptr(obj);
73022         obj_conv.is_owned = ptr_is_owned(obj);
73023         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73024         obj_conv.is_owned = false;
73025         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
73026         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
73027         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
73028         CVec_u8Z_free(ret_var);
73029         return ret_arr;
73030 }
73031
73032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg_a, int64_t arg_b, int64_t arg_c) {
73033         LDKu8slice ser_ref;
73034         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
73035         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
73036         LDKProbabilisticScoringDecayParameters arg_a_conv;
73037         arg_a_conv.inner = untag_ptr(arg_a);
73038         arg_a_conv.is_owned = ptr_is_owned(arg_a);
73039         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
73040         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
73041         LDKNetworkGraph arg_b_conv;
73042         arg_b_conv.inner = untag_ptr(arg_b);
73043         arg_b_conv.is_owned = ptr_is_owned(arg_b);
73044         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
73045         arg_b_conv.is_owned = false;
73046         void* arg_c_ptr = untag_ptr(arg_c);
73047         CHECK_ACCESS(arg_c_ptr);
73048         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
73049         if (arg_c_conv.free == LDKLogger_JCalls_free) {
73050                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73051                 LDKLogger_JCalls_cloned(&arg_c_conv);
73052         }
73053         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
73054         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
73055         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
73056         return tag_ptr(ret_conv, true);
73057 }
73058
73059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73060         LDKDelayedPaymentOutputDescriptor this_obj_conv;
73061         this_obj_conv.inner = untag_ptr(this_obj);
73062         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73064         DelayedPaymentOutputDescriptor_free(this_obj_conv);
73065 }
73066
73067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
73068         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73069         this_ptr_conv.inner = untag_ptr(this_ptr);
73070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73072         this_ptr_conv.is_owned = false;
73073         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
73074         int64_t ret_ref = 0;
73075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73077         return ret_ref;
73078 }
73079
73080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73081         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73082         this_ptr_conv.inner = untag_ptr(this_ptr);
73083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73085         this_ptr_conv.is_owned = false;
73086         LDKOutPoint val_conv;
73087         val_conv.inner = untag_ptr(val);
73088         val_conv.is_owned = ptr_is_owned(val);
73089         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73090         val_conv = OutPoint_clone(&val_conv);
73091         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
73092 }
73093
73094 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
73095         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73096         this_ptr_conv.inner = untag_ptr(this_ptr);
73097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73099         this_ptr_conv.is_owned = false;
73100         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
73101         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
73102         return ret_arr;
73103 }
73104
73105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
73106         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73107         this_ptr_conv.inner = untag_ptr(this_ptr);
73108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73110         this_ptr_conv.is_owned = false;
73111         LDKPublicKey val_ref;
73112         CHECK((*env)->GetArrayLength(env, val) == 33);
73113         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
73114         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
73115 }
73116
73117 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
73118         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73119         this_ptr_conv.inner = untag_ptr(this_ptr);
73120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73122         this_ptr_conv.is_owned = false;
73123         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
73124         return ret_conv;
73125 }
73126
73127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
73128         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73129         this_ptr_conv.inner = untag_ptr(this_ptr);
73130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73132         this_ptr_conv.is_owned = false;
73133         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
73134 }
73135
73136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
73137         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73138         this_ptr_conv.inner = untag_ptr(this_ptr);
73139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73141         this_ptr_conv.is_owned = false;
73142         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
73143         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
73144         return tag_ptr(ret_ref, true);
73145 }
73146
73147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73148         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73149         this_ptr_conv.inner = untag_ptr(this_ptr);
73150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73152         this_ptr_conv.is_owned = false;
73153         void* val_ptr = untag_ptr(val);
73154         CHECK_ACCESS(val_ptr);
73155         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
73156         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
73157         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
73158 }
73159
73160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
73161         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73162         this_ptr_conv.inner = untag_ptr(this_ptr);
73163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73165         this_ptr_conv.is_owned = false;
73166         LDKRevocationKey ret_var = DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv);
73167         int64_t ret_ref = 0;
73168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73170         return ret_ref;
73171 }
73172
73173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73174         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73175         this_ptr_conv.inner = untag_ptr(this_ptr);
73176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73178         this_ptr_conv.is_owned = false;
73179         LDKRevocationKey val_conv;
73180         val_conv.inner = untag_ptr(val);
73181         val_conv.is_owned = ptr_is_owned(val);
73182         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73183         val_conv = RevocationKey_clone(&val_conv);
73184         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_conv);
73185 }
73186
73187 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
73188         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73189         this_ptr_conv.inner = untag_ptr(this_ptr);
73190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73192         this_ptr_conv.is_owned = false;
73193         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
73194         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
73195         return ret_arr;
73196 }
73197
73198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
73199         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73200         this_ptr_conv.inner = untag_ptr(this_ptr);
73201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73203         this_ptr_conv.is_owned = false;
73204         LDKThirtyTwoBytes val_ref;
73205         CHECK((*env)->GetArrayLength(env, val) == 32);
73206         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
73207         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
73208 }
73209
73210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
73211         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73212         this_ptr_conv.inner = untag_ptr(this_ptr);
73213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73215         this_ptr_conv.is_owned = false;
73216         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
73217         return ret_conv;
73218 }
73219
73220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73221         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
73222         this_ptr_conv.inner = untag_ptr(this_ptr);
73223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73225         this_ptr_conv.is_owned = false;
73226         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
73227 }
73228
73229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int8_tArray per_commitment_point_arg, int16_t to_self_delay_arg, int64_t output_arg, int64_t revocation_pubkey_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
73230         LDKOutPoint outpoint_arg_conv;
73231         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
73232         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
73233         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
73234         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
73235         LDKPublicKey per_commitment_point_arg_ref;
73236         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
73237         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
73238         void* output_arg_ptr = untag_ptr(output_arg);
73239         CHECK_ACCESS(output_arg_ptr);
73240         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
73241         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
73242         LDKRevocationKey revocation_pubkey_arg_conv;
73243         revocation_pubkey_arg_conv.inner = untag_ptr(revocation_pubkey_arg);
73244         revocation_pubkey_arg_conv.is_owned = ptr_is_owned(revocation_pubkey_arg);
73245         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_pubkey_arg_conv);
73246         revocation_pubkey_arg_conv = RevocationKey_clone(&revocation_pubkey_arg_conv);
73247         LDKThirtyTwoBytes channel_keys_id_arg_ref;
73248         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
73249         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
73250         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_new(outpoint_arg_conv, per_commitment_point_arg_ref, to_self_delay_arg, output_arg_conv, revocation_pubkey_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
73251         int64_t ret_ref = 0;
73252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73254         return ret_ref;
73255 }
73256
73257 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
73258         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
73259         int64_t ret_ref = 0;
73260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73262         return ret_ref;
73263 }
73264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73265         LDKDelayedPaymentOutputDescriptor arg_conv;
73266         arg_conv.inner = untag_ptr(arg);
73267         arg_conv.is_owned = ptr_is_owned(arg);
73268         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73269         arg_conv.is_owned = false;
73270         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
73271         return ret_conv;
73272 }
73273
73274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73275         LDKDelayedPaymentOutputDescriptor orig_conv;
73276         orig_conv.inner = untag_ptr(orig);
73277         orig_conv.is_owned = ptr_is_owned(orig);
73278         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73279         orig_conv.is_owned = false;
73280         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
73281         int64_t ret_ref = 0;
73282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73284         return ret_ref;
73285 }
73286
73287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
73288         LDKDelayedPaymentOutputDescriptor o_conv;
73289         o_conv.inner = untag_ptr(o);
73290         o_conv.is_owned = ptr_is_owned(o);
73291         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73292         o_conv.is_owned = false;
73293         int64_t ret_conv = DelayedPaymentOutputDescriptor_hash(&o_conv);
73294         return ret_conv;
73295 }
73296
73297 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73298         LDKDelayedPaymentOutputDescriptor a_conv;
73299         a_conv.inner = untag_ptr(a);
73300         a_conv.is_owned = ptr_is_owned(a);
73301         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73302         a_conv.is_owned = false;
73303         LDKDelayedPaymentOutputDescriptor b_conv;
73304         b_conv.inner = untag_ptr(b);
73305         b_conv.is_owned = ptr_is_owned(b);
73306         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73307         b_conv.is_owned = false;
73308         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
73309         return ret_conv;
73310 }
73311
73312 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
73313         LDKDelayedPaymentOutputDescriptor obj_conv;
73314         obj_conv.inner = untag_ptr(obj);
73315         obj_conv.is_owned = ptr_is_owned(obj);
73316         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73317         obj_conv.is_owned = false;
73318         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
73319         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
73320         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
73321         CVec_u8Z_free(ret_var);
73322         return ret_arr;
73323 }
73324
73325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
73326         LDKu8slice ser_ref;
73327         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
73328         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
73329         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
73330         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
73331         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
73332         return tag_ptr(ret_conv, true);
73333 }
73334
73335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73336         LDKStaticPaymentOutputDescriptor this_obj_conv;
73337         this_obj_conv.inner = untag_ptr(this_obj);
73338         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73340         StaticPaymentOutputDescriptor_free(this_obj_conv);
73341 }
73342
73343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
73344         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73345         this_ptr_conv.inner = untag_ptr(this_ptr);
73346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73348         this_ptr_conv.is_owned = false;
73349         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
73350         int64_t ret_ref = 0;
73351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73353         return ret_ref;
73354 }
73355
73356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73357         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73358         this_ptr_conv.inner = untag_ptr(this_ptr);
73359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73361         this_ptr_conv.is_owned = false;
73362         LDKOutPoint val_conv;
73363         val_conv.inner = untag_ptr(val);
73364         val_conv.is_owned = ptr_is_owned(val);
73365         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73366         val_conv = OutPoint_clone(&val_conv);
73367         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
73368 }
73369
73370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
73371         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73372         this_ptr_conv.inner = untag_ptr(this_ptr);
73373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73375         this_ptr_conv.is_owned = false;
73376         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
73377         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
73378         return tag_ptr(ret_ref, true);
73379 }
73380
73381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73382         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73383         this_ptr_conv.inner = untag_ptr(this_ptr);
73384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73386         this_ptr_conv.is_owned = false;
73387         void* val_ptr = untag_ptr(val);
73388         CHECK_ACCESS(val_ptr);
73389         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
73390         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
73391         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
73392 }
73393
73394 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
73395         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73396         this_ptr_conv.inner = untag_ptr(this_ptr);
73397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73399         this_ptr_conv.is_owned = false;
73400         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
73401         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
73402         return ret_arr;
73403 }
73404
73405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
73406         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73407         this_ptr_conv.inner = untag_ptr(this_ptr);
73408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73410         this_ptr_conv.is_owned = false;
73411         LDKThirtyTwoBytes val_ref;
73412         CHECK((*env)->GetArrayLength(env, val) == 32);
73413         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
73414         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
73415 }
73416
73417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
73418         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73419         this_ptr_conv.inner = untag_ptr(this_ptr);
73420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73422         this_ptr_conv.is_owned = false;
73423         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
73424         return ret_conv;
73425 }
73426
73427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73428         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73429         this_ptr_conv.inner = untag_ptr(this_ptr);
73430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73432         this_ptr_conv.is_owned = false;
73433         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
73434 }
73435
73436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
73437         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73438         this_ptr_conv.inner = untag_ptr(this_ptr);
73439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73441         this_ptr_conv.is_owned = false;
73442         LDKChannelTransactionParameters ret_var = StaticPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
73443         int64_t ret_ref = 0;
73444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73446         return ret_ref;
73447 }
73448
73449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73450         LDKStaticPaymentOutputDescriptor this_ptr_conv;
73451         this_ptr_conv.inner = untag_ptr(this_ptr);
73452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73454         this_ptr_conv.is_owned = false;
73455         LDKChannelTransactionParameters val_conv;
73456         val_conv.inner = untag_ptr(val);
73457         val_conv.is_owned = ptr_is_owned(val);
73458         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73459         val_conv = ChannelTransactionParameters_clone(&val_conv);
73460         StaticPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
73461 }
73462
73463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int64_t output_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg, int64_t channel_transaction_parameters_arg) {
73464         LDKOutPoint outpoint_arg_conv;
73465         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
73466         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
73467         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
73468         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
73469         void* output_arg_ptr = untag_ptr(output_arg);
73470         CHECK_ACCESS(output_arg_ptr);
73471         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
73472         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
73473         LDKThirtyTwoBytes channel_keys_id_arg_ref;
73474         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
73475         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
73476         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
73477         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
73478         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
73479         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
73480         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
73481         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg, channel_transaction_parameters_arg_conv);
73482         int64_t ret_ref = 0;
73483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73485         return ret_ref;
73486 }
73487
73488 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
73489         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
73490         int64_t ret_ref = 0;
73491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73493         return ret_ref;
73494 }
73495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73496         LDKStaticPaymentOutputDescriptor arg_conv;
73497         arg_conv.inner = untag_ptr(arg);
73498         arg_conv.is_owned = ptr_is_owned(arg);
73499         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73500         arg_conv.is_owned = false;
73501         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
73502         return ret_conv;
73503 }
73504
73505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73506         LDKStaticPaymentOutputDescriptor orig_conv;
73507         orig_conv.inner = untag_ptr(orig);
73508         orig_conv.is_owned = ptr_is_owned(orig);
73509         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73510         orig_conv.is_owned = false;
73511         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
73512         int64_t ret_ref = 0;
73513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73515         return ret_ref;
73516 }
73517
73518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
73519         LDKStaticPaymentOutputDescriptor o_conv;
73520         o_conv.inner = untag_ptr(o);
73521         o_conv.is_owned = ptr_is_owned(o);
73522         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73523         o_conv.is_owned = false;
73524         int64_t ret_conv = StaticPaymentOutputDescriptor_hash(&o_conv);
73525         return ret_conv;
73526 }
73527
73528 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73529         LDKStaticPaymentOutputDescriptor a_conv;
73530         a_conv.inner = untag_ptr(a);
73531         a_conv.is_owned = ptr_is_owned(a);
73532         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73533         a_conv.is_owned = false;
73534         LDKStaticPaymentOutputDescriptor b_conv;
73535         b_conv.inner = untag_ptr(b);
73536         b_conv.is_owned = ptr_is_owned(b);
73537         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73538         b_conv.is_owned = false;
73539         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
73540         return ret_conv;
73541 }
73542
73543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
73544         LDKStaticPaymentOutputDescriptor this_arg_conv;
73545         this_arg_conv.inner = untag_ptr(this_arg);
73546         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73548         this_arg_conv.is_owned = false;
73549         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
73550         *ret_copy = StaticPaymentOutputDescriptor_witness_script(&this_arg_conv);
73551         int64_t ret_ref = tag_ptr(ret_copy, true);
73552         return ret_ref;
73553 }
73554
73555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1max_1witness_1length(JNIEnv *env, jclass clz, int64_t this_arg) {
73556         LDKStaticPaymentOutputDescriptor this_arg_conv;
73557         this_arg_conv.inner = untag_ptr(this_arg);
73558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73560         this_arg_conv.is_owned = false;
73561         int64_t ret_conv = StaticPaymentOutputDescriptor_max_witness_length(&this_arg_conv);
73562         return ret_conv;
73563 }
73564
73565 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
73566         LDKStaticPaymentOutputDescriptor obj_conv;
73567         obj_conv.inner = untag_ptr(obj);
73568         obj_conv.is_owned = ptr_is_owned(obj);
73569         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73570         obj_conv.is_owned = false;
73571         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
73572         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
73573         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
73574         CVec_u8Z_free(ret_var);
73575         return ret_arr;
73576 }
73577
73578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
73579         LDKu8slice ser_ref;
73580         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
73581         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
73582         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
73583         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
73584         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
73585         return tag_ptr(ret_conv, true);
73586 }
73587
73588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
73589         if (!ptr_is_owned(this_ptr)) return;
73590         void* this_ptr_ptr = untag_ptr(this_ptr);
73591         CHECK_ACCESS(this_ptr_ptr);
73592         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
73593         FREE(untag_ptr(this_ptr));
73594         SpendableOutputDescriptor_free(this_ptr_conv);
73595 }
73596
73597 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
73598         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
73599         *ret_copy = SpendableOutputDescriptor_clone(arg);
73600         int64_t ret_ref = tag_ptr(ret_copy, true);
73601         return ret_ref;
73602 }
73603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73604         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
73605         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
73606         return ret_conv;
73607 }
73608
73609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73610         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
73611         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
73612         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
73613         int64_t ret_ref = tag_ptr(ret_copy, true);
73614         return ret_ref;
73615 }
73616
73617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output, int8_tArray channel_keys_id) {
73618         LDKOutPoint outpoint_conv;
73619         outpoint_conv.inner = untag_ptr(outpoint);
73620         outpoint_conv.is_owned = ptr_is_owned(outpoint);
73621         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
73622         outpoint_conv = OutPoint_clone(&outpoint_conv);
73623         void* output_ptr = untag_ptr(output);
73624         CHECK_ACCESS(output_ptr);
73625         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
73626         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
73627         LDKThirtyTwoBytes channel_keys_id_ref;
73628         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
73629         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
73630         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
73631         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv, channel_keys_id_ref);
73632         int64_t ret_ref = tag_ptr(ret_copy, true);
73633         return ret_ref;
73634 }
73635
73636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
73637         LDKDelayedPaymentOutputDescriptor a_conv;
73638         a_conv.inner = untag_ptr(a);
73639         a_conv.is_owned = ptr_is_owned(a);
73640         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73641         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
73642         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
73643         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
73644         int64_t ret_ref = tag_ptr(ret_copy, true);
73645         return ret_ref;
73646 }
73647
73648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
73649         LDKStaticPaymentOutputDescriptor a_conv;
73650         a_conv.inner = untag_ptr(a);
73651         a_conv.is_owned = ptr_is_owned(a);
73652         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73653         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
73654         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
73655         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
73656         int64_t ret_ref = tag_ptr(ret_copy, true);
73657         return ret_ref;
73658 }
73659
73660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
73661         LDKSpendableOutputDescriptor* o_conv = (LDKSpendableOutputDescriptor*)untag_ptr(o);
73662         int64_t ret_conv = SpendableOutputDescriptor_hash(o_conv);
73663         return ret_conv;
73664 }
73665
73666 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73667         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
73668         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
73669         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
73670         return ret_conv;
73671 }
73672
73673 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
73674         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
73675         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
73676         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
73677         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
73678         CVec_u8Z_free(ret_var);
73679         return ret_arr;
73680 }
73681
73682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
73683         LDKu8slice ser_ref;
73684         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
73685         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
73686         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
73687         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
73688         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
73689         return tag_ptr(ret_conv, true);
73690 }
73691
73692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1create_1spendable_1outputs_1psbt(JNIEnv *env, jclass clz, int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight, int64_t locktime) {
73693         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
73694         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
73695         if (descriptors_constr.datalen > 0)
73696                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
73697         else
73698                 descriptors_constr.data = NULL;
73699         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
73700         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
73701                 int64_t descriptors_conv_27 = descriptors_vals[b];
73702                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
73703                 CHECK_ACCESS(descriptors_conv_27_ptr);
73704                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
73705                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
73706                 descriptors_constr.data[b] = descriptors_conv_27_conv;
73707         }
73708         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
73709         LDKCVec_TxOutZ outputs_constr;
73710         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
73711         if (outputs_constr.datalen > 0)
73712                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
73713         else
73714                 outputs_constr.data = NULL;
73715         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
73716         for (size_t h = 0; h < outputs_constr.datalen; h++) {
73717                 int64_t outputs_conv_7 = outputs_vals[h];
73718                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
73719                 CHECK_ACCESS(outputs_conv_7_ptr);
73720                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
73721                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
73722                 outputs_constr.data[h] = outputs_conv_7_conv;
73723         }
73724         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
73725         LDKCVec_u8Z change_destination_script_ref;
73726         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
73727         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
73728         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
73729         void* locktime_ptr = untag_ptr(locktime);
73730         CHECK_ACCESS(locktime_ptr);
73731         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
73732         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
73733         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
73734         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
73735         return tag_ptr(ret_conv, true);
73736 }
73737
73738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73739         LDKChannelDerivationParameters this_obj_conv;
73740         this_obj_conv.inner = untag_ptr(this_obj);
73741         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73743         ChannelDerivationParameters_free(this_obj_conv);
73744 }
73745
73746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
73747         LDKChannelDerivationParameters this_ptr_conv;
73748         this_ptr_conv.inner = untag_ptr(this_ptr);
73749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73751         this_ptr_conv.is_owned = false;
73752         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
73753         return ret_conv;
73754 }
73755
73756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73757         LDKChannelDerivationParameters this_ptr_conv;
73758         this_ptr_conv.inner = untag_ptr(this_ptr);
73759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73761         this_ptr_conv.is_owned = false;
73762         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
73763 }
73764
73765 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
73766         LDKChannelDerivationParameters this_ptr_conv;
73767         this_ptr_conv.inner = untag_ptr(this_ptr);
73768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73770         this_ptr_conv.is_owned = false;
73771         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
73772         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv));
73773         return ret_arr;
73774 }
73775
73776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
73777         LDKChannelDerivationParameters this_ptr_conv;
73778         this_ptr_conv.inner = untag_ptr(this_ptr);
73779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73781         this_ptr_conv.is_owned = false;
73782         LDKThirtyTwoBytes val_ref;
73783         CHECK((*env)->GetArrayLength(env, val) == 32);
73784         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
73785         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
73786 }
73787
73788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
73789         LDKChannelDerivationParameters this_ptr_conv;
73790         this_ptr_conv.inner = untag_ptr(this_ptr);
73791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73793         this_ptr_conv.is_owned = false;
73794         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
73795         int64_t ret_ref = 0;
73796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73798         return ret_ref;
73799 }
73800
73801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73802         LDKChannelDerivationParameters this_ptr_conv;
73803         this_ptr_conv.inner = untag_ptr(this_ptr);
73804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73806         this_ptr_conv.is_owned = false;
73807         LDKChannelTransactionParameters val_conv;
73808         val_conv.inner = untag_ptr(val);
73809         val_conv.is_owned = ptr_is_owned(val);
73810         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73811         val_conv = ChannelTransactionParameters_clone(&val_conv);
73812         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
73813 }
73814
73815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1new(JNIEnv *env, jclass clz, int64_t value_satoshis_arg, int8_tArray keys_id_arg, int64_t transaction_parameters_arg) {
73816         LDKThirtyTwoBytes keys_id_arg_ref;
73817         CHECK((*env)->GetArrayLength(env, keys_id_arg) == 32);
73818         (*env)->GetByteArrayRegion(env, keys_id_arg, 0, 32, keys_id_arg_ref.data);
73819         LDKChannelTransactionParameters transaction_parameters_arg_conv;
73820         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
73821         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
73822         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
73823         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
73824         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
73825         int64_t ret_ref = 0;
73826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73828         return ret_ref;
73829 }
73830
73831 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
73832         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
73833         int64_t ret_ref = 0;
73834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73836         return ret_ref;
73837 }
73838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73839         LDKChannelDerivationParameters arg_conv;
73840         arg_conv.inner = untag_ptr(arg);
73841         arg_conv.is_owned = ptr_is_owned(arg);
73842         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73843         arg_conv.is_owned = false;
73844         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
73845         return ret_conv;
73846 }
73847
73848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73849         LDKChannelDerivationParameters orig_conv;
73850         orig_conv.inner = untag_ptr(orig);
73851         orig_conv.is_owned = ptr_is_owned(orig);
73852         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73853         orig_conv.is_owned = false;
73854         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
73855         int64_t ret_ref = 0;
73856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73858         return ret_ref;
73859 }
73860
73861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73862         LDKChannelDerivationParameters a_conv;
73863         a_conv.inner = untag_ptr(a);
73864         a_conv.is_owned = ptr_is_owned(a);
73865         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73866         a_conv.is_owned = false;
73867         LDKChannelDerivationParameters b_conv;
73868         b_conv.inner = untag_ptr(b);
73869         b_conv.is_owned = ptr_is_owned(b);
73870         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73871         b_conv.is_owned = false;
73872         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
73873         return ret_conv;
73874 }
73875
73876 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
73877         LDKChannelDerivationParameters obj_conv;
73878         obj_conv.inner = untag_ptr(obj);
73879         obj_conv.is_owned = ptr_is_owned(obj);
73880         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73881         obj_conv.is_owned = false;
73882         LDKCVec_u8Z ret_var = ChannelDerivationParameters_write(&obj_conv);
73883         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
73884         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
73885         CVec_u8Z_free(ret_var);
73886         return ret_arr;
73887 }
73888
73889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
73890         LDKu8slice ser_ref;
73891         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
73892         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
73893         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
73894         *ret_conv = ChannelDerivationParameters_read(ser_ref);
73895         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
73896         return tag_ptr(ret_conv, true);
73897 }
73898
73899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73900         LDKHTLCDescriptor this_obj_conv;
73901         this_obj_conv.inner = untag_ptr(this_obj);
73902         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73904         HTLCDescriptor_free(this_obj_conv);
73905 }
73906
73907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
73908         LDKHTLCDescriptor this_ptr_conv;
73909         this_ptr_conv.inner = untag_ptr(this_ptr);
73910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73912         this_ptr_conv.is_owned = false;
73913         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
73914         int64_t ret_ref = 0;
73915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73917         return ret_ref;
73918 }
73919
73920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73921         LDKHTLCDescriptor this_ptr_conv;
73922         this_ptr_conv.inner = untag_ptr(this_ptr);
73923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73925         this_ptr_conv.is_owned = false;
73926         LDKChannelDerivationParameters val_conv;
73927         val_conv.inner = untag_ptr(val);
73928         val_conv.is_owned = ptr_is_owned(val);
73929         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73930         val_conv = ChannelDerivationParameters_clone(&val_conv);
73931         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
73932 }
73933
73934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
73935         LDKHTLCDescriptor this_ptr_conv;
73936         this_ptr_conv.inner = untag_ptr(this_ptr);
73937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73939         this_ptr_conv.is_owned = false;
73940         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
73941         return ret_conv;
73942 }
73943
73944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
73945         LDKHTLCDescriptor this_ptr_conv;
73946         this_ptr_conv.inner = untag_ptr(this_ptr);
73947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73949         this_ptr_conv.is_owned = false;
73950         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
73951 }
73952
73953 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
73954         LDKHTLCDescriptor this_ptr_conv;
73955         this_ptr_conv.inner = untag_ptr(this_ptr);
73956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73958         this_ptr_conv.is_owned = false;
73959         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
73960         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
73961         return ret_arr;
73962 }
73963
73964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
73965         LDKHTLCDescriptor this_ptr_conv;
73966         this_ptr_conv.inner = untag_ptr(this_ptr);
73967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73969         this_ptr_conv.is_owned = false;
73970         LDKPublicKey val_ref;
73971         CHECK((*env)->GetArrayLength(env, val) == 33);
73972         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
73973         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
73974 }
73975
73976 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
73977         LDKHTLCDescriptor this_ptr_conv;
73978         this_ptr_conv.inner = untag_ptr(this_ptr);
73979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73981         this_ptr_conv.is_owned = false;
73982         int32_t ret_conv = HTLCDescriptor_get_feerate_per_kw(&this_ptr_conv);
73983         return ret_conv;
73984 }
73985
73986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
73987         LDKHTLCDescriptor this_ptr_conv;
73988         this_ptr_conv.inner = untag_ptr(this_ptr);
73989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73991         this_ptr_conv.is_owned = false;
73992         HTLCDescriptor_set_feerate_per_kw(&this_ptr_conv, val);
73993 }
73994
73995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr) {
73996         LDKHTLCDescriptor this_ptr_conv;
73997         this_ptr_conv.inner = untag_ptr(this_ptr);
73998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74000         this_ptr_conv.is_owned = false;
74001         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
74002         int64_t ret_ref = 0;
74003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74005         return ret_ref;
74006 }
74007
74008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74009         LDKHTLCDescriptor this_ptr_conv;
74010         this_ptr_conv.inner = untag_ptr(this_ptr);
74011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74013         this_ptr_conv.is_owned = false;
74014         LDKHTLCOutputInCommitment val_conv;
74015         val_conv.inner = untag_ptr(val);
74016         val_conv.is_owned = ptr_is_owned(val);
74017         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74018         val_conv = HTLCOutputInCommitment_clone(&val_conv);
74019         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
74020 }
74021
74022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
74023         LDKHTLCDescriptor this_ptr_conv;
74024         this_ptr_conv.inner = untag_ptr(this_ptr);
74025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74027         this_ptr_conv.is_owned = false;
74028         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
74029         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
74030         int64_t ret_ref = tag_ptr(ret_copy, true);
74031         return ret_ref;
74032 }
74033
74034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74035         LDKHTLCDescriptor this_ptr_conv;
74036         this_ptr_conv.inner = untag_ptr(this_ptr);
74037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74039         this_ptr_conv.is_owned = false;
74040         void* val_ptr = untag_ptr(val);
74041         CHECK_ACCESS(val_ptr);
74042         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
74043         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
74044         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
74045 }
74046
74047 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
74048         LDKHTLCDescriptor this_ptr_conv;
74049         this_ptr_conv.inner = untag_ptr(this_ptr);
74050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74052         this_ptr_conv.is_owned = false;
74053         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
74054         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form);
74055         return ret_arr;
74056 }
74057
74058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
74059         LDKHTLCDescriptor this_ptr_conv;
74060         this_ptr_conv.inner = untag_ptr(this_ptr);
74061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74063         this_ptr_conv.is_owned = false;
74064         LDKECDSASignature val_ref;
74065         CHECK((*env)->GetArrayLength(env, val) == 64);
74066         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
74067         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
74068 }
74069
74070 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
74071         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
74072         int64_t ret_ref = 0;
74073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74075         return ret_ref;
74076 }
74077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74078         LDKHTLCDescriptor arg_conv;
74079         arg_conv.inner = untag_ptr(arg);
74080         arg_conv.is_owned = ptr_is_owned(arg);
74081         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74082         arg_conv.is_owned = false;
74083         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
74084         return ret_conv;
74085 }
74086
74087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74088         LDKHTLCDescriptor orig_conv;
74089         orig_conv.inner = untag_ptr(orig);
74090         orig_conv.is_owned = ptr_is_owned(orig);
74091         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74092         orig_conv.is_owned = false;
74093         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
74094         int64_t ret_ref = 0;
74095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74097         return ret_ref;
74098 }
74099
74100 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74101         LDKHTLCDescriptor a_conv;
74102         a_conv.inner = untag_ptr(a);
74103         a_conv.is_owned = ptr_is_owned(a);
74104         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74105         a_conv.is_owned = false;
74106         LDKHTLCDescriptor b_conv;
74107         b_conv.inner = untag_ptr(b);
74108         b_conv.is_owned = ptr_is_owned(b);
74109         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74110         b_conv.is_owned = false;
74111         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
74112         return ret_conv;
74113 }
74114
74115 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
74116         LDKHTLCDescriptor obj_conv;
74117         obj_conv.inner = untag_ptr(obj);
74118         obj_conv.is_owned = ptr_is_owned(obj);
74119         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74120         obj_conv.is_owned = false;
74121         LDKCVec_u8Z ret_var = HTLCDescriptor_write(&obj_conv);
74122         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
74123         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
74124         CVec_u8Z_free(ret_var);
74125         return ret_arr;
74126 }
74127
74128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
74129         LDKu8slice ser_ref;
74130         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
74131         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
74132         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
74133         *ret_conv = HTLCDescriptor_read(ser_ref);
74134         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
74135         return tag_ptr(ret_conv, true);
74136 }
74137
74138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
74139         LDKHTLCDescriptor this_arg_conv;
74140         this_arg_conv.inner = untag_ptr(this_arg);
74141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74143         this_arg_conv.is_owned = false;
74144         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
74145         int64_t ret_ref = 0;
74146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74148         return ret_ref;
74149 }
74150
74151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) {
74152         LDKHTLCDescriptor this_arg_conv;
74153         this_arg_conv.inner = untag_ptr(this_arg);
74154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74156         this_arg_conv.is_owned = false;
74157         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
74158         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
74159         return tag_ptr(ret_ref, true);
74160 }
74161
74162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) {
74163         LDKHTLCDescriptor this_arg_conv;
74164         this_arg_conv.inner = untag_ptr(this_arg);
74165         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74167         this_arg_conv.is_owned = false;
74168         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
74169         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
74170         return tag_ptr(ret_ref, true);
74171 }
74172
74173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1tx_1output(JNIEnv *env, jclass clz, int64_t this_arg) {
74174         LDKHTLCDescriptor this_arg_conv;
74175         this_arg_conv.inner = untag_ptr(this_arg);
74176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74178         this_arg_conv.is_owned = false;
74179         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
74180         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
74181         return tag_ptr(ret_ref, true);
74182 }
74183
74184 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
74185         LDKHTLCDescriptor this_arg_conv;
74186         this_arg_conv.inner = untag_ptr(this_arg);
74187         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74189         this_arg_conv.is_owned = false;
74190         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
74191         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
74192         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
74193         CVec_u8Z_free(ret_var);
74194         return ret_arr;
74195 }
74196
74197 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1tx_1input_1witness(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray signature, int8_tArray witness_script) {
74198         LDKHTLCDescriptor this_arg_conv;
74199         this_arg_conv.inner = untag_ptr(this_arg);
74200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74202         this_arg_conv.is_owned = false;
74203         LDKECDSASignature signature_ref;
74204         CHECK((*env)->GetArrayLength(env, signature) == 64);
74205         (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form);
74206         LDKu8slice witness_script_ref;
74207         witness_script_ref.datalen = (*env)->GetArrayLength(env, witness_script);
74208         witness_script_ref.data = (*env)->GetByteArrayElements (env, witness_script, NULL);
74209         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
74210         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
74211         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
74212         Witness_free(ret_var);
74213         (*env)->ReleaseByteArrayElements(env, witness_script, (int8_t*)witness_script_ref.data, 0);
74214         return ret_arr;
74215 }
74216
74217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1derive_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t signer_provider) {
74218         LDKHTLCDescriptor this_arg_conv;
74219         this_arg_conv.inner = untag_ptr(this_arg);
74220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74222         this_arg_conv.is_owned = false;
74223         void* signer_provider_ptr = untag_ptr(signer_provider);
74224         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
74225         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
74226         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
74227         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
74228         return tag_ptr(ret_ret, true);
74229 }
74230
74231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
74232         if (!ptr_is_owned(this_ptr)) return;
74233         void* this_ptr_ptr = untag_ptr(this_ptr);
74234         CHECK_ACCESS(this_ptr_ptr);
74235         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
74236         FREE(untag_ptr(this_ptr));
74237         ChannelSigner_free(this_ptr_conv);
74238 }
74239
74240 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74241         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
74242         jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
74243         return ret_conv;
74244 }
74245
74246 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
74247         jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
74248         return ret_conv;
74249 }
74250
74251 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
74252         jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
74253         return ret_conv;
74254 }
74255
74256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EntropySource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
74257         if (!ptr_is_owned(this_ptr)) return;
74258         void* this_ptr_ptr = untag_ptr(this_ptr);
74259         CHECK_ACCESS(this_ptr_ptr);
74260         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
74261         FREE(untag_ptr(this_ptr));
74262         EntropySource_free(this_ptr_conv);
74263 }
74264
74265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
74266         if (!ptr_is_owned(this_ptr)) return;
74267         void* this_ptr_ptr = untag_ptr(this_ptr);
74268         CHECK_ACCESS(this_ptr_ptr);
74269         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
74270         FREE(untag_ptr(this_ptr));
74271         NodeSigner_free(this_ptr_conv);
74272 }
74273
74274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignerProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
74275         if (!ptr_is_owned(this_ptr)) return;
74276         void* this_ptr_ptr = untag_ptr(this_ptr);
74277         CHECK_ACCESS(this_ptr_ptr);
74278         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
74279         FREE(untag_ptr(this_ptr));
74280         SignerProvider_free(this_ptr_conv);
74281 }
74282
74283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74284         LDKInMemorySigner this_obj_conv;
74285         this_obj_conv.inner = untag_ptr(this_obj);
74286         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74288         InMemorySigner_free(this_obj_conv);
74289 }
74290
74291 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
74292         LDKInMemorySigner this_ptr_conv;
74293         this_ptr_conv.inner = untag_ptr(this_ptr);
74294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74296         this_ptr_conv.is_owned = false;
74297         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74298         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
74299         return ret_arr;
74300 }
74301
74302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
74303         LDKInMemorySigner this_ptr_conv;
74304         this_ptr_conv.inner = untag_ptr(this_ptr);
74305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74307         this_ptr_conv.is_owned = false;
74308         LDKSecretKey val_ref;
74309         CHECK((*env)->GetArrayLength(env, val) == 32);
74310         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
74311         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
74312 }
74313
74314 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
74315         LDKInMemorySigner this_ptr_conv;
74316         this_ptr_conv.inner = untag_ptr(this_ptr);
74317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74319         this_ptr_conv.is_owned = false;
74320         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74321         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
74322         return ret_arr;
74323 }
74324
74325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
74326         LDKInMemorySigner this_ptr_conv;
74327         this_ptr_conv.inner = untag_ptr(this_ptr);
74328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74330         this_ptr_conv.is_owned = false;
74331         LDKSecretKey val_ref;
74332         CHECK((*env)->GetArrayLength(env, val) == 32);
74333         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
74334         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
74335 }
74336
74337 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
74338         LDKInMemorySigner this_ptr_conv;
74339         this_ptr_conv.inner = untag_ptr(this_ptr);
74340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74342         this_ptr_conv.is_owned = false;
74343         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74344         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
74345         return ret_arr;
74346 }
74347
74348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
74349         LDKInMemorySigner this_ptr_conv;
74350         this_ptr_conv.inner = untag_ptr(this_ptr);
74351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74353         this_ptr_conv.is_owned = false;
74354         LDKSecretKey val_ref;
74355         CHECK((*env)->GetArrayLength(env, val) == 32);
74356         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
74357         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
74358 }
74359
74360 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
74361         LDKInMemorySigner this_ptr_conv;
74362         this_ptr_conv.inner = untag_ptr(this_ptr);
74363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74365         this_ptr_conv.is_owned = false;
74366         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74367         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
74368         return ret_arr;
74369 }
74370
74371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
74372         LDKInMemorySigner this_ptr_conv;
74373         this_ptr_conv.inner = untag_ptr(this_ptr);
74374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74376         this_ptr_conv.is_owned = false;
74377         LDKSecretKey val_ref;
74378         CHECK((*env)->GetArrayLength(env, val) == 32);
74379         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
74380         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
74381 }
74382
74383 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
74384         LDKInMemorySigner this_ptr_conv;
74385         this_ptr_conv.inner = untag_ptr(this_ptr);
74386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74388         this_ptr_conv.is_owned = false;
74389         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74390         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
74391         return ret_arr;
74392 }
74393
74394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
74395         LDKInMemorySigner this_ptr_conv;
74396         this_ptr_conv.inner = untag_ptr(this_ptr);
74397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74399         this_ptr_conv.is_owned = false;
74400         LDKSecretKey val_ref;
74401         CHECK((*env)->GetArrayLength(env, val) == 32);
74402         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
74403         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
74404 }
74405
74406 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
74407         LDKInMemorySigner this_ptr_conv;
74408         this_ptr_conv.inner = untag_ptr(this_ptr);
74409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74411         this_ptr_conv.is_owned = false;
74412         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74413         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
74414         return ret_arr;
74415 }
74416
74417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
74418         LDKInMemorySigner this_ptr_conv;
74419         this_ptr_conv.inner = untag_ptr(this_ptr);
74420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74422         this_ptr_conv.is_owned = false;
74423         LDKThirtyTwoBytes val_ref;
74424         CHECK((*env)->GetArrayLength(env, val) == 32);
74425         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
74426         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
74427 }
74428
74429 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
74430         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
74431         int64_t ret_ref = 0;
74432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74434         return ret_ref;
74435 }
74436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74437         LDKInMemorySigner arg_conv;
74438         arg_conv.inner = untag_ptr(arg);
74439         arg_conv.is_owned = ptr_is_owned(arg);
74440         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74441         arg_conv.is_owned = false;
74442         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
74443         return ret_conv;
74444 }
74445
74446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74447         LDKInMemorySigner orig_conv;
74448         orig_conv.inner = untag_ptr(orig);
74449         orig_conv.is_owned = ptr_is_owned(orig);
74450         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74451         orig_conv.is_owned = false;
74452         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
74453         int64_t ret_ref = 0;
74454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74456         return ret_ref;
74457 }
74458
74459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1new(JNIEnv *env, jclass clz, int8_tArray funding_key, int8_tArray revocation_base_key, int8_tArray payment_key, int8_tArray delayed_payment_base_key, int8_tArray htlc_base_key, int8_tArray commitment_seed, int64_t channel_value_satoshis, int8_tArray channel_keys_id, int8_tArray rand_bytes_unique_start) {
74460         LDKSecretKey funding_key_ref;
74461         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
74462         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
74463         LDKSecretKey revocation_base_key_ref;
74464         CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
74465         (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
74466         LDKSecretKey payment_key_ref;
74467         CHECK((*env)->GetArrayLength(env, payment_key) == 32);
74468         (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
74469         LDKSecretKey delayed_payment_base_key_ref;
74470         CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
74471         (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
74472         LDKSecretKey htlc_base_key_ref;
74473         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
74474         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
74475         LDKThirtyTwoBytes commitment_seed_ref;
74476         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
74477         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
74478         LDKThirtyTwoBytes channel_keys_id_ref;
74479         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
74480         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
74481         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
74482         CHECK((*env)->GetArrayLength(env, rand_bytes_unique_start) == 32);
74483         (*env)->GetByteArrayRegion(env, rand_bytes_unique_start, 0, 32, rand_bytes_unique_start_ref.data);
74484         LDKInMemorySigner ret_var = InMemorySigner_new(funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, channel_keys_id_ref, rand_bytes_unique_start_ref);
74485         int64_t ret_ref = 0;
74486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74488         return ret_ref;
74489 }
74490
74491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
74492         LDKInMemorySigner this_arg_conv;
74493         this_arg_conv.inner = untag_ptr(this_arg);
74494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74496         this_arg_conv.is_owned = false;
74497         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
74498         int64_t ret_ref = 0;
74499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74501         return ret_ref;
74502 }
74503
74504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
74505         LDKInMemorySigner this_arg_conv;
74506         this_arg_conv.inner = untag_ptr(this_arg);
74507         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74509         this_arg_conv.is_owned = false;
74510         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
74511         *ret_copy = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
74512         int64_t ret_ref = tag_ptr(ret_copy, true);
74513         return ret_ref;
74514 }
74515
74516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
74517         LDKInMemorySigner this_arg_conv;
74518         this_arg_conv.inner = untag_ptr(this_arg);
74519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74521         this_arg_conv.is_owned = false;
74522         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
74523         *ret_copy = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
74524         int64_t ret_ref = tag_ptr(ret_copy, true);
74525         return ret_ref;
74526 }
74527
74528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
74529         LDKInMemorySigner this_arg_conv;
74530         this_arg_conv.inner = untag_ptr(this_arg);
74531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74533         this_arg_conv.is_owned = false;
74534         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
74535         *ret_copy = InMemorySigner_is_outbound(&this_arg_conv);
74536         int64_t ret_ref = tag_ptr(ret_copy, true);
74537         return ret_ref;
74538 }
74539
74540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
74541         LDKInMemorySigner this_arg_conv;
74542         this_arg_conv.inner = untag_ptr(this_arg);
74543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74545         this_arg_conv.is_owned = false;
74546         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
74547         int64_t ret_ref = 0;
74548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74550         return ret_ref;
74551 }
74552
74553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
74554         LDKInMemorySigner this_arg_conv;
74555         this_arg_conv.inner = untag_ptr(this_arg);
74556         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74558         this_arg_conv.is_owned = false;
74559         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
74560         int64_t ret_ref = 0;
74561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74563         return ret_ref;
74564 }
74565
74566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
74567         LDKInMemorySigner this_arg_conv;
74568         this_arg_conv.inner = untag_ptr(this_arg);
74569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74571         this_arg_conv.is_owned = false;
74572         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
74573         int64_t ret_ref = 0;
74574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74576         return ret_ref;
74577 }
74578
74579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1counterparty_1payment_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
74580         LDKInMemorySigner this_arg_conv;
74581         this_arg_conv.inner = untag_ptr(this_arg);
74582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74584         this_arg_conv.is_owned = false;
74585         LDKTransaction spend_tx_ref;
74586         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
74587         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
74588         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
74589         spend_tx_ref.data_is_owned = true;
74590         LDKStaticPaymentOutputDescriptor descriptor_conv;
74591         descriptor_conv.inner = untag_ptr(descriptor);
74592         descriptor_conv.is_owned = ptr_is_owned(descriptor);
74593         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
74594         descriptor_conv.is_owned = false;
74595         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
74596         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
74597         return tag_ptr(ret_conv, true);
74598 }
74599
74600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1dynamic_1p2wsh_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
74601         LDKInMemorySigner this_arg_conv;
74602         this_arg_conv.inner = untag_ptr(this_arg);
74603         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74605         this_arg_conv.is_owned = false;
74606         LDKTransaction spend_tx_ref;
74607         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
74608         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
74609         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
74610         spend_tx_ref.data_is_owned = true;
74611         LDKDelayedPaymentOutputDescriptor descriptor_conv;
74612         descriptor_conv.inner = untag_ptr(descriptor);
74613         descriptor_conv.is_owned = ptr_is_owned(descriptor);
74614         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
74615         descriptor_conv.is_owned = false;
74616         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
74617         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
74618         return tag_ptr(ret_conv, true);
74619 }
74620
74621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
74622         LDKInMemorySigner this_arg_conv;
74623         this_arg_conv.inner = untag_ptr(this_arg);
74624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74626         this_arg_conv.is_owned = false;
74627         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
74628         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
74629         return tag_ptr(ret_ret, true);
74630 }
74631
74632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1ChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
74633         LDKInMemorySigner this_arg_conv;
74634         this_arg_conv.inner = untag_ptr(this_arg);
74635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74637         this_arg_conv.is_owned = false;
74638         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
74639         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
74640         return tag_ptr(ret_ret, true);
74641 }
74642
74643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
74644         LDKInMemorySigner this_arg_conv;
74645         this_arg_conv.inner = untag_ptr(this_arg);
74646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74648         this_arg_conv.is_owned = false;
74649         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
74650         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
74651         return tag_ptr(ret_ret, true);
74652 }
74653
74654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1WriteableEcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
74655         LDKInMemorySigner this_arg_conv;
74656         this_arg_conv.inner = untag_ptr(this_arg);
74657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74659         this_arg_conv.is_owned = false;
74660         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
74661         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
74662         return tag_ptr(ret_ret, true);
74663 }
74664
74665 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
74666         LDKInMemorySigner obj_conv;
74667         obj_conv.inner = untag_ptr(obj);
74668         obj_conv.is_owned = ptr_is_owned(obj);
74669         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74670         obj_conv.is_owned = false;
74671         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
74672         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
74673         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
74674         CVec_u8Z_free(ret_var);
74675         return ret_arr;
74676 }
74677
74678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
74679         LDKu8slice ser_ref;
74680         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
74681         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
74682         void* arg_ptr = untag_ptr(arg);
74683         CHECK_ACCESS(arg_ptr);
74684         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
74685         if (arg_conv.free == LDKEntropySource_JCalls_free) {
74686                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74687                 LDKEntropySource_JCalls_cloned(&arg_conv);
74688         }
74689         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
74690         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
74691         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
74692         return tag_ptr(ret_conv, true);
74693 }
74694
74695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74696         LDKKeysManager this_obj_conv;
74697         this_obj_conv.inner = untag_ptr(this_obj);
74698         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74700         KeysManager_free(this_obj_conv);
74701 }
74702
74703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv *env, jclass clz, int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
74704         uint8_t seed_arr[32];
74705         CHECK((*env)->GetArrayLength(env, seed) == 32);
74706         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
74707         uint8_t (*seed_ref)[32] = &seed_arr;
74708         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
74709         int64_t ret_ref = 0;
74710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74712         return ret_ref;
74713 }
74714
74715 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
74716         LDKKeysManager this_arg_conv;
74717         this_arg_conv.inner = untag_ptr(this_arg);
74718         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74720         this_arg_conv.is_owned = false;
74721         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74722         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, KeysManager_get_node_secret_key(&this_arg_conv).bytes);
74723         return ret_arr;
74724 }
74725
74726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1derive_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
74727         LDKKeysManager this_arg_conv;
74728         this_arg_conv.inner = untag_ptr(this_arg);
74729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74731         this_arg_conv.is_owned = false;
74732         uint8_t params_arr[32];
74733         CHECK((*env)->GetArrayLength(env, params) == 32);
74734         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
74735         uint8_t (*params_ref)[32] = &params_arr;
74736         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
74737         int64_t ret_ref = 0;
74738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74740         return ret_ref;
74741 }
74742
74743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1sign_1spendable_1outputs_1psbt(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray descriptors, int8_tArray psbt) {
74744         LDKKeysManager this_arg_conv;
74745         this_arg_conv.inner = untag_ptr(this_arg);
74746         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74748         this_arg_conv.is_owned = false;
74749         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
74750         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
74751         if (descriptors_constr.datalen > 0)
74752                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
74753         else
74754                 descriptors_constr.data = NULL;
74755         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
74756         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
74757                 int64_t descriptors_conv_27 = descriptors_vals[b];
74758                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
74759                 CHECK_ACCESS(descriptors_conv_27_ptr);
74760                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
74761                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
74762                 descriptors_constr.data[b] = descriptors_conv_27_conv;
74763         }
74764         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
74765         LDKCVec_u8Z psbt_ref;
74766         psbt_ref.datalen = (*env)->GetArrayLength(env, psbt);
74767         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
74768         (*env)->GetByteArrayRegion(env, psbt, 0, psbt_ref.datalen, psbt_ref.data);
74769         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
74770         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
74771         return tag_ptr(ret_conv, true);
74772 }
74773
74774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1spend_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight, int64_t locktime) {
74775         LDKKeysManager this_arg_conv;
74776         this_arg_conv.inner = untag_ptr(this_arg);
74777         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74779         this_arg_conv.is_owned = false;
74780         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
74781         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
74782         if (descriptors_constr.datalen > 0)
74783                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
74784         else
74785                 descriptors_constr.data = NULL;
74786         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
74787         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
74788                 int64_t descriptors_conv_27 = descriptors_vals[b];
74789                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
74790                 CHECK_ACCESS(descriptors_conv_27_ptr);
74791                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
74792                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
74793                 descriptors_constr.data[b] = descriptors_conv_27_conv;
74794         }
74795         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
74796         LDKCVec_TxOutZ outputs_constr;
74797         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
74798         if (outputs_constr.datalen > 0)
74799                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
74800         else
74801                 outputs_constr.data = NULL;
74802         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
74803         for (size_t h = 0; h < outputs_constr.datalen; h++) {
74804                 int64_t outputs_conv_7 = outputs_vals[h];
74805                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
74806                 CHECK_ACCESS(outputs_conv_7_ptr);
74807                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
74808                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
74809                 outputs_constr.data[h] = outputs_conv_7_conv;
74810         }
74811         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
74812         LDKCVec_u8Z change_destination_script_ref;
74813         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
74814         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
74815         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
74816         void* locktime_ptr = untag_ptr(locktime);
74817         CHECK_ACCESS(locktime_ptr);
74818         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
74819         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
74820         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
74821         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
74822         return tag_ptr(ret_conv, true);
74823 }
74824
74825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
74826         LDKKeysManager this_arg_conv;
74827         this_arg_conv.inner = untag_ptr(this_arg);
74828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74830         this_arg_conv.is_owned = false;
74831         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
74832         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
74833         return tag_ptr(ret_ret, true);
74834 }
74835
74836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
74837         LDKKeysManager this_arg_conv;
74838         this_arg_conv.inner = untag_ptr(this_arg);
74839         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74841         this_arg_conv.is_owned = false;
74842         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
74843         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
74844         return tag_ptr(ret_ret, true);
74845 }
74846
74847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
74848         LDKKeysManager this_arg_conv;
74849         this_arg_conv.inner = untag_ptr(this_arg);
74850         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74852         this_arg_conv.is_owned = false;
74853         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
74854         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
74855         return tag_ptr(ret_ret, true);
74856 }
74857
74858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74859         LDKPhantomKeysManager this_obj_conv;
74860         this_obj_conv.inner = untag_ptr(this_obj);
74861         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74863         PhantomKeysManager_free(this_obj_conv);
74864 }
74865
74866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
74867         LDKPhantomKeysManager this_arg_conv;
74868         this_arg_conv.inner = untag_ptr(this_arg);
74869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74871         this_arg_conv.is_owned = false;
74872         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
74873         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
74874         return tag_ptr(ret_ret, true);
74875 }
74876
74877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
74878         LDKPhantomKeysManager this_arg_conv;
74879         this_arg_conv.inner = untag_ptr(this_arg);
74880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74882         this_arg_conv.is_owned = false;
74883         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
74884         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
74885         return tag_ptr(ret_ret, true);
74886 }
74887
74888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
74889         LDKPhantomKeysManager this_arg_conv;
74890         this_arg_conv.inner = untag_ptr(this_arg);
74891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74893         this_arg_conv.is_owned = false;
74894         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
74895         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
74896         return tag_ptr(ret_ret, true);
74897 }
74898
74899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1new(JNIEnv *env, jclass clz, int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos, int8_tArray cross_node_seed) {
74900         uint8_t seed_arr[32];
74901         CHECK((*env)->GetArrayLength(env, seed) == 32);
74902         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
74903         uint8_t (*seed_ref)[32] = &seed_arr;
74904         uint8_t cross_node_seed_arr[32];
74905         CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
74906         (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
74907         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
74908         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
74909         int64_t ret_ref = 0;
74910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74912         return ret_ref;
74913 }
74914
74915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1spend_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight, int64_t locktime) {
74916         LDKPhantomKeysManager this_arg_conv;
74917         this_arg_conv.inner = untag_ptr(this_arg);
74918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74920         this_arg_conv.is_owned = false;
74921         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
74922         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
74923         if (descriptors_constr.datalen > 0)
74924                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
74925         else
74926                 descriptors_constr.data = NULL;
74927         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
74928         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
74929                 int64_t descriptors_conv_27 = descriptors_vals[b];
74930                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
74931                 CHECK_ACCESS(descriptors_conv_27_ptr);
74932                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
74933                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
74934                 descriptors_constr.data[b] = descriptors_conv_27_conv;
74935         }
74936         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
74937         LDKCVec_TxOutZ outputs_constr;
74938         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
74939         if (outputs_constr.datalen > 0)
74940                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
74941         else
74942                 outputs_constr.data = NULL;
74943         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
74944         for (size_t h = 0; h < outputs_constr.datalen; h++) {
74945                 int64_t outputs_conv_7 = outputs_vals[h];
74946                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
74947                 CHECK_ACCESS(outputs_conv_7_ptr);
74948                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
74949                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
74950                 outputs_constr.data[h] = outputs_conv_7_conv;
74951         }
74952         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
74953         LDKCVec_u8Z change_destination_script_ref;
74954         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
74955         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
74956         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
74957         void* locktime_ptr = untag_ptr(locktime);
74958         CHECK_ACCESS(locktime_ptr);
74959         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
74960         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
74961         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
74962         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
74963         return tag_ptr(ret_conv, true);
74964 }
74965
74966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1derive_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
74967         LDKPhantomKeysManager this_arg_conv;
74968         this_arg_conv.inner = untag_ptr(this_arg);
74969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74971         this_arg_conv.is_owned = false;
74972         uint8_t params_arr[32];
74973         CHECK((*env)->GetArrayLength(env, params) == 32);
74974         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
74975         uint8_t (*params_ref)[32] = &params_arr;
74976         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
74977         int64_t ret_ref = 0;
74978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74980         return ret_ref;
74981 }
74982
74983 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
74984         LDKPhantomKeysManager this_arg_conv;
74985         this_arg_conv.inner = untag_ptr(this_arg);
74986         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74988         this_arg_conv.is_owned = false;
74989         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
74990         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes);
74991         return ret_arr;
74992 }
74993
74994 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1phantom_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
74995         LDKPhantomKeysManager this_arg_conv;
74996         this_arg_conv.inner = untag_ptr(this_arg);
74997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74999         this_arg_conv.is_owned = false;
75000         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
75001         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes);
75002         return ret_arr;
75003 }
75004
75005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75006         if (!ptr_is_owned(this_ptr)) return;
75007         void* this_ptr_ptr = untag_ptr(this_ptr);
75008         CHECK_ACCESS(this_ptr_ptr);
75009         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
75010         FREE(untag_ptr(this_ptr));
75011         EcdsaChannelSigner_free(this_ptr_conv);
75012 }
75013
75014 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
75015         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
75016         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
75017         return tag_ptr(ret_ret, true);
75018 }
75019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75020         void* arg_ptr = untag_ptr(arg);
75021         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
75022         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
75023         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
75024         return ret_conv;
75025 }
75026
75027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75028         void* orig_ptr = untag_ptr(orig);
75029         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
75030         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
75031         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
75032         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
75033         return tag_ptr(ret_ret, true);
75034 }
75035
75036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75037         if (!ptr_is_owned(this_ptr)) return;
75038         void* this_ptr_ptr = untag_ptr(this_ptr);
75039         CHECK_ACCESS(this_ptr_ptr);
75040         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
75041         FREE(untag_ptr(this_ptr));
75042         WriteableEcdsaChannelSigner_free(this_ptr_conv);
75043 }
75044
75045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75046         LDKOnionMessenger this_obj_conv;
75047         this_obj_conv.inner = untag_ptr(this_obj);
75048         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75050         OnionMessenger_free(this_obj_conv);
75051 }
75052
75053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageRouter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75054         if (!ptr_is_owned(this_ptr)) return;
75055         void* this_ptr_ptr = untag_ptr(this_ptr);
75056         CHECK_ACCESS(this_ptr_ptr);
75057         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
75058         FREE(untag_ptr(this_ptr));
75059         MessageRouter_free(this_ptr_conv);
75060 }
75061
75062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75063         LDKDefaultMessageRouter this_obj_conv;
75064         this_obj_conv.inner = untag_ptr(this_obj);
75065         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75067         DefaultMessageRouter_free(this_obj_conv);
75068 }
75069
75070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t entropy_source) {
75071         LDKNetworkGraph network_graph_conv;
75072         network_graph_conv.inner = untag_ptr(network_graph);
75073         network_graph_conv.is_owned = ptr_is_owned(network_graph);
75074         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
75075         network_graph_conv.is_owned = false;
75076         void* entropy_source_ptr = untag_ptr(entropy_source);
75077         CHECK_ACCESS(entropy_source_ptr);
75078         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
75079         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
75080                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75081                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
75082         }
75083         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new(&network_graph_conv, entropy_source_conv);
75084         int64_t ret_ref = 0;
75085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75087         return ret_ref;
75088 }
75089
75090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1as_1MessageRouter(JNIEnv *env, jclass clz, int64_t this_arg) {
75091         LDKDefaultMessageRouter this_arg_conv;
75092         this_arg_conv.inner = untag_ptr(this_arg);
75093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75095         this_arg_conv.is_owned = false;
75096         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
75097         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
75098         return tag_ptr(ret_ret, true);
75099 }
75100
75101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75102         LDKOnionMessagePath this_obj_conv;
75103         this_obj_conv.inner = untag_ptr(this_obj);
75104         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75106         OnionMessagePath_free(this_obj_conv);
75107 }
75108
75109 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1intermediate_1nodes(JNIEnv *env, jclass clz, int64_t this_ptr) {
75110         LDKOnionMessagePath this_ptr_conv;
75111         this_ptr_conv.inner = untag_ptr(this_ptr);
75112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75114         this_ptr_conv.is_owned = false;
75115         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
75116         jobjectArray ret_arr = NULL;
75117         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
75118         ;
75119         for (size_t i = 0; i < ret_var.datalen; i++) {
75120                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
75121                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
75122                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
75123         }
75124         
75125         FREE(ret_var.data);
75126         return ret_arr;
75127 }
75128
75129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1intermediate_1nodes(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
75130         LDKOnionMessagePath this_ptr_conv;
75131         this_ptr_conv.inner = untag_ptr(this_ptr);
75132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75134         this_ptr_conv.is_owned = false;
75135         LDKCVec_PublicKeyZ val_constr;
75136         val_constr.datalen = (*env)->GetArrayLength(env, val);
75137         if (val_constr.datalen > 0)
75138                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
75139         else
75140                 val_constr.data = NULL;
75141         for (size_t i = 0; i < val_constr.datalen; i++) {
75142                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
75143                 LDKPublicKey val_conv_8_ref;
75144                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 33);
75145                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 33, val_conv_8_ref.compressed_form);
75146                 val_constr.data[i] = val_conv_8_ref;
75147         }
75148         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
75149 }
75150
75151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1destination(JNIEnv *env, jclass clz, int64_t this_ptr) {
75152         LDKOnionMessagePath this_ptr_conv;
75153         this_ptr_conv.inner = untag_ptr(this_ptr);
75154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75156         this_ptr_conv.is_owned = false;
75157         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
75158         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
75159         int64_t ret_ref = tag_ptr(ret_copy, true);
75160         return ret_ref;
75161 }
75162
75163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1destination(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
75164         LDKOnionMessagePath this_ptr_conv;
75165         this_ptr_conv.inner = untag_ptr(this_ptr);
75166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75168         this_ptr_conv.is_owned = false;
75169         void* val_ptr = untag_ptr(val);
75170         CHECK_ACCESS(val_ptr);
75171         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
75172         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
75173         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
75174 }
75175
75176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1first_1node_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
75177         LDKOnionMessagePath this_ptr_conv;
75178         this_ptr_conv.inner = untag_ptr(this_ptr);
75179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75181         this_ptr_conv.is_owned = false;
75182         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
75183         *ret_copy = OnionMessagePath_get_first_node_addresses(&this_ptr_conv);
75184         int64_t ret_ref = tag_ptr(ret_copy, true);
75185         return ret_ref;
75186 }
75187
75188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1first_1node_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
75189         LDKOnionMessagePath this_ptr_conv;
75190         this_ptr_conv.inner = untag_ptr(this_ptr);
75191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75193         this_ptr_conv.is_owned = false;
75194         void* val_ptr = untag_ptr(val);
75195         CHECK_ACCESS(val_ptr);
75196         LDKCOption_CVec_SocketAddressZZ val_conv = *(LDKCOption_CVec_SocketAddressZZ*)(val_ptr);
75197         val_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(val));
75198         OnionMessagePath_set_first_node_addresses(&this_ptr_conv, val_conv);
75199 }
75200
75201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1new(JNIEnv *env, jclass clz, jobjectArray intermediate_nodes_arg, int64_t destination_arg, int64_t first_node_addresses_arg) {
75202         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
75203         intermediate_nodes_arg_constr.datalen = (*env)->GetArrayLength(env, intermediate_nodes_arg);
75204         if (intermediate_nodes_arg_constr.datalen > 0)
75205                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
75206         else
75207                 intermediate_nodes_arg_constr.data = NULL;
75208         for (size_t i = 0; i < intermediate_nodes_arg_constr.datalen; i++) {
75209                 int8_tArray intermediate_nodes_arg_conv_8 = (*env)->GetObjectArrayElement(env, intermediate_nodes_arg, i);
75210                 LDKPublicKey intermediate_nodes_arg_conv_8_ref;
75211                 CHECK((*env)->GetArrayLength(env, intermediate_nodes_arg_conv_8) == 33);
75212                 (*env)->GetByteArrayRegion(env, intermediate_nodes_arg_conv_8, 0, 33, intermediate_nodes_arg_conv_8_ref.compressed_form);
75213                 intermediate_nodes_arg_constr.data[i] = intermediate_nodes_arg_conv_8_ref;
75214         }
75215         void* destination_arg_ptr = untag_ptr(destination_arg);
75216         CHECK_ACCESS(destination_arg_ptr);
75217         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
75218         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
75219         void* first_node_addresses_arg_ptr = untag_ptr(first_node_addresses_arg);
75220         CHECK_ACCESS(first_node_addresses_arg_ptr);
75221         LDKCOption_CVec_SocketAddressZZ first_node_addresses_arg_conv = *(LDKCOption_CVec_SocketAddressZZ*)(first_node_addresses_arg_ptr);
75222         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv, first_node_addresses_arg_conv);
75223         int64_t ret_ref = 0;
75224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75226         return ret_ref;
75227 }
75228
75229 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
75230         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
75231         int64_t ret_ref = 0;
75232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75234         return ret_ref;
75235 }
75236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75237         LDKOnionMessagePath arg_conv;
75238         arg_conv.inner = untag_ptr(arg);
75239         arg_conv.is_owned = ptr_is_owned(arg);
75240         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75241         arg_conv.is_owned = false;
75242         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
75243         return ret_conv;
75244 }
75245
75246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75247         LDKOnionMessagePath orig_conv;
75248         orig_conv.inner = untag_ptr(orig);
75249         orig_conv.is_owned = ptr_is_owned(orig);
75250         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75251         orig_conv.is_owned = false;
75252         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
75253         int64_t ret_ref = 0;
75254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75256         return ret_ref;
75257 }
75258
75259 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1first_1node(JNIEnv *env, jclass clz, int64_t this_arg) {
75260         LDKOnionMessagePath this_arg_conv;
75261         this_arg_conv.inner = untag_ptr(this_arg);
75262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75264         this_arg_conv.is_owned = false;
75265         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
75266         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OnionMessagePath_first_node(&this_arg_conv).compressed_form);
75267         return ret_arr;
75268 }
75269
75270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Destination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75271         if (!ptr_is_owned(this_ptr)) return;
75272         void* this_ptr_ptr = untag_ptr(this_ptr);
75273         CHECK_ACCESS(this_ptr_ptr);
75274         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
75275         FREE(untag_ptr(this_ptr));
75276         Destination_free(this_ptr_conv);
75277 }
75278
75279 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
75280         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
75281         *ret_copy = Destination_clone(arg);
75282         int64_t ret_ref = tag_ptr(ret_copy, true);
75283         return ret_ref;
75284 }
75285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75286         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
75287         int64_t ret_conv = Destination_clone_ptr(arg_conv);
75288         return ret_conv;
75289 }
75290
75291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75292         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
75293         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
75294         *ret_copy = Destination_clone(orig_conv);
75295         int64_t ret_ref = tag_ptr(ret_copy, true);
75296         return ret_ref;
75297 }
75298
75299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1node(JNIEnv *env, jclass clz, int8_tArray a) {
75300         LDKPublicKey a_ref;
75301         CHECK((*env)->GetArrayLength(env, a) == 33);
75302         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
75303         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
75304         *ret_copy = Destination_node(a_ref);
75305         int64_t ret_ref = tag_ptr(ret_copy, true);
75306         return ret_ref;
75307 }
75308
75309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1blinded_1path(JNIEnv *env, jclass clz, int64_t a) {
75310         LDKBlindedPath a_conv;
75311         a_conv.inner = untag_ptr(a);
75312         a_conv.is_owned = ptr_is_owned(a);
75313         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75314         a_conv = BlindedPath_clone(&a_conv);
75315         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
75316         *ret_copy = Destination_blinded_path(a_conv);
75317         int64_t ret_ref = tag_ptr(ret_copy, true);
75318         return ret_ref;
75319 }
75320
75321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SendSuccess_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75322         if (!ptr_is_owned(this_ptr)) return;
75323         void* this_ptr_ptr = untag_ptr(this_ptr);
75324         CHECK_ACCESS(this_ptr_ptr);
75325         LDKSendSuccess this_ptr_conv = *(LDKSendSuccess*)(this_ptr_ptr);
75326         FREE(untag_ptr(this_ptr));
75327         SendSuccess_free(this_ptr_conv);
75328 }
75329
75330 static inline uint64_t SendSuccess_clone_ptr(LDKSendSuccess *NONNULL_PTR arg) {
75331         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
75332         *ret_copy = SendSuccess_clone(arg);
75333         int64_t ret_ref = tag_ptr(ret_copy, true);
75334         return ret_ref;
75335 }
75336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendSuccess_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75337         LDKSendSuccess* arg_conv = (LDKSendSuccess*)untag_ptr(arg);
75338         int64_t ret_conv = SendSuccess_clone_ptr(arg_conv);
75339         return ret_conv;
75340 }
75341
75342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendSuccess_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75343         LDKSendSuccess* orig_conv = (LDKSendSuccess*)untag_ptr(orig);
75344         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
75345         *ret_copy = SendSuccess_clone(orig_conv);
75346         int64_t ret_ref = tag_ptr(ret_copy, true);
75347         return ret_ref;
75348 }
75349
75350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendSuccess_1buffered(JNIEnv *env, jclass clz) {
75351         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
75352         *ret_copy = SendSuccess_buffered();
75353         int64_t ret_ref = tag_ptr(ret_copy, true);
75354         return ret_ref;
75355 }
75356
75357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendSuccess_1buffered_1awaiting_1connection(JNIEnv *env, jclass clz, int8_tArray a) {
75358         LDKPublicKey a_ref;
75359         CHECK((*env)->GetArrayLength(env, a) == 33);
75360         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
75361         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
75362         *ret_copy = SendSuccess_buffered_awaiting_connection(a_ref);
75363         int64_t ret_ref = tag_ptr(ret_copy, true);
75364         return ret_ref;
75365 }
75366
75367 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SendSuccess_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75368         LDKSendSuccess* a_conv = (LDKSendSuccess*)untag_ptr(a);
75369         LDKSendSuccess* b_conv = (LDKSendSuccess*)untag_ptr(b);
75370         jboolean ret_conv = SendSuccess_eq(a_conv, b_conv);
75371         return ret_conv;
75372 }
75373
75374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SendError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75375         if (!ptr_is_owned(this_ptr)) return;
75376         void* this_ptr_ptr = untag_ptr(this_ptr);
75377         CHECK_ACCESS(this_ptr_ptr);
75378         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
75379         FREE(untag_ptr(this_ptr));
75380         SendError_free(this_ptr_conv);
75381 }
75382
75383 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
75384         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75385         *ret_copy = SendError_clone(arg);
75386         int64_t ret_ref = tag_ptr(ret_copy, true);
75387         return ret_ref;
75388 }
75389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75390         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
75391         int64_t ret_conv = SendError_clone_ptr(arg_conv);
75392         return ret_conv;
75393 }
75394
75395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75396         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
75397         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75398         *ret_copy = SendError_clone(orig_conv);
75399         int64_t ret_ref = tag_ptr(ret_copy, true);
75400         return ret_ref;
75401 }
75402
75403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1secp256k1(JNIEnv *env, jclass clz, jclass a) {
75404         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
75405         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75406         *ret_copy = SendError_secp256k1(a_conv);
75407         int64_t ret_ref = tag_ptr(ret_copy, true);
75408         return ret_ref;
75409 }
75410
75411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1big_1packet(JNIEnv *env, jclass clz) {
75412         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75413         *ret_copy = SendError_too_big_packet();
75414         int64_t ret_ref = tag_ptr(ret_copy, true);
75415         return ret_ref;
75416 }
75417
75418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1few_1blinded_1hops(JNIEnv *env, jclass clz) {
75419         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75420         *ret_copy = SendError_too_few_blinded_hops();
75421         int64_t ret_ref = tag_ptr(ret_copy, true);
75422         return ret_ref;
75423 }
75424
75425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1first_1hop(JNIEnv *env, jclass clz, int8_tArray a) {
75426         LDKPublicKey a_ref;
75427         CHECK((*env)->GetArrayLength(env, a) == 33);
75428         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
75429         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75430         *ret_copy = SendError_invalid_first_hop(a_ref);
75431         int64_t ret_ref = tag_ptr(ret_copy, true);
75432         return ret_ref;
75433 }
75434
75435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1path_1not_1found(JNIEnv *env, jclass clz) {
75436         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75437         *ret_copy = SendError_path_not_found();
75438         int64_t ret_ref = tag_ptr(ret_copy, true);
75439         return ret_ref;
75440 }
75441
75442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1message(JNIEnv *env, jclass clz) {
75443         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75444         *ret_copy = SendError_invalid_message();
75445         int64_t ret_ref = tag_ptr(ret_copy, true);
75446         return ret_ref;
75447 }
75448
75449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1buffer_1full(JNIEnv *env, jclass clz) {
75450         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75451         *ret_copy = SendError_buffer_full();
75452         int64_t ret_ref = tag_ptr(ret_copy, true);
75453         return ret_ref;
75454 }
75455
75456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1get_1node_1id_1failed(JNIEnv *env, jclass clz) {
75457         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75458         *ret_copy = SendError_get_node_id_failed();
75459         int64_t ret_ref = tag_ptr(ret_copy, true);
75460         return ret_ref;
75461 }
75462
75463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1blinded_1path_1advance_1failed(JNIEnv *env, jclass clz) {
75464         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
75465         *ret_copy = SendError_blinded_path_advance_failed();
75466         int64_t ret_ref = tag_ptr(ret_copy, true);
75467         return ret_ref;
75468 }
75469
75470 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SendError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75471         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
75472         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
75473         jboolean ret_conv = SendError_eq(a_conv, b_conv);
75474         return ret_conv;
75475 }
75476
75477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75478         if (!ptr_is_owned(this_ptr)) return;
75479         void* this_ptr_ptr = untag_ptr(this_ptr);
75480         CHECK_ACCESS(this_ptr_ptr);
75481         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
75482         FREE(untag_ptr(this_ptr));
75483         CustomOnionMessageHandler_free(this_ptr_conv);
75484 }
75485
75486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75487         if (!ptr_is_owned(this_ptr)) return;
75488         void* this_ptr_ptr = untag_ptr(this_ptr);
75489         CHECK_ACCESS(this_ptr_ptr);
75490         LDKPeeledOnion this_ptr_conv = *(LDKPeeledOnion*)(this_ptr_ptr);
75491         FREE(untag_ptr(this_ptr));
75492         PeeledOnion_free(this_ptr_conv);
75493 }
75494
75495 static inline uint64_t PeeledOnion_clone_ptr(LDKPeeledOnion *NONNULL_PTR arg) {
75496         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
75497         *ret_copy = PeeledOnion_clone(arg);
75498         int64_t ret_ref = tag_ptr(ret_copy, true);
75499         return ret_ref;
75500 }
75501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75502         LDKPeeledOnion* arg_conv = (LDKPeeledOnion*)untag_ptr(arg);
75503         int64_t ret_conv = PeeledOnion_clone_ptr(arg_conv);
75504         return ret_conv;
75505 }
75506
75507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75508         LDKPeeledOnion* orig_conv = (LDKPeeledOnion*)untag_ptr(orig);
75509         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
75510         *ret_copy = PeeledOnion_clone(orig_conv);
75511         int64_t ret_ref = tag_ptr(ret_copy, true);
75512         return ret_ref;
75513 }
75514
75515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1forward(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
75516         LDKPublicKey a_ref;
75517         CHECK((*env)->GetArrayLength(env, a) == 33);
75518         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
75519         LDKOnionMessage b_conv;
75520         b_conv.inner = untag_ptr(b);
75521         b_conv.is_owned = ptr_is_owned(b);
75522         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75523         b_conv = OnionMessage_clone(&b_conv);
75524         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
75525         *ret_copy = PeeledOnion_forward(a_ref, b_conv);
75526         int64_t ret_ref = tag_ptr(ret_copy, true);
75527         return ret_ref;
75528 }
75529
75530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1receive(JNIEnv *env, jclass clz, int64_t a, int8_tArray b, int64_t c) {
75531         void* a_ptr = untag_ptr(a);
75532         CHECK_ACCESS(a_ptr);
75533         LDKParsedOnionMessageContents a_conv = *(LDKParsedOnionMessageContents*)(a_ptr);
75534         a_conv = ParsedOnionMessageContents_clone((LDKParsedOnionMessageContents*)untag_ptr(a));
75535         LDKThirtyTwoBytes b_ref;
75536         CHECK((*env)->GetArrayLength(env, b) == 32);
75537         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
75538         LDKBlindedPath c_conv;
75539         c_conv.inner = untag_ptr(c);
75540         c_conv.is_owned = ptr_is_owned(c);
75541         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
75542         c_conv = BlindedPath_clone(&c_conv);
75543         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
75544         *ret_copy = PeeledOnion_receive(a_conv, b_ref, c_conv);
75545         int64_t ret_ref = tag_ptr(ret_copy, true);
75546         return ret_ref;
75547 }
75548
75549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1onion_1message(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t path, int64_t contents, int64_t reply_path) {
75550         void* entropy_source_ptr = untag_ptr(entropy_source);
75551         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
75552         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
75553         void* node_signer_ptr = untag_ptr(node_signer);
75554         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
75555         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
75556         LDKOnionMessagePath path_conv;
75557         path_conv.inner = untag_ptr(path);
75558         path_conv.is_owned = ptr_is_owned(path);
75559         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
75560         path_conv = OnionMessagePath_clone(&path_conv);
75561         void* contents_ptr = untag_ptr(contents);
75562         CHECK_ACCESS(contents_ptr);
75563         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
75564         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
75565                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75566                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
75567         }
75568         LDKBlindedPath reply_path_conv;
75569         reply_path_conv.inner = untag_ptr(reply_path);
75570         reply_path_conv.is_owned = ptr_is_owned(reply_path);
75571         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
75572         reply_path_conv = BlindedPath_clone(&reply_path_conv);
75573         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
75574         *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, path_conv, contents_conv, reply_path_conv);
75575         return tag_ptr(ret_conv, true);
75576 }
75577
75578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_peel_1onion_1message(JNIEnv *env, jclass clz, int64_t msg, int64_t node_signer, int64_t logger, int64_t custom_handler) {
75579         LDKOnionMessage msg_conv;
75580         msg_conv.inner = untag_ptr(msg);
75581         msg_conv.is_owned = ptr_is_owned(msg);
75582         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
75583         msg_conv.is_owned = false;
75584         void* node_signer_ptr = untag_ptr(node_signer);
75585         CHECK_ACCESS(node_signer_ptr);
75586         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75587         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75588                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75589                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75590         }
75591         void* logger_ptr = untag_ptr(logger);
75592         CHECK_ACCESS(logger_ptr);
75593         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75594         if (logger_conv.free == LDKLogger_JCalls_free) {
75595                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75596                 LDKLogger_JCalls_cloned(&logger_conv);
75597         }
75598         void* custom_handler_ptr = untag_ptr(custom_handler);
75599         CHECK_ACCESS(custom_handler_ptr);
75600         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
75601         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
75602                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75603                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
75604         }
75605         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
75606         *ret_conv = peel_onion_message(&msg_conv, node_signer_conv, logger_conv, custom_handler_conv);
75607         return tag_ptr(ret_conv, true);
75608 }
75609
75610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1new(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t logger, int64_t message_router, int64_t offers_handler, int64_t custom_handler) {
75611         void* entropy_source_ptr = untag_ptr(entropy_source);
75612         CHECK_ACCESS(entropy_source_ptr);
75613         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
75614         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
75615                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75616                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
75617         }
75618         void* node_signer_ptr = untag_ptr(node_signer);
75619         CHECK_ACCESS(node_signer_ptr);
75620         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
75621         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
75622                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75623                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
75624         }
75625         void* logger_ptr = untag_ptr(logger);
75626         CHECK_ACCESS(logger_ptr);
75627         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75628         if (logger_conv.free == LDKLogger_JCalls_free) {
75629                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75630                 LDKLogger_JCalls_cloned(&logger_conv);
75631         }
75632         void* message_router_ptr = untag_ptr(message_router);
75633         CHECK_ACCESS(message_router_ptr);
75634         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
75635         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
75636                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75637                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
75638         }
75639         void* offers_handler_ptr = untag_ptr(offers_handler);
75640         CHECK_ACCESS(offers_handler_ptr);
75641         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
75642         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
75643                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75644                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
75645         }
75646         void* custom_handler_ptr = untag_ptr(custom_handler);
75647         CHECK_ACCESS(custom_handler_ptr);
75648         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
75649         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
75650                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75651                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
75652         }
75653         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, message_router_conv, offers_handler_conv, custom_handler_conv);
75654         int64_t ret_ref = 0;
75655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75657         return ret_ref;
75658 }
75659
75660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1send_1onion_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t contents, int64_t destination, int64_t reply_path) {
75661         LDKOnionMessenger this_arg_conv;
75662         this_arg_conv.inner = untag_ptr(this_arg);
75663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75665         this_arg_conv.is_owned = false;
75666         void* contents_ptr = untag_ptr(contents);
75667         CHECK_ACCESS(contents_ptr);
75668         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
75669         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
75670                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75671                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
75672         }
75673         void* destination_ptr = untag_ptr(destination);
75674         CHECK_ACCESS(destination_ptr);
75675         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
75676         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
75677         LDKBlindedPath reply_path_conv;
75678         reply_path_conv.inner = untag_ptr(reply_path);
75679         reply_path_conv.is_owned = ptr_is_owned(reply_path);
75680         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
75681         reply_path_conv = BlindedPath_clone(&reply_path_conv);
75682         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
75683         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, contents_conv, destination_conv, reply_path_conv);
75684         return tag_ptr(ret_conv, true);
75685 }
75686
75687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
75688         LDKOnionMessenger this_arg_conv;
75689         this_arg_conv.inner = untag_ptr(this_arg);
75690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75692         this_arg_conv.is_owned = false;
75693         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
75694         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
75695         return tag_ptr(ret_ret, true);
75696 }
75697
75698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75699         if (!ptr_is_owned(this_ptr)) return;
75700         void* this_ptr_ptr = untag_ptr(this_ptr);
75701         CHECK_ACCESS(this_ptr_ptr);
75702         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
75703         FREE(untag_ptr(this_ptr));
75704         OffersMessageHandler_free(this_ptr_conv);
75705 }
75706
75707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OffersMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75708         if (!ptr_is_owned(this_ptr)) return;
75709         void* this_ptr_ptr = untag_ptr(this_ptr);
75710         CHECK_ACCESS(this_ptr_ptr);
75711         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
75712         FREE(untag_ptr(this_ptr));
75713         OffersMessage_free(this_ptr_conv);
75714 }
75715
75716 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
75717         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
75718         *ret_copy = OffersMessage_clone(arg);
75719         int64_t ret_ref = tag_ptr(ret_copy, true);
75720         return ret_ref;
75721 }
75722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75723         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
75724         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
75725         return ret_conv;
75726 }
75727
75728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75729         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
75730         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
75731         *ret_copy = OffersMessage_clone(orig_conv);
75732         int64_t ret_ref = tag_ptr(ret_copy, true);
75733         return ret_ref;
75734 }
75735
75736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice_1request(JNIEnv *env, jclass clz, int64_t a) {
75737         LDKInvoiceRequest a_conv;
75738         a_conv.inner = untag_ptr(a);
75739         a_conv.is_owned = ptr_is_owned(a);
75740         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75741         a_conv = InvoiceRequest_clone(&a_conv);
75742         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
75743         *ret_copy = OffersMessage_invoice_request(a_conv);
75744         int64_t ret_ref = tag_ptr(ret_copy, true);
75745         return ret_ref;
75746 }
75747
75748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice(JNIEnv *env, jclass clz, int64_t a) {
75749         LDKBolt12Invoice a_conv;
75750         a_conv.inner = untag_ptr(a);
75751         a_conv.is_owned = ptr_is_owned(a);
75752         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75753         a_conv = Bolt12Invoice_clone(&a_conv);
75754         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
75755         *ret_copy = OffersMessage_invoice(a_conv);
75756         int64_t ret_ref = tag_ptr(ret_copy, true);
75757         return ret_ref;
75758 }
75759
75760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice_1error(JNIEnv *env, jclass clz, int64_t a) {
75761         LDKInvoiceError a_conv;
75762         a_conv.inner = untag_ptr(a);
75763         a_conv.is_owned = ptr_is_owned(a);
75764         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75765         a_conv = InvoiceError_clone(&a_conv);
75766         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
75767         *ret_copy = OffersMessage_invoice_error(a_conv);
75768         int64_t ret_ref = tag_ptr(ret_copy, true);
75769         return ret_ref;
75770 }
75771
75772 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OffersMessage_1is_1known_1type(JNIEnv *env, jclass clz, int64_t tlv_type) {
75773         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
75774         return ret_conv;
75775 }
75776
75777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1as_1OnionMessageContents(JNIEnv *env, jclass clz, int64_t this_arg) {
75778         LDKOffersMessage* this_arg_conv = (LDKOffersMessage*)untag_ptr(this_arg);
75779         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
75780         *ret_ret = OffersMessage_as_OnionMessageContents(this_arg_conv);
75781         return tag_ptr(ret_ret, true);
75782 }
75783
75784 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OffersMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
75785         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
75786         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
75787         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
75788         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
75789         CVec_u8Z_free(ret_var);
75790         return ret_arr;
75791 }
75792
75793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg_a, int64_t arg_b) {
75794         LDKu8slice ser_ref;
75795         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
75796         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
75797         void* arg_b_ptr = untag_ptr(arg_b);
75798         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
75799         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
75800         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
75801         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
75802         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
75803         return tag_ptr(ret_conv, true);
75804 }
75805
75806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75807         LDKPacket this_obj_conv;
75808         this_obj_conv.inner = untag_ptr(this_obj);
75809         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75811         Packet_free(this_obj_conv);
75812 }
75813
75814 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Packet_1get_1version(JNIEnv *env, jclass clz, int64_t this_ptr) {
75815         LDKPacket this_ptr_conv;
75816         this_ptr_conv.inner = untag_ptr(this_ptr);
75817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75819         this_ptr_conv.is_owned = false;
75820         int8_t ret_conv = Packet_get_version(&this_ptr_conv);
75821         return ret_conv;
75822 }
75823
75824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1version(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
75825         LDKPacket this_ptr_conv;
75826         this_ptr_conv.inner = untag_ptr(this_ptr);
75827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75829         this_ptr_conv.is_owned = false;
75830         Packet_set_version(&this_ptr_conv, val);
75831 }
75832
75833 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
75834         LDKPacket this_ptr_conv;
75835         this_ptr_conv.inner = untag_ptr(this_ptr);
75836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75838         this_ptr_conv.is_owned = false;
75839         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
75840         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Packet_get_public_key(&this_ptr_conv).compressed_form);
75841         return ret_arr;
75842 }
75843
75844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
75845         LDKPacket this_ptr_conv;
75846         this_ptr_conv.inner = untag_ptr(this_ptr);
75847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75849         this_ptr_conv.is_owned = false;
75850         LDKPublicKey val_ref;
75851         CHECK((*env)->GetArrayLength(env, val) == 33);
75852         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
75853         Packet_set_public_key(&this_ptr_conv, val_ref);
75854 }
75855
75856 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
75857         LDKPacket this_ptr_conv;
75858         this_ptr_conv.inner = untag_ptr(this_ptr);
75859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75861         this_ptr_conv.is_owned = false;
75862         LDKCVec_u8Z ret_var = Packet_get_hop_data(&this_ptr_conv);
75863         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
75864         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
75865         CVec_u8Z_free(ret_var);
75866         return ret_arr;
75867 }
75868
75869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
75870         LDKPacket this_ptr_conv;
75871         this_ptr_conv.inner = untag_ptr(this_ptr);
75872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75874         this_ptr_conv.is_owned = false;
75875         LDKCVec_u8Z val_ref;
75876         val_ref.datalen = (*env)->GetArrayLength(env, val);
75877         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
75878         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
75879         Packet_set_hop_data(&this_ptr_conv, val_ref);
75880 }
75881
75882 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr) {
75883         LDKPacket this_ptr_conv;
75884         this_ptr_conv.inner = untag_ptr(this_ptr);
75885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75887         this_ptr_conv.is_owned = false;
75888         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
75889         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Packet_get_hmac(&this_ptr_conv));
75890         return ret_arr;
75891 }
75892
75893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
75894         LDKPacket this_ptr_conv;
75895         this_ptr_conv.inner = untag_ptr(this_ptr);
75896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75898         this_ptr_conv.is_owned = false;
75899         LDKThirtyTwoBytes val_ref;
75900         CHECK((*env)->GetArrayLength(env, val) == 32);
75901         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
75902         Packet_set_hmac(&this_ptr_conv, val_ref);
75903 }
75904
75905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1new(JNIEnv *env, jclass clz, int8_t version_arg, int8_tArray public_key_arg, int8_tArray hop_data_arg, int8_tArray hmac_arg) {
75906         LDKPublicKey public_key_arg_ref;
75907         CHECK((*env)->GetArrayLength(env, public_key_arg) == 33);
75908         (*env)->GetByteArrayRegion(env, public_key_arg, 0, 33, public_key_arg_ref.compressed_form);
75909         LDKCVec_u8Z hop_data_arg_ref;
75910         hop_data_arg_ref.datalen = (*env)->GetArrayLength(env, hop_data_arg);
75911         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
75912         (*env)->GetByteArrayRegion(env, hop_data_arg, 0, hop_data_arg_ref.datalen, hop_data_arg_ref.data);
75913         LDKThirtyTwoBytes hmac_arg_ref;
75914         CHECK((*env)->GetArrayLength(env, hmac_arg) == 32);
75915         (*env)->GetByteArrayRegion(env, hmac_arg, 0, 32, hmac_arg_ref.data);
75916         LDKPacket ret_var = Packet_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
75917         int64_t ret_ref = 0;
75918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75920         return ret_ref;
75921 }
75922
75923 static inline uint64_t Packet_clone_ptr(LDKPacket *NONNULL_PTR arg) {
75924         LDKPacket ret_var = Packet_clone(arg);
75925         int64_t ret_ref = 0;
75926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75928         return ret_ref;
75929 }
75930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75931         LDKPacket arg_conv;
75932         arg_conv.inner = untag_ptr(arg);
75933         arg_conv.is_owned = ptr_is_owned(arg);
75934         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75935         arg_conv.is_owned = false;
75936         int64_t ret_conv = Packet_clone_ptr(&arg_conv);
75937         return ret_conv;
75938 }
75939
75940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75941         LDKPacket orig_conv;
75942         orig_conv.inner = untag_ptr(orig);
75943         orig_conv.is_owned = ptr_is_owned(orig);
75944         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75945         orig_conv.is_owned = false;
75946         LDKPacket ret_var = Packet_clone(&orig_conv);
75947         int64_t ret_ref = 0;
75948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75950         return ret_ref;
75951 }
75952
75953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1hash(JNIEnv *env, jclass clz, int64_t o) {
75954         LDKPacket o_conv;
75955         o_conv.inner = untag_ptr(o);
75956         o_conv.is_owned = ptr_is_owned(o);
75957         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75958         o_conv.is_owned = false;
75959         int64_t ret_conv = Packet_hash(&o_conv);
75960         return ret_conv;
75961 }
75962
75963 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Packet_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75964         LDKPacket a_conv;
75965         a_conv.inner = untag_ptr(a);
75966         a_conv.is_owned = ptr_is_owned(a);
75967         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75968         a_conv.is_owned = false;
75969         LDKPacket b_conv;
75970         b_conv.inner = untag_ptr(b);
75971         b_conv.is_owned = ptr_is_owned(b);
75972         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75973         b_conv.is_owned = false;
75974         jboolean ret_conv = Packet_eq(&a_conv, &b_conv);
75975         return ret_conv;
75976 }
75977
75978 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1write(JNIEnv *env, jclass clz, int64_t obj) {
75979         LDKPacket obj_conv;
75980         obj_conv.inner = untag_ptr(obj);
75981         obj_conv.is_owned = ptr_is_owned(obj);
75982         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
75983         obj_conv.is_owned = false;
75984         LDKCVec_u8Z ret_var = Packet_write(&obj_conv);
75985         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
75986         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
75987         CVec_u8Z_free(ret_var);
75988         return ret_arr;
75989 }
75990
75991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75992         if (!ptr_is_owned(this_ptr)) return;
75993         void* this_ptr_ptr = untag_ptr(this_ptr);
75994         CHECK_ACCESS(this_ptr_ptr);
75995         LDKParsedOnionMessageContents this_ptr_conv = *(LDKParsedOnionMessageContents*)(this_ptr_ptr);
75996         FREE(untag_ptr(this_ptr));
75997         ParsedOnionMessageContents_free(this_ptr_conv);
75998 }
75999
76000 static inline uint64_t ParsedOnionMessageContents_clone_ptr(LDKParsedOnionMessageContents *NONNULL_PTR arg) {
76001         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
76002         *ret_copy = ParsedOnionMessageContents_clone(arg);
76003         int64_t ret_ref = tag_ptr(ret_copy, true);
76004         return ret_ref;
76005 }
76006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76007         LDKParsedOnionMessageContents* arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(arg);
76008         int64_t ret_conv = ParsedOnionMessageContents_clone_ptr(arg_conv);
76009         return ret_conv;
76010 }
76011
76012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76013         LDKParsedOnionMessageContents* orig_conv = (LDKParsedOnionMessageContents*)untag_ptr(orig);
76014         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
76015         *ret_copy = ParsedOnionMessageContents_clone(orig_conv);
76016         int64_t ret_ref = tag_ptr(ret_copy, true);
76017         return ret_ref;
76018 }
76019
76020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1offers(JNIEnv *env, jclass clz, int64_t a) {
76021         void* a_ptr = untag_ptr(a);
76022         CHECK_ACCESS(a_ptr);
76023         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
76024         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
76025         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
76026         *ret_copy = ParsedOnionMessageContents_offers(a_conv);
76027         int64_t ret_ref = tag_ptr(ret_copy, true);
76028         return ret_ref;
76029 }
76030
76031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1custom(JNIEnv *env, jclass clz, int64_t a) {
76032         void* a_ptr = untag_ptr(a);
76033         CHECK_ACCESS(a_ptr);
76034         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
76035         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
76036                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
76037                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
76038         }
76039         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
76040         *ret_copy = ParsedOnionMessageContents_custom(a_conv);
76041         int64_t ret_ref = tag_ptr(ret_copy, true);
76042         return ret_ref;
76043 }
76044
76045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1as_1OnionMessageContents(JNIEnv *env, jclass clz, int64_t this_arg) {
76046         LDKParsedOnionMessageContents* this_arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(this_arg);
76047         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
76048         *ret_ret = ParsedOnionMessageContents_as_OnionMessageContents(this_arg_conv);
76049         return tag_ptr(ret_ret, true);
76050 }
76051
76052 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1write(JNIEnv *env, jclass clz, int64_t obj) {
76053         LDKParsedOnionMessageContents* obj_conv = (LDKParsedOnionMessageContents*)untag_ptr(obj);
76054         LDKCVec_u8Z ret_var = ParsedOnionMessageContents_write(obj_conv);
76055         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
76056         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
76057         CVec_u8Z_free(ret_var);
76058         return ret_arr;
76059 }
76060
76061 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
76062         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
76063         *ret_ret = OnionMessageContents_clone(arg);
76064         return tag_ptr(ret_ret, true);
76065 }
76066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76067         void* arg_ptr = untag_ptr(arg);
76068         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
76069         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)arg_ptr;
76070         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
76071         return ret_conv;
76072 }
76073
76074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76075         void* orig_ptr = untag_ptr(orig);
76076         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
76077         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)orig_ptr;
76078         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
76079         *ret_ret = OnionMessageContents_clone(orig_conv);
76080         return tag_ptr(ret_ret, true);
76081 }
76082
76083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
76084         if (!ptr_is_owned(this_ptr)) return;
76085         void* this_ptr_ptr = untag_ptr(this_ptr);
76086         CHECK_ACCESS(this_ptr_ptr);
76087         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
76088         FREE(untag_ptr(this_ptr));
76089         OnionMessageContents_free(this_ptr_conv);
76090 }
76091
76092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76093         LDKBlindedPath this_obj_conv;
76094         this_obj_conv.inner = untag_ptr(this_obj);
76095         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76097         BlindedPath_free(this_obj_conv);
76098 }
76099
76100 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1introduction_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
76101         LDKBlindedPath this_ptr_conv;
76102         this_ptr_conv.inner = untag_ptr(this_ptr);
76103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76105         this_ptr_conv.is_owned = false;
76106         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
76107         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedPath_get_introduction_node_id(&this_ptr_conv).compressed_form);
76108         return ret_arr;
76109 }
76110
76111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1introduction_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
76112         LDKBlindedPath this_ptr_conv;
76113         this_ptr_conv.inner = untag_ptr(this_ptr);
76114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76116         this_ptr_conv.is_owned = false;
76117         LDKPublicKey val_ref;
76118         CHECK((*env)->GetArrayLength(env, val) == 33);
76119         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
76120         BlindedPath_set_introduction_node_id(&this_ptr_conv, val_ref);
76121 }
76122
76123 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
76124         LDKBlindedPath this_ptr_conv;
76125         this_ptr_conv.inner = untag_ptr(this_ptr);
76126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76128         this_ptr_conv.is_owned = false;
76129         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
76130         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedPath_get_blinding_point(&this_ptr_conv).compressed_form);
76131         return ret_arr;
76132 }
76133
76134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
76135         LDKBlindedPath this_ptr_conv;
76136         this_ptr_conv.inner = untag_ptr(this_ptr);
76137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76139         this_ptr_conv.is_owned = false;
76140         LDKPublicKey val_ref;
76141         CHECK((*env)->GetArrayLength(env, val) == 33);
76142         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
76143         BlindedPath_set_blinding_point(&this_ptr_conv, val_ref);
76144 }
76145
76146 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1blinded_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
76147         LDKBlindedPath this_ptr_conv;
76148         this_ptr_conv.inner = untag_ptr(this_ptr);
76149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76151         this_ptr_conv.is_owned = false;
76152         LDKCVec_BlindedHopZ ret_var = BlindedPath_get_blinded_hops(&this_ptr_conv);
76153         int64_tArray ret_arr = NULL;
76154         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
76155         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
76156         for (size_t m = 0; m < ret_var.datalen; m++) {
76157                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
76158                 int64_t ret_conv_12_ref = 0;
76159                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
76160                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
76161                 ret_arr_ptr[m] = ret_conv_12_ref;
76162         }
76163         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
76164         FREE(ret_var.data);
76165         return ret_arr;
76166 }
76167
76168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1blinded_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
76169         LDKBlindedPath this_ptr_conv;
76170         this_ptr_conv.inner = untag_ptr(this_ptr);
76171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76173         this_ptr_conv.is_owned = false;
76174         LDKCVec_BlindedHopZ val_constr;
76175         val_constr.datalen = (*env)->GetArrayLength(env, val);
76176         if (val_constr.datalen > 0)
76177                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
76178         else
76179                 val_constr.data = NULL;
76180         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
76181         for (size_t m = 0; m < val_constr.datalen; m++) {
76182                 int64_t val_conv_12 = val_vals[m];
76183                 LDKBlindedHop val_conv_12_conv;
76184                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
76185                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
76186                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
76187                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
76188                 val_constr.data[m] = val_conv_12_conv;
76189         }
76190         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
76191         BlindedPath_set_blinded_hops(&this_ptr_conv, val_constr);
76192 }
76193
76194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new(JNIEnv *env, jclass clz, int8_tArray introduction_node_id_arg, int8_tArray blinding_point_arg, int64_tArray blinded_hops_arg) {
76195         LDKPublicKey introduction_node_id_arg_ref;
76196         CHECK((*env)->GetArrayLength(env, introduction_node_id_arg) == 33);
76197         (*env)->GetByteArrayRegion(env, introduction_node_id_arg, 0, 33, introduction_node_id_arg_ref.compressed_form);
76198         LDKPublicKey blinding_point_arg_ref;
76199         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
76200         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
76201         LDKCVec_BlindedHopZ blinded_hops_arg_constr;
76202         blinded_hops_arg_constr.datalen = (*env)->GetArrayLength(env, blinded_hops_arg);
76203         if (blinded_hops_arg_constr.datalen > 0)
76204                 blinded_hops_arg_constr.data = MALLOC(blinded_hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
76205         else
76206                 blinded_hops_arg_constr.data = NULL;
76207         int64_t* blinded_hops_arg_vals = (*env)->GetLongArrayElements (env, blinded_hops_arg, NULL);
76208         for (size_t m = 0; m < blinded_hops_arg_constr.datalen; m++) {
76209                 int64_t blinded_hops_arg_conv_12 = blinded_hops_arg_vals[m];
76210                 LDKBlindedHop blinded_hops_arg_conv_12_conv;
76211                 blinded_hops_arg_conv_12_conv.inner = untag_ptr(blinded_hops_arg_conv_12);
76212                 blinded_hops_arg_conv_12_conv.is_owned = ptr_is_owned(blinded_hops_arg_conv_12);
76213                 CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_hops_arg_conv_12_conv);
76214                 blinded_hops_arg_conv_12_conv = BlindedHop_clone(&blinded_hops_arg_conv_12_conv);
76215                 blinded_hops_arg_constr.data[m] = blinded_hops_arg_conv_12_conv;
76216         }
76217         (*env)->ReleaseLongArrayElements(env, blinded_hops_arg, blinded_hops_arg_vals, 0);
76218         LDKBlindedPath ret_var = BlindedPath_new(introduction_node_id_arg_ref, blinding_point_arg_ref, blinded_hops_arg_constr);
76219         int64_t ret_ref = 0;
76220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76222         return ret_ref;
76223 }
76224
76225 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
76226         LDKBlindedPath ret_var = BlindedPath_clone(arg);
76227         int64_t ret_ref = 0;
76228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76230         return ret_ref;
76231 }
76232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76233         LDKBlindedPath arg_conv;
76234         arg_conv.inner = untag_ptr(arg);
76235         arg_conv.is_owned = ptr_is_owned(arg);
76236         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76237         arg_conv.is_owned = false;
76238         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
76239         return ret_conv;
76240 }
76241
76242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76243         LDKBlindedPath orig_conv;
76244         orig_conv.inner = untag_ptr(orig);
76245         orig_conv.is_owned = ptr_is_owned(orig);
76246         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76247         orig_conv.is_owned = false;
76248         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
76249         int64_t ret_ref = 0;
76250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76252         return ret_ref;
76253 }
76254
76255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1hash(JNIEnv *env, jclass clz, int64_t o) {
76256         LDKBlindedPath o_conv;
76257         o_conv.inner = untag_ptr(o);
76258         o_conv.is_owned = ptr_is_owned(o);
76259         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76260         o_conv.is_owned = false;
76261         int64_t ret_conv = BlindedPath_hash(&o_conv);
76262         return ret_conv;
76263 }
76264
76265 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedPath_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
76266         LDKBlindedPath a_conv;
76267         a_conv.inner = untag_ptr(a);
76268         a_conv.is_owned = ptr_is_owned(a);
76269         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76270         a_conv.is_owned = false;
76271         LDKBlindedPath b_conv;
76272         b_conv.inner = untag_ptr(b);
76273         b_conv.is_owned = ptr_is_owned(b);
76274         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76275         b_conv.is_owned = false;
76276         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
76277         return ret_conv;
76278 }
76279
76280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76281         LDKBlindedHop this_obj_conv;
76282         this_obj_conv.inner = untag_ptr(this_obj);
76283         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76285         BlindedHop_free(this_obj_conv);
76286 }
76287
76288 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1get_1blinded_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
76289         LDKBlindedHop this_ptr_conv;
76290         this_ptr_conv.inner = untag_ptr(this_ptr);
76291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76293         this_ptr_conv.is_owned = false;
76294         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
76295         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedHop_get_blinded_node_id(&this_ptr_conv).compressed_form);
76296         return ret_arr;
76297 }
76298
76299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1set_1blinded_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
76300         LDKBlindedHop this_ptr_conv;
76301         this_ptr_conv.inner = untag_ptr(this_ptr);
76302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76304         this_ptr_conv.is_owned = false;
76305         LDKPublicKey val_ref;
76306         CHECK((*env)->GetArrayLength(env, val) == 33);
76307         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
76308         BlindedHop_set_blinded_node_id(&this_ptr_conv, val_ref);
76309 }
76310
76311 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1get_1encrypted_1payload(JNIEnv *env, jclass clz, int64_t this_ptr) {
76312         LDKBlindedHop this_ptr_conv;
76313         this_ptr_conv.inner = untag_ptr(this_ptr);
76314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76316         this_ptr_conv.is_owned = false;
76317         LDKCVec_u8Z ret_var = BlindedHop_get_encrypted_payload(&this_ptr_conv);
76318         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
76319         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
76320         CVec_u8Z_free(ret_var);
76321         return ret_arr;
76322 }
76323
76324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1set_1encrypted_1payload(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
76325         LDKBlindedHop this_ptr_conv;
76326         this_ptr_conv.inner = untag_ptr(this_ptr);
76327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76329         this_ptr_conv.is_owned = false;
76330         LDKCVec_u8Z val_ref;
76331         val_ref.datalen = (*env)->GetArrayLength(env, val);
76332         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
76333         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
76334         BlindedHop_set_encrypted_payload(&this_ptr_conv, val_ref);
76335 }
76336
76337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1new(JNIEnv *env, jclass clz, int8_tArray blinded_node_id_arg, int8_tArray encrypted_payload_arg) {
76338         LDKPublicKey blinded_node_id_arg_ref;
76339         CHECK((*env)->GetArrayLength(env, blinded_node_id_arg) == 33);
76340         (*env)->GetByteArrayRegion(env, blinded_node_id_arg, 0, 33, blinded_node_id_arg_ref.compressed_form);
76341         LDKCVec_u8Z encrypted_payload_arg_ref;
76342         encrypted_payload_arg_ref.datalen = (*env)->GetArrayLength(env, encrypted_payload_arg);
76343         encrypted_payload_arg_ref.data = MALLOC(encrypted_payload_arg_ref.datalen, "LDKCVec_u8Z Bytes");
76344         (*env)->GetByteArrayRegion(env, encrypted_payload_arg, 0, encrypted_payload_arg_ref.datalen, encrypted_payload_arg_ref.data);
76345         LDKBlindedHop ret_var = BlindedHop_new(blinded_node_id_arg_ref, encrypted_payload_arg_ref);
76346         int64_t ret_ref = 0;
76347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76349         return ret_ref;
76350 }
76351
76352 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
76353         LDKBlindedHop ret_var = BlindedHop_clone(arg);
76354         int64_t ret_ref = 0;
76355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76357         return ret_ref;
76358 }
76359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76360         LDKBlindedHop arg_conv;
76361         arg_conv.inner = untag_ptr(arg);
76362         arg_conv.is_owned = ptr_is_owned(arg);
76363         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76364         arg_conv.is_owned = false;
76365         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
76366         return ret_conv;
76367 }
76368
76369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76370         LDKBlindedHop orig_conv;
76371         orig_conv.inner = untag_ptr(orig);
76372         orig_conv.is_owned = ptr_is_owned(orig);
76373         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76374         orig_conv.is_owned = false;
76375         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
76376         int64_t ret_ref = 0;
76377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76379         return ret_ref;
76380 }
76381
76382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
76383         LDKBlindedHop o_conv;
76384         o_conv.inner = untag_ptr(o);
76385         o_conv.is_owned = ptr_is_owned(o);
76386         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76387         o_conv.is_owned = false;
76388         int64_t ret_conv = BlindedHop_hash(&o_conv);
76389         return ret_conv;
76390 }
76391
76392 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
76393         LDKBlindedHop a_conv;
76394         a_conv.inner = untag_ptr(a);
76395         a_conv.is_owned = ptr_is_owned(a);
76396         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76397         a_conv.is_owned = false;
76398         LDKBlindedHop b_conv;
76399         b_conv.inner = untag_ptr(b);
76400         b_conv.is_owned = ptr_is_owned(b);
76401         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76402         b_conv.is_owned = false;
76403         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
76404         return ret_conv;
76405 }
76406
76407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1one_1hop_1for_1message(JNIEnv *env, jclass clz, int8_tArray recipient_node_id, int64_t entropy_source) {
76408         LDKPublicKey recipient_node_id_ref;
76409         CHECK((*env)->GetArrayLength(env, recipient_node_id) == 33);
76410         (*env)->GetByteArrayRegion(env, recipient_node_id, 0, 33, recipient_node_id_ref.compressed_form);
76411         void* entropy_source_ptr = untag_ptr(entropy_source);
76412         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
76413         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
76414         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
76415         *ret_conv = BlindedPath_one_hop_for_message(recipient_node_id_ref, entropy_source_conv);
76416         return tag_ptr(ret_conv, true);
76417 }
76418
76419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new_1for_1message(JNIEnv *env, jclass clz, jobjectArray node_pks, int64_t entropy_source) {
76420         LDKCVec_PublicKeyZ node_pks_constr;
76421         node_pks_constr.datalen = (*env)->GetArrayLength(env, node_pks);
76422         if (node_pks_constr.datalen > 0)
76423                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
76424         else
76425                 node_pks_constr.data = NULL;
76426         for (size_t i = 0; i < node_pks_constr.datalen; i++) {
76427                 int8_tArray node_pks_conv_8 = (*env)->GetObjectArrayElement(env, node_pks, i);
76428                 LDKPublicKey node_pks_conv_8_ref;
76429                 CHECK((*env)->GetArrayLength(env, node_pks_conv_8) == 33);
76430                 (*env)->GetByteArrayRegion(env, node_pks_conv_8, 0, 33, node_pks_conv_8_ref.compressed_form);
76431                 node_pks_constr.data[i] = node_pks_conv_8_ref;
76432         }
76433         void* entropy_source_ptr = untag_ptr(entropy_source);
76434         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
76435         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
76436         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
76437         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
76438         return tag_ptr(ret_conv, true);
76439 }
76440
76441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1one_1hop_1for_1payment(JNIEnv *env, jclass clz, int8_tArray payee_node_id, int64_t payee_tlvs, int64_t entropy_source) {
76442         LDKPublicKey payee_node_id_ref;
76443         CHECK((*env)->GetArrayLength(env, payee_node_id) == 33);
76444         (*env)->GetByteArrayRegion(env, payee_node_id, 0, 33, payee_node_id_ref.compressed_form);
76445         LDKReceiveTlvs payee_tlvs_conv;
76446         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
76447         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
76448         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
76449         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
76450         void* entropy_source_ptr = untag_ptr(entropy_source);
76451         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
76452         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
76453         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
76454         *ret_conv = BlindedPath_one_hop_for_payment(payee_node_id_ref, payee_tlvs_conv, entropy_source_conv);
76455         return tag_ptr(ret_conv, true);
76456 }
76457
76458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new_1for_1payment(JNIEnv *env, jclass clz, int64_tArray intermediate_nodes, int8_tArray payee_node_id, int64_t payee_tlvs, int64_t htlc_maximum_msat, int64_t entropy_source) {
76459         LDKCVec_ForwardNodeZ intermediate_nodes_constr;
76460         intermediate_nodes_constr.datalen = (*env)->GetArrayLength(env, intermediate_nodes);
76461         if (intermediate_nodes_constr.datalen > 0)
76462                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
76463         else
76464                 intermediate_nodes_constr.data = NULL;
76465         int64_t* intermediate_nodes_vals = (*env)->GetLongArrayElements (env, intermediate_nodes, NULL);
76466         for (size_t n = 0; n < intermediate_nodes_constr.datalen; n++) {
76467                 int64_t intermediate_nodes_conv_13 = intermediate_nodes_vals[n];
76468                 LDKForwardNode intermediate_nodes_conv_13_conv;
76469                 intermediate_nodes_conv_13_conv.inner = untag_ptr(intermediate_nodes_conv_13);
76470                 intermediate_nodes_conv_13_conv.is_owned = ptr_is_owned(intermediate_nodes_conv_13);
76471                 CHECK_INNER_FIELD_ACCESS_OR_NULL(intermediate_nodes_conv_13_conv);
76472                 intermediate_nodes_conv_13_conv = ForwardNode_clone(&intermediate_nodes_conv_13_conv);
76473                 intermediate_nodes_constr.data[n] = intermediate_nodes_conv_13_conv;
76474         }
76475         (*env)->ReleaseLongArrayElements(env, intermediate_nodes, intermediate_nodes_vals, 0);
76476         LDKPublicKey payee_node_id_ref;
76477         CHECK((*env)->GetArrayLength(env, payee_node_id) == 33);
76478         (*env)->GetByteArrayRegion(env, payee_node_id, 0, 33, payee_node_id_ref.compressed_form);
76479         LDKReceiveTlvs payee_tlvs_conv;
76480         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
76481         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
76482         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
76483         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
76484         void* entropy_source_ptr = untag_ptr(entropy_source);
76485         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
76486         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
76487         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
76488         *ret_conv = BlindedPath_new_for_payment(intermediate_nodes_constr, payee_node_id_ref, payee_tlvs_conv, htlc_maximum_msat, entropy_source_conv);
76489         return tag_ptr(ret_conv, true);
76490 }
76491
76492 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1write(JNIEnv *env, jclass clz, int64_t obj) {
76493         LDKBlindedPath obj_conv;
76494         obj_conv.inner = untag_ptr(obj);
76495         obj_conv.is_owned = ptr_is_owned(obj);
76496         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
76497         obj_conv.is_owned = false;
76498         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
76499         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
76500         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
76501         CVec_u8Z_free(ret_var);
76502         return ret_arr;
76503 }
76504
76505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
76506         LDKu8slice ser_ref;
76507         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
76508         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
76509         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
76510         *ret_conv = BlindedPath_read(ser_ref);
76511         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
76512         return tag_ptr(ret_conv, true);
76513 }
76514
76515 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
76516         LDKBlindedHop obj_conv;
76517         obj_conv.inner = untag_ptr(obj);
76518         obj_conv.is_owned = ptr_is_owned(obj);
76519         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
76520         obj_conv.is_owned = false;
76521         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
76522         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
76523         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
76524         CVec_u8Z_free(ret_var);
76525         return ret_arr;
76526 }
76527
76528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
76529         LDKu8slice ser_ref;
76530         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
76531         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
76532         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
76533         *ret_conv = BlindedHop_read(ser_ref);
76534         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
76535         return tag_ptr(ret_conv, true);
76536 }
76537
76538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76539         LDKForwardNode this_obj_conv;
76540         this_obj_conv.inner = untag_ptr(this_obj);
76541         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76543         ForwardNode_free(this_obj_conv);
76544 }
76545
76546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1tlvs(JNIEnv *env, jclass clz, int64_t this_ptr) {
76547         LDKForwardNode this_ptr_conv;
76548         this_ptr_conv.inner = untag_ptr(this_ptr);
76549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76551         this_ptr_conv.is_owned = false;
76552         LDKForwardTlvs ret_var = ForwardNode_get_tlvs(&this_ptr_conv);
76553         int64_t ret_ref = 0;
76554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76556         return ret_ref;
76557 }
76558
76559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1tlvs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76560         LDKForwardNode this_ptr_conv;
76561         this_ptr_conv.inner = untag_ptr(this_ptr);
76562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76564         this_ptr_conv.is_owned = false;
76565         LDKForwardTlvs val_conv;
76566         val_conv.inner = untag_ptr(val);
76567         val_conv.is_owned = ptr_is_owned(val);
76568         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76569         val_conv = ForwardTlvs_clone(&val_conv);
76570         ForwardNode_set_tlvs(&this_ptr_conv, val_conv);
76571 }
76572
76573 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
76574         LDKForwardNode this_ptr_conv;
76575         this_ptr_conv.inner = untag_ptr(this_ptr);
76576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76578         this_ptr_conv.is_owned = false;
76579         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
76580         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ForwardNode_get_node_id(&this_ptr_conv).compressed_form);
76581         return ret_arr;
76582 }
76583
76584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
76585         LDKForwardNode this_ptr_conv;
76586         this_ptr_conv.inner = untag_ptr(this_ptr);
76587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76589         this_ptr_conv.is_owned = false;
76590         LDKPublicKey val_ref;
76591         CHECK((*env)->GetArrayLength(env, val) == 33);
76592         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
76593         ForwardNode_set_node_id(&this_ptr_conv, val_ref);
76594 }
76595
76596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
76597         LDKForwardNode this_ptr_conv;
76598         this_ptr_conv.inner = untag_ptr(this_ptr);
76599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76601         this_ptr_conv.is_owned = false;
76602         int64_t ret_conv = ForwardNode_get_htlc_maximum_msat(&this_ptr_conv);
76603         return ret_conv;
76604 }
76605
76606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76607         LDKForwardNode this_ptr_conv;
76608         this_ptr_conv.inner = untag_ptr(this_ptr);
76609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76611         this_ptr_conv.is_owned = false;
76612         ForwardNode_set_htlc_maximum_msat(&this_ptr_conv, val);
76613 }
76614
76615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1new(JNIEnv *env, jclass clz, int64_t tlvs_arg, int8_tArray node_id_arg, int64_t htlc_maximum_msat_arg) {
76616         LDKForwardTlvs tlvs_arg_conv;
76617         tlvs_arg_conv.inner = untag_ptr(tlvs_arg);
76618         tlvs_arg_conv.is_owned = ptr_is_owned(tlvs_arg);
76619         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_arg_conv);
76620         tlvs_arg_conv = ForwardTlvs_clone(&tlvs_arg_conv);
76621         LDKPublicKey node_id_arg_ref;
76622         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
76623         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
76624         LDKForwardNode ret_var = ForwardNode_new(tlvs_arg_conv, node_id_arg_ref, htlc_maximum_msat_arg);
76625         int64_t ret_ref = 0;
76626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76628         return ret_ref;
76629 }
76630
76631 static inline uint64_t ForwardNode_clone_ptr(LDKForwardNode *NONNULL_PTR arg) {
76632         LDKForwardNode ret_var = ForwardNode_clone(arg);
76633         int64_t ret_ref = 0;
76634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76636         return ret_ref;
76637 }
76638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76639         LDKForwardNode arg_conv;
76640         arg_conv.inner = untag_ptr(arg);
76641         arg_conv.is_owned = ptr_is_owned(arg);
76642         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76643         arg_conv.is_owned = false;
76644         int64_t ret_conv = ForwardNode_clone_ptr(&arg_conv);
76645         return ret_conv;
76646 }
76647
76648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76649         LDKForwardNode orig_conv;
76650         orig_conv.inner = untag_ptr(orig);
76651         orig_conv.is_owned = ptr_is_owned(orig);
76652         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76653         orig_conv.is_owned = false;
76654         LDKForwardNode ret_var = ForwardNode_clone(&orig_conv);
76655         int64_t ret_ref = 0;
76656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76658         return ret_ref;
76659 }
76660
76661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76662         LDKForwardTlvs this_obj_conv;
76663         this_obj_conv.inner = untag_ptr(this_obj);
76664         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76666         ForwardTlvs_free(this_obj_conv);
76667 }
76668
76669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
76670         LDKForwardTlvs this_ptr_conv;
76671         this_ptr_conv.inner = untag_ptr(this_ptr);
76672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76674         this_ptr_conv.is_owned = false;
76675         int64_t ret_conv = ForwardTlvs_get_short_channel_id(&this_ptr_conv);
76676         return ret_conv;
76677 }
76678
76679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76680         LDKForwardTlvs this_ptr_conv;
76681         this_ptr_conv.inner = untag_ptr(this_ptr);
76682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76684         this_ptr_conv.is_owned = false;
76685         ForwardTlvs_set_short_channel_id(&this_ptr_conv, val);
76686 }
76687
76688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1payment_1relay(JNIEnv *env, jclass clz, int64_t this_ptr) {
76689         LDKForwardTlvs this_ptr_conv;
76690         this_ptr_conv.inner = untag_ptr(this_ptr);
76691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76693         this_ptr_conv.is_owned = false;
76694         LDKPaymentRelay ret_var = ForwardTlvs_get_payment_relay(&this_ptr_conv);
76695         int64_t ret_ref = 0;
76696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76698         return ret_ref;
76699 }
76700
76701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1payment_1relay(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76702         LDKForwardTlvs this_ptr_conv;
76703         this_ptr_conv.inner = untag_ptr(this_ptr);
76704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76706         this_ptr_conv.is_owned = false;
76707         LDKPaymentRelay val_conv;
76708         val_conv.inner = untag_ptr(val);
76709         val_conv.is_owned = ptr_is_owned(val);
76710         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76711         val_conv = PaymentRelay_clone(&val_conv);
76712         ForwardTlvs_set_payment_relay(&this_ptr_conv, val_conv);
76713 }
76714
76715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr) {
76716         LDKForwardTlvs this_ptr_conv;
76717         this_ptr_conv.inner = untag_ptr(this_ptr);
76718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76720         this_ptr_conv.is_owned = false;
76721         LDKPaymentConstraints ret_var = ForwardTlvs_get_payment_constraints(&this_ptr_conv);
76722         int64_t ret_ref = 0;
76723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76725         return ret_ref;
76726 }
76727
76728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76729         LDKForwardTlvs this_ptr_conv;
76730         this_ptr_conv.inner = untag_ptr(this_ptr);
76731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76733         this_ptr_conv.is_owned = false;
76734         LDKPaymentConstraints val_conv;
76735         val_conv.inner = untag_ptr(val);
76736         val_conv.is_owned = ptr_is_owned(val);
76737         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76738         val_conv = PaymentConstraints_clone(&val_conv);
76739         ForwardTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
76740 }
76741
76742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
76743         LDKForwardTlvs this_ptr_conv;
76744         this_ptr_conv.inner = untag_ptr(this_ptr);
76745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76747         this_ptr_conv.is_owned = false;
76748         LDKBlindedHopFeatures ret_var = ForwardTlvs_get_features(&this_ptr_conv);
76749         int64_t ret_ref = 0;
76750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76752         return ret_ref;
76753 }
76754
76755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76756         LDKForwardTlvs this_ptr_conv;
76757         this_ptr_conv.inner = untag_ptr(this_ptr);
76758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76760         this_ptr_conv.is_owned = false;
76761         LDKBlindedHopFeatures val_conv;
76762         val_conv.inner = untag_ptr(val);
76763         val_conv.is_owned = ptr_is_owned(val);
76764         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76765         val_conv = BlindedHopFeatures_clone(&val_conv);
76766         ForwardTlvs_set_features(&this_ptr_conv, val_conv);
76767 }
76768
76769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1new(JNIEnv *env, jclass clz, int64_t short_channel_id_arg, int64_t payment_relay_arg, int64_t payment_constraints_arg, int64_t features_arg) {
76770         LDKPaymentRelay payment_relay_arg_conv;
76771         payment_relay_arg_conv.inner = untag_ptr(payment_relay_arg);
76772         payment_relay_arg_conv.is_owned = ptr_is_owned(payment_relay_arg);
76773         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_relay_arg_conv);
76774         payment_relay_arg_conv = PaymentRelay_clone(&payment_relay_arg_conv);
76775         LDKPaymentConstraints payment_constraints_arg_conv;
76776         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
76777         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
76778         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
76779         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
76780         LDKBlindedHopFeatures features_arg_conv;
76781         features_arg_conv.inner = untag_ptr(features_arg);
76782         features_arg_conv.is_owned = ptr_is_owned(features_arg);
76783         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
76784         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
76785         LDKForwardTlvs ret_var = ForwardTlvs_new(short_channel_id_arg, payment_relay_arg_conv, payment_constraints_arg_conv, features_arg_conv);
76786         int64_t ret_ref = 0;
76787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76789         return ret_ref;
76790 }
76791
76792 static inline uint64_t ForwardTlvs_clone_ptr(LDKForwardTlvs *NONNULL_PTR arg) {
76793         LDKForwardTlvs ret_var = ForwardTlvs_clone(arg);
76794         int64_t ret_ref = 0;
76795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76797         return ret_ref;
76798 }
76799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76800         LDKForwardTlvs arg_conv;
76801         arg_conv.inner = untag_ptr(arg);
76802         arg_conv.is_owned = ptr_is_owned(arg);
76803         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76804         arg_conv.is_owned = false;
76805         int64_t ret_conv = ForwardTlvs_clone_ptr(&arg_conv);
76806         return ret_conv;
76807 }
76808
76809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76810         LDKForwardTlvs orig_conv;
76811         orig_conv.inner = untag_ptr(orig);
76812         orig_conv.is_owned = ptr_is_owned(orig);
76813         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76814         orig_conv.is_owned = false;
76815         LDKForwardTlvs ret_var = ForwardTlvs_clone(&orig_conv);
76816         int64_t ret_ref = 0;
76817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76819         return ret_ref;
76820 }
76821
76822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76823         LDKReceiveTlvs this_obj_conv;
76824         this_obj_conv.inner = untag_ptr(this_obj);
76825         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76827         ReceiveTlvs_free(this_obj_conv);
76828 }
76829
76830 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
76831         LDKReceiveTlvs this_ptr_conv;
76832         this_ptr_conv.inner = untag_ptr(this_ptr);
76833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76835         this_ptr_conv.is_owned = false;
76836         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
76837         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReceiveTlvs_get_payment_secret(&this_ptr_conv));
76838         return ret_arr;
76839 }
76840
76841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
76842         LDKReceiveTlvs this_ptr_conv;
76843         this_ptr_conv.inner = untag_ptr(this_ptr);
76844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76846         this_ptr_conv.is_owned = false;
76847         LDKThirtyTwoBytes val_ref;
76848         CHECK((*env)->GetArrayLength(env, val) == 32);
76849         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
76850         ReceiveTlvs_set_payment_secret(&this_ptr_conv, val_ref);
76851 }
76852
76853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1get_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr) {
76854         LDKReceiveTlvs this_ptr_conv;
76855         this_ptr_conv.inner = untag_ptr(this_ptr);
76856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76858         this_ptr_conv.is_owned = false;
76859         LDKPaymentConstraints ret_var = ReceiveTlvs_get_payment_constraints(&this_ptr_conv);
76860         int64_t ret_ref = 0;
76861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76863         return ret_ref;
76864 }
76865
76866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1set_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76867         LDKReceiveTlvs this_ptr_conv;
76868         this_ptr_conv.inner = untag_ptr(this_ptr);
76869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76871         this_ptr_conv.is_owned = false;
76872         LDKPaymentConstraints val_conv;
76873         val_conv.inner = untag_ptr(val);
76874         val_conv.is_owned = ptr_is_owned(val);
76875         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76876         val_conv = PaymentConstraints_clone(&val_conv);
76877         ReceiveTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
76878 }
76879
76880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1new(JNIEnv *env, jclass clz, int8_tArray payment_secret_arg, int64_t payment_constraints_arg) {
76881         LDKThirtyTwoBytes payment_secret_arg_ref;
76882         CHECK((*env)->GetArrayLength(env, payment_secret_arg) == 32);
76883         (*env)->GetByteArrayRegion(env, payment_secret_arg, 0, 32, payment_secret_arg_ref.data);
76884         LDKPaymentConstraints payment_constraints_arg_conv;
76885         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
76886         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
76887         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
76888         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
76889         LDKReceiveTlvs ret_var = ReceiveTlvs_new(payment_secret_arg_ref, payment_constraints_arg_conv);
76890         int64_t ret_ref = 0;
76891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76893         return ret_ref;
76894 }
76895
76896 static inline uint64_t ReceiveTlvs_clone_ptr(LDKReceiveTlvs *NONNULL_PTR arg) {
76897         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(arg);
76898         int64_t ret_ref = 0;
76899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76901         return ret_ref;
76902 }
76903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76904         LDKReceiveTlvs arg_conv;
76905         arg_conv.inner = untag_ptr(arg);
76906         arg_conv.is_owned = ptr_is_owned(arg);
76907         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76908         arg_conv.is_owned = false;
76909         int64_t ret_conv = ReceiveTlvs_clone_ptr(&arg_conv);
76910         return ret_conv;
76911 }
76912
76913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76914         LDKReceiveTlvs orig_conv;
76915         orig_conv.inner = untag_ptr(orig);
76916         orig_conv.is_owned = ptr_is_owned(orig);
76917         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76918         orig_conv.is_owned = false;
76919         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(&orig_conv);
76920         int64_t ret_ref = 0;
76921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76923         return ret_ref;
76924 }
76925
76926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76927         LDKPaymentRelay this_obj_conv;
76928         this_obj_conv.inner = untag_ptr(this_obj);
76929         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76931         PaymentRelay_free(this_obj_conv);
76932 }
76933
76934 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
76935         LDKPaymentRelay this_ptr_conv;
76936         this_ptr_conv.inner = untag_ptr(this_ptr);
76937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76939         this_ptr_conv.is_owned = false;
76940         int16_t ret_conv = PaymentRelay_get_cltv_expiry_delta(&this_ptr_conv);
76941         return ret_conv;
76942 }
76943
76944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
76945         LDKPaymentRelay this_ptr_conv;
76946         this_ptr_conv.inner = untag_ptr(this_ptr);
76947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76949         this_ptr_conv.is_owned = false;
76950         PaymentRelay_set_cltv_expiry_delta(&this_ptr_conv, val);
76951 }
76952
76953 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
76954         LDKPaymentRelay this_ptr_conv;
76955         this_ptr_conv.inner = untag_ptr(this_ptr);
76956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76958         this_ptr_conv.is_owned = false;
76959         int32_t ret_conv = PaymentRelay_get_fee_proportional_millionths(&this_ptr_conv);
76960         return ret_conv;
76961 }
76962
76963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
76964         LDKPaymentRelay this_ptr_conv;
76965         this_ptr_conv.inner = untag_ptr(this_ptr);
76966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76968         this_ptr_conv.is_owned = false;
76969         PaymentRelay_set_fee_proportional_millionths(&this_ptr_conv, val);
76970 }
76971
76972 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
76973         LDKPaymentRelay this_ptr_conv;
76974         this_ptr_conv.inner = untag_ptr(this_ptr);
76975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76977         this_ptr_conv.is_owned = false;
76978         int32_t ret_conv = PaymentRelay_get_fee_base_msat(&this_ptr_conv);
76979         return ret_conv;
76980 }
76981
76982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
76983         LDKPaymentRelay this_ptr_conv;
76984         this_ptr_conv.inner = untag_ptr(this_ptr);
76985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76987         this_ptr_conv.is_owned = false;
76988         PaymentRelay_set_fee_base_msat(&this_ptr_conv, val);
76989 }
76990
76991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1new(JNIEnv *env, jclass clz, int16_t cltv_expiry_delta_arg, int32_t fee_proportional_millionths_arg, int32_t fee_base_msat_arg) {
76992         LDKPaymentRelay ret_var = PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
76993         int64_t ret_ref = 0;
76994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76996         return ret_ref;
76997 }
76998
76999 static inline uint64_t PaymentRelay_clone_ptr(LDKPaymentRelay *NONNULL_PTR arg) {
77000         LDKPaymentRelay ret_var = PaymentRelay_clone(arg);
77001         int64_t ret_ref = 0;
77002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77004         return ret_ref;
77005 }
77006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77007         LDKPaymentRelay arg_conv;
77008         arg_conv.inner = untag_ptr(arg);
77009         arg_conv.is_owned = ptr_is_owned(arg);
77010         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77011         arg_conv.is_owned = false;
77012         int64_t ret_conv = PaymentRelay_clone_ptr(&arg_conv);
77013         return ret_conv;
77014 }
77015
77016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77017         LDKPaymentRelay orig_conv;
77018         orig_conv.inner = untag_ptr(orig);
77019         orig_conv.is_owned = ptr_is_owned(orig);
77020         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77021         orig_conv.is_owned = false;
77022         LDKPaymentRelay ret_var = PaymentRelay_clone(&orig_conv);
77023         int64_t ret_ref = 0;
77024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77026         return ret_ref;
77027 }
77028
77029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
77030         LDKPaymentConstraints this_obj_conv;
77031         this_obj_conv.inner = untag_ptr(this_obj);
77032         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77034         PaymentConstraints_free(this_obj_conv);
77035 }
77036
77037 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1get_1max_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
77038         LDKPaymentConstraints this_ptr_conv;
77039         this_ptr_conv.inner = untag_ptr(this_ptr);
77040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77042         this_ptr_conv.is_owned = false;
77043         int32_t ret_conv = PaymentConstraints_get_max_cltv_expiry(&this_ptr_conv);
77044         return ret_conv;
77045 }
77046
77047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1set_1max_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
77048         LDKPaymentConstraints this_ptr_conv;
77049         this_ptr_conv.inner = untag_ptr(this_ptr);
77050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77052         this_ptr_conv.is_owned = false;
77053         PaymentConstraints_set_max_cltv_expiry(&this_ptr_conv, val);
77054 }
77055
77056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
77057         LDKPaymentConstraints this_ptr_conv;
77058         this_ptr_conv.inner = untag_ptr(this_ptr);
77059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77061         this_ptr_conv.is_owned = false;
77062         int64_t ret_conv = PaymentConstraints_get_htlc_minimum_msat(&this_ptr_conv);
77063         return ret_conv;
77064 }
77065
77066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
77067         LDKPaymentConstraints this_ptr_conv;
77068         this_ptr_conv.inner = untag_ptr(this_ptr);
77069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77071         this_ptr_conv.is_owned = false;
77072         PaymentConstraints_set_htlc_minimum_msat(&this_ptr_conv, val);
77073 }
77074
77075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1new(JNIEnv *env, jclass clz, int32_t max_cltv_expiry_arg, int64_t htlc_minimum_msat_arg) {
77076         LDKPaymentConstraints ret_var = PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
77077         int64_t ret_ref = 0;
77078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77080         return ret_ref;
77081 }
77082
77083 static inline uint64_t PaymentConstraints_clone_ptr(LDKPaymentConstraints *NONNULL_PTR arg) {
77084         LDKPaymentConstraints ret_var = PaymentConstraints_clone(arg);
77085         int64_t ret_ref = 0;
77086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77088         return ret_ref;
77089 }
77090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77091         LDKPaymentConstraints arg_conv;
77092         arg_conv.inner = untag_ptr(arg);
77093         arg_conv.is_owned = ptr_is_owned(arg);
77094         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77095         arg_conv.is_owned = false;
77096         int64_t ret_conv = PaymentConstraints_clone_ptr(&arg_conv);
77097         return ret_conv;
77098 }
77099
77100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77101         LDKPaymentConstraints orig_conv;
77102         orig_conv.inner = untag_ptr(orig);
77103         orig_conv.is_owned = ptr_is_owned(orig);
77104         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77105         orig_conv.is_owned = false;
77106         LDKPaymentConstraints ret_var = PaymentConstraints_clone(&orig_conv);
77107         int64_t ret_ref = 0;
77108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77110         return ret_ref;
77111 }
77112
77113 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1write(JNIEnv *env, jclass clz, int64_t obj) {
77114         LDKForwardTlvs obj_conv;
77115         obj_conv.inner = untag_ptr(obj);
77116         obj_conv.is_owned = ptr_is_owned(obj);
77117         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77118         obj_conv.is_owned = false;
77119         LDKCVec_u8Z ret_var = ForwardTlvs_write(&obj_conv);
77120         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77121         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77122         CVec_u8Z_free(ret_var);
77123         return ret_arr;
77124 }
77125
77126 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1write(JNIEnv *env, jclass clz, int64_t obj) {
77127         LDKReceiveTlvs obj_conv;
77128         obj_conv.inner = untag_ptr(obj);
77129         obj_conv.is_owned = ptr_is_owned(obj);
77130         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77131         obj_conv.is_owned = false;
77132         LDKCVec_u8Z ret_var = ReceiveTlvs_write(&obj_conv);
77133         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77134         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77135         CVec_u8Z_free(ret_var);
77136         return ret_arr;
77137 }
77138
77139 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1write(JNIEnv *env, jclass clz, int64_t obj) {
77140         LDKPaymentRelay obj_conv;
77141         obj_conv.inner = untag_ptr(obj);
77142         obj_conv.is_owned = ptr_is_owned(obj);
77143         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77144         obj_conv.is_owned = false;
77145         LDKCVec_u8Z ret_var = PaymentRelay_write(&obj_conv);
77146         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77147         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77148         CVec_u8Z_free(ret_var);
77149         return ret_arr;
77150 }
77151
77152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77153         LDKu8slice ser_ref;
77154         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77155         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77156         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
77157         *ret_conv = PaymentRelay_read(ser_ref);
77158         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77159         return tag_ptr(ret_conv, true);
77160 }
77161
77162 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1write(JNIEnv *env, jclass clz, int64_t obj) {
77163         LDKPaymentConstraints obj_conv;
77164         obj_conv.inner = untag_ptr(obj);
77165         obj_conv.is_owned = ptr_is_owned(obj);
77166         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77167         obj_conv.is_owned = false;
77168         LDKCVec_u8Z ret_var = PaymentConstraints_write(&obj_conv);
77169         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77170         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77171         CVec_u8Z_free(ret_var);
77172         return ret_arr;
77173 }
77174
77175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77176         LDKu8slice ser_ref;
77177         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77178         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77179         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
77180         *ret_conv = PaymentConstraints_read(ser_ref);
77181         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77182         return tag_ptr(ret_conv, true);
77183 }
77184
77185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
77186         if (!ptr_is_owned(this_ptr)) return;
77187         void* this_ptr_ptr = untag_ptr(this_ptr);
77188         CHECK_ACCESS(this_ptr_ptr);
77189         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
77190         FREE(untag_ptr(this_ptr));
77191         PaymentPurpose_free(this_ptr_conv);
77192 }
77193
77194 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
77195         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
77196         *ret_copy = PaymentPurpose_clone(arg);
77197         int64_t ret_ref = tag_ptr(ret_copy, true);
77198         return ret_ref;
77199 }
77200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77201         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
77202         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
77203         return ret_conv;
77204 }
77205
77206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77207         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
77208         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
77209         *ret_copy = PaymentPurpose_clone(orig_conv);
77210         int64_t ret_ref = tag_ptr(ret_copy, true);
77211         return ret_ref;
77212 }
77213
77214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int64_t payment_preimage, int8_tArray payment_secret) {
77215         void* payment_preimage_ptr = untag_ptr(payment_preimage);
77216         CHECK_ACCESS(payment_preimage_ptr);
77217         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
77218         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
77219         LDKThirtyTwoBytes payment_secret_ref;
77220         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
77221         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
77222         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
77223         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_conv, payment_secret_ref);
77224         int64_t ret_ref = tag_ptr(ret_copy, true);
77225         return ret_ref;
77226 }
77227
77228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
77229         LDKThirtyTwoBytes a_ref;
77230         CHECK((*env)->GetArrayLength(env, a) == 32);
77231         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
77232         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
77233         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
77234         int64_t ret_ref = tag_ptr(ret_copy, true);
77235         return ret_ref;
77236 }
77237
77238 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
77239         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
77240         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
77241         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
77242         return ret_conv;
77243 }
77244
77245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1preimage(JNIEnv *env, jclass clz, int64_t this_arg) {
77246         LDKPaymentPurpose* this_arg_conv = (LDKPaymentPurpose*)untag_ptr(this_arg);
77247         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
77248         *ret_copy = PaymentPurpose_preimage(this_arg_conv);
77249         int64_t ret_ref = tag_ptr(ret_copy, true);
77250         return ret_ref;
77251 }
77252
77253 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1write(JNIEnv *env, jclass clz, int64_t obj) {
77254         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
77255         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
77256         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77257         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77258         CVec_u8Z_free(ret_var);
77259         return ret_arr;
77260 }
77261
77262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77263         LDKu8slice ser_ref;
77264         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77265         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77266         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
77267         *ret_conv = PaymentPurpose_read(ser_ref);
77268         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77269         return tag_ptr(ret_conv, true);
77270 }
77271
77272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
77273         LDKClaimedHTLC this_obj_conv;
77274         this_obj_conv.inner = untag_ptr(this_obj);
77275         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77277         ClaimedHTLC_free(this_obj_conv);
77278 }
77279
77280 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
77281         LDKClaimedHTLC this_ptr_conv;
77282         this_ptr_conv.inner = untag_ptr(this_ptr);
77283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77285         this_ptr_conv.is_owned = false;
77286         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
77287         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClaimedHTLC_get_channel_id(&this_ptr_conv));
77288         return ret_arr;
77289 }
77290
77291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
77292         LDKClaimedHTLC this_ptr_conv;
77293         this_ptr_conv.inner = untag_ptr(this_ptr);
77294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77296         this_ptr_conv.is_owned = false;
77297         LDKThirtyTwoBytes val_ref;
77298         CHECK((*env)->GetArrayLength(env, val) == 32);
77299         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
77300         ClaimedHTLC_set_channel_id(&this_ptr_conv, val_ref);
77301 }
77302
77303 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
77304         LDKClaimedHTLC this_ptr_conv;
77305         this_ptr_conv.inner = untag_ptr(this_ptr);
77306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77308         this_ptr_conv.is_owned = false;
77309         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
77310         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, ClaimedHTLC_get_user_channel_id(&this_ptr_conv).le_bytes);
77311         return ret_arr;
77312 }
77313
77314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
77315         LDKClaimedHTLC this_ptr_conv;
77316         this_ptr_conv.inner = untag_ptr(this_ptr);
77317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77319         this_ptr_conv.is_owned = false;
77320         LDKU128 val_ref;
77321         CHECK((*env)->GetArrayLength(env, val) == 16);
77322         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
77323         ClaimedHTLC_set_user_channel_id(&this_ptr_conv, val_ref);
77324 }
77325
77326 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
77327         LDKClaimedHTLC this_ptr_conv;
77328         this_ptr_conv.inner = untag_ptr(this_ptr);
77329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77331         this_ptr_conv.is_owned = false;
77332         int32_t ret_conv = ClaimedHTLC_get_cltv_expiry(&this_ptr_conv);
77333         return ret_conv;
77334 }
77335
77336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
77337         LDKClaimedHTLC this_ptr_conv;
77338         this_ptr_conv.inner = untag_ptr(this_ptr);
77339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77341         this_ptr_conv.is_owned = false;
77342         ClaimedHTLC_set_cltv_expiry(&this_ptr_conv, val);
77343 }
77344
77345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
77346         LDKClaimedHTLC this_ptr_conv;
77347         this_ptr_conv.inner = untag_ptr(this_ptr);
77348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77350         this_ptr_conv.is_owned = false;
77351         int64_t ret_conv = ClaimedHTLC_get_value_msat(&this_ptr_conv);
77352         return ret_conv;
77353 }
77354
77355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
77356         LDKClaimedHTLC this_ptr_conv;
77357         this_ptr_conv.inner = untag_ptr(this_ptr);
77358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77360         this_ptr_conv.is_owned = false;
77361         ClaimedHTLC_set_value_msat(&this_ptr_conv, val);
77362 }
77363
77364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1counterparty_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
77365         LDKClaimedHTLC this_ptr_conv;
77366         this_ptr_conv.inner = untag_ptr(this_ptr);
77367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77369         this_ptr_conv.is_owned = false;
77370         int64_t ret_conv = ClaimedHTLC_get_counterparty_skimmed_fee_msat(&this_ptr_conv);
77371         return ret_conv;
77372 }
77373
77374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1counterparty_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
77375         LDKClaimedHTLC this_ptr_conv;
77376         this_ptr_conv.inner = untag_ptr(this_ptr);
77377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77379         this_ptr_conv.is_owned = false;
77380         ClaimedHTLC_set_counterparty_skimmed_fee_msat(&this_ptr_conv, val);
77381 }
77382
77383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray user_channel_id_arg, int32_t cltv_expiry_arg, int64_t value_msat_arg, int64_t counterparty_skimmed_fee_msat_arg) {
77384         LDKThirtyTwoBytes channel_id_arg_ref;
77385         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
77386         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
77387         LDKU128 user_channel_id_arg_ref;
77388         CHECK((*env)->GetArrayLength(env, user_channel_id_arg) == 16);
77389         (*env)->GetByteArrayRegion(env, user_channel_id_arg, 0, 16, user_channel_id_arg_ref.le_bytes);
77390         LDKClaimedHTLC ret_var = ClaimedHTLC_new(channel_id_arg_ref, user_channel_id_arg_ref, cltv_expiry_arg, value_msat_arg, counterparty_skimmed_fee_msat_arg);
77391         int64_t ret_ref = 0;
77392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77394         return ret_ref;
77395 }
77396
77397 static inline uint64_t ClaimedHTLC_clone_ptr(LDKClaimedHTLC *NONNULL_PTR arg) {
77398         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(arg);
77399         int64_t ret_ref = 0;
77400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77402         return ret_ref;
77403 }
77404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77405         LDKClaimedHTLC arg_conv;
77406         arg_conv.inner = untag_ptr(arg);
77407         arg_conv.is_owned = ptr_is_owned(arg);
77408         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77409         arg_conv.is_owned = false;
77410         int64_t ret_conv = ClaimedHTLC_clone_ptr(&arg_conv);
77411         return ret_conv;
77412 }
77413
77414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77415         LDKClaimedHTLC orig_conv;
77416         orig_conv.inner = untag_ptr(orig);
77417         orig_conv.is_owned = ptr_is_owned(orig);
77418         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77419         orig_conv.is_owned = false;
77420         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(&orig_conv);
77421         int64_t ret_ref = 0;
77422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77424         return ret_ref;
77425 }
77426
77427 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
77428         LDKClaimedHTLC a_conv;
77429         a_conv.inner = untag_ptr(a);
77430         a_conv.is_owned = ptr_is_owned(a);
77431         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77432         a_conv.is_owned = false;
77433         LDKClaimedHTLC b_conv;
77434         b_conv.inner = untag_ptr(b);
77435         b_conv.is_owned = ptr_is_owned(b);
77436         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
77437         b_conv.is_owned = false;
77438         jboolean ret_conv = ClaimedHTLC_eq(&a_conv, &b_conv);
77439         return ret_conv;
77440 }
77441
77442 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
77443         LDKClaimedHTLC obj_conv;
77444         obj_conv.inner = untag_ptr(obj);
77445         obj_conv.is_owned = ptr_is_owned(obj);
77446         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77447         obj_conv.is_owned = false;
77448         LDKCVec_u8Z ret_var = ClaimedHTLC_write(&obj_conv);
77449         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77450         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77451         CVec_u8Z_free(ret_var);
77452         return ret_arr;
77453 }
77454
77455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77456         LDKu8slice ser_ref;
77457         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77458         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77459         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
77460         *ret_conv = ClaimedHTLC_read(ser_ref);
77461         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77462         return tag_ptr(ret_conv, true);
77463 }
77464
77465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PathFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
77466         if (!ptr_is_owned(this_ptr)) return;
77467         void* this_ptr_ptr = untag_ptr(this_ptr);
77468         CHECK_ACCESS(this_ptr_ptr);
77469         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
77470         FREE(untag_ptr(this_ptr));
77471         PathFailure_free(this_ptr_conv);
77472 }
77473
77474 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
77475         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
77476         *ret_copy = PathFailure_clone(arg);
77477         int64_t ret_ref = tag_ptr(ret_copy, true);
77478         return ret_ref;
77479 }
77480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77481         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
77482         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
77483         return ret_conv;
77484 }
77485
77486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77487         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
77488         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
77489         *ret_copy = PathFailure_clone(orig_conv);
77490         int64_t ret_ref = tag_ptr(ret_copy, true);
77491         return ret_ref;
77492 }
77493
77494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1initial_1send(JNIEnv *env, jclass clz, int64_t err) {
77495         void* err_ptr = untag_ptr(err);
77496         CHECK_ACCESS(err_ptr);
77497         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
77498         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
77499         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
77500         *ret_copy = PathFailure_initial_send(err_conv);
77501         int64_t ret_ref = tag_ptr(ret_copy, true);
77502         return ret_ref;
77503 }
77504
77505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1on_1path(JNIEnv *env, jclass clz, int64_t network_update) {
77506         void* network_update_ptr = untag_ptr(network_update);
77507         CHECK_ACCESS(network_update_ptr);
77508         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
77509         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
77510         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
77511         *ret_copy = PathFailure_on_path(network_update_conv);
77512         int64_t ret_ref = tag_ptr(ret_copy, true);
77513         return ret_ref;
77514 }
77515
77516 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PathFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
77517         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
77518         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
77519         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
77520         return ret_conv;
77521 }
77522
77523 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PathFailure_1write(JNIEnv *env, jclass clz, int64_t obj) {
77524         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
77525         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
77526         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77527         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77528         CVec_u8Z_free(ret_var);
77529         return ret_arr;
77530 }
77531
77532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77533         LDKu8slice ser_ref;
77534         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77535         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77536         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
77537         *ret_conv = PathFailure_read(ser_ref);
77538         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77539         return tag_ptr(ret_conv, true);
77540 }
77541
77542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
77543         if (!ptr_is_owned(this_ptr)) return;
77544         void* this_ptr_ptr = untag_ptr(this_ptr);
77545         CHECK_ACCESS(this_ptr_ptr);
77546         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
77547         FREE(untag_ptr(this_ptr));
77548         ClosureReason_free(this_ptr_conv);
77549 }
77550
77551 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
77552         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77553         *ret_copy = ClosureReason_clone(arg);
77554         int64_t ret_ref = tag_ptr(ret_copy, true);
77555         return ret_ref;
77556 }
77557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77558         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
77559         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
77560         return ret_conv;
77561 }
77562
77563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77564         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
77565         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77566         *ret_copy = ClosureReason_clone(orig_conv);
77567         int64_t ret_ref = tag_ptr(ret_copy, true);
77568         return ret_ref;
77569 }
77570
77571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, int64_t peer_msg) {
77572         LDKUntrustedString peer_msg_conv;
77573         peer_msg_conv.inner = untag_ptr(peer_msg);
77574         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
77575         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
77576         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
77577         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77578         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
77579         int64_t ret_ref = tag_ptr(ret_copy, true);
77580         return ret_ref;
77581 }
77582
77583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
77584         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77585         *ret_copy = ClosureReason_holder_force_closed();
77586         int64_t ret_ref = tag_ptr(ret_copy, true);
77587         return ret_ref;
77588 }
77589
77590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
77591         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77592         *ret_copy = ClosureReason_cooperative_closure();
77593         int64_t ret_ref = tag_ptr(ret_copy, true);
77594         return ret_ref;
77595 }
77596
77597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
77598         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77599         *ret_copy = ClosureReason_commitment_tx_confirmed();
77600         int64_t ret_ref = tag_ptr(ret_copy, true);
77601         return ret_ref;
77602 }
77603
77604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
77605         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77606         *ret_copy = ClosureReason_funding_timed_out();
77607         int64_t ret_ref = tag_ptr(ret_copy, true);
77608         return ret_ref;
77609 }
77610
77611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
77612         LDKStr err_conv = java_to_owned_str(env, err);
77613         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77614         *ret_copy = ClosureReason_processing_error(err_conv);
77615         int64_t ret_ref = tag_ptr(ret_copy, true);
77616         return ret_ref;
77617 }
77618
77619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
77620         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77621         *ret_copy = ClosureReason_disconnected_peer();
77622         int64_t ret_ref = tag_ptr(ret_copy, true);
77623         return ret_ref;
77624 }
77625
77626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
77627         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77628         *ret_copy = ClosureReason_outdated_channel_manager();
77629         int64_t ret_ref = tag_ptr(ret_copy, true);
77630         return ret_ref;
77631 }
77632
77633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1coop_1closed_1unfunded_1channel(JNIEnv *env, jclass clz) {
77634         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77635         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
77636         int64_t ret_ref = tag_ptr(ret_copy, true);
77637         return ret_ref;
77638 }
77639
77640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1batch_1closure(JNIEnv *env, jclass clz) {
77641         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
77642         *ret_copy = ClosureReason_funding_batch_closure();
77643         int64_t ret_ref = tag_ptr(ret_copy, true);
77644         return ret_ref;
77645 }
77646
77647 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosureReason_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
77648         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
77649         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
77650         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
77651         return ret_conv;
77652 }
77653
77654 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
77655         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
77656         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
77657         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77658         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77659         CVec_u8Z_free(ret_var);
77660         return ret_arr;
77661 }
77662
77663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77664         LDKu8slice ser_ref;
77665         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77666         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77667         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
77668         *ret_conv = ClosureReason_read(ser_ref);
77669         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77670         return tag_ptr(ret_conv, true);
77671 }
77672
77673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
77674         if (!ptr_is_owned(this_ptr)) return;
77675         void* this_ptr_ptr = untag_ptr(this_ptr);
77676         CHECK_ACCESS(this_ptr_ptr);
77677         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
77678         FREE(untag_ptr(this_ptr));
77679         HTLCDestination_free(this_ptr_conv);
77680 }
77681
77682 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
77683         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
77684         *ret_copy = HTLCDestination_clone(arg);
77685         int64_t ret_ref = tag_ptr(ret_copy, true);
77686         return ret_ref;
77687 }
77688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77689         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
77690         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
77691         return ret_conv;
77692 }
77693
77694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77695         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
77696         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
77697         *ret_copy = HTLCDestination_clone(orig_conv);
77698         int64_t ret_ref = tag_ptr(ret_copy, true);
77699         return ret_ref;
77700 }
77701
77702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1next_1hop_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int8_tArray channel_id) {
77703         LDKPublicKey node_id_ref;
77704         CHECK((*env)->GetArrayLength(env, node_id) == 33);
77705         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
77706         LDKThirtyTwoBytes channel_id_ref;
77707         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
77708         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
77709         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
77710         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
77711         int64_t ret_ref = tag_ptr(ret_copy, true);
77712         return ret_ref;
77713 }
77714
77715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1unknown_1next_1hop(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
77716         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
77717         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
77718         int64_t ret_ref = tag_ptr(ret_copy, true);
77719         return ret_ref;
77720 }
77721
77722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1invalid_1forward(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
77723         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
77724         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
77725         int64_t ret_ref = tag_ptr(ret_copy, true);
77726         return ret_ref;
77727 }
77728
77729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1failed_1payment(JNIEnv *env, jclass clz, int8_tArray payment_hash) {
77730         LDKThirtyTwoBytes payment_hash_ref;
77731         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
77732         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
77733         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
77734         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
77735         int64_t ret_ref = tag_ptr(ret_copy, true);
77736         return ret_ref;
77737 }
77738
77739 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
77740         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
77741         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
77742         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
77743         return ret_conv;
77744 }
77745
77746 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1write(JNIEnv *env, jclass clz, int64_t obj) {
77747         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
77748         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
77749         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77750         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77751         CVec_u8Z_free(ret_var);
77752         return ret_arr;
77753 }
77754
77755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77756         LDKu8slice ser_ref;
77757         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77758         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77759         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
77760         *ret_conv = HTLCDestination_read(ser_ref);
77761         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77762         return tag_ptr(ret_conv, true);
77763 }
77764
77765 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77766         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
77767         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_clone(orig_conv));
77768         return ret_conv;
77769 }
77770
77771 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1recipient_1rejected(JNIEnv *env, jclass clz) {
77772         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_recipient_rejected());
77773         return ret_conv;
77774 }
77775
77776 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1user_1abandoned(JNIEnv *env, jclass clz) {
77777         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_user_abandoned());
77778         return ret_conv;
77779 }
77780
77781 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1retries_1exhausted(JNIEnv *env, jclass clz) {
77782         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_retries_exhausted());
77783         return ret_conv;
77784 }
77785
77786 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1payment_1expired(JNIEnv *env, jclass clz) {
77787         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_payment_expired());
77788         return ret_conv;
77789 }
77790
77791 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1route_1not_1found(JNIEnv *env, jclass clz) {
77792         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_route_not_found());
77793         return ret_conv;
77794 }
77795
77796 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1unexpected_1error(JNIEnv *env, jclass clz) {
77797         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_unexpected_error());
77798         return ret_conv;
77799 }
77800
77801 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
77802         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
77803         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
77804         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
77805         return ret_conv;
77806 }
77807
77808 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
77809         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
77810         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
77811         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77812         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77813         CVec_u8Z_free(ret_var);
77814         return ret_arr;
77815 }
77816
77817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77818         LDKu8slice ser_ref;
77819         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77820         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77821         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
77822         *ret_conv = PaymentFailureReason_read(ser_ref);
77823         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77824         return tag_ptr(ret_conv, true);
77825 }
77826
77827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
77828         if (!ptr_is_owned(this_ptr)) return;
77829         void* this_ptr_ptr = untag_ptr(this_ptr);
77830         CHECK_ACCESS(this_ptr_ptr);
77831         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
77832         FREE(untag_ptr(this_ptr));
77833         Event_free(this_ptr_conv);
77834 }
77835
77836 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
77837         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
77838         *ret_copy = Event_clone(arg);
77839         int64_t ret_ref = tag_ptr(ret_copy, true);
77840         return ret_ref;
77841 }
77842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77843         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
77844         int64_t ret_conv = Event_clone_ptr(arg_conv);
77845         return ret_conv;
77846 }
77847
77848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77849         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
77850         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
77851         *ret_copy = Event_clone(orig_conv);
77852         int64_t ret_ref = tag_ptr(ret_copy, true);
77853         return ret_ref;
77854 }
77855
77856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1funding_1generation_1ready(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t channel_value_satoshis, int8_tArray output_script, int8_tArray user_channel_id) {
77857         LDKThirtyTwoBytes temporary_channel_id_ref;
77858         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
77859         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
77860         LDKPublicKey counterparty_node_id_ref;
77861         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
77862         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
77863         LDKCVec_u8Z output_script_ref;
77864         output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
77865         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
77866         (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
77867         LDKU128 user_channel_id_ref;
77868         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
77869         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
77870         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
77871         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
77872         int64_t ret_ref = tag_ptr(ret_copy, true);
77873         return ret_ref;
77874 }
77875
77876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1claimable(JNIEnv *env, jclass clz, int8_tArray receiver_node_id, int8_tArray payment_hash, int64_t onion_fields, int64_t amount_msat, int64_t counterparty_skimmed_fee_msat, int64_t purpose, int64_t via_channel_id, int64_t via_user_channel_id, int64_t claim_deadline) {
77877         LDKPublicKey receiver_node_id_ref;
77878         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
77879         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
77880         LDKThirtyTwoBytes payment_hash_ref;
77881         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
77882         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
77883         LDKRecipientOnionFields onion_fields_conv;
77884         onion_fields_conv.inner = untag_ptr(onion_fields);
77885         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
77886         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
77887         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
77888         void* purpose_ptr = untag_ptr(purpose);
77889         CHECK_ACCESS(purpose_ptr);
77890         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
77891         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
77892         void* via_channel_id_ptr = untag_ptr(via_channel_id);
77893         CHECK_ACCESS(via_channel_id_ptr);
77894         LDKCOption_ThirtyTwoBytesZ via_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(via_channel_id_ptr);
77895         via_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(via_channel_id));
77896         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
77897         CHECK_ACCESS(via_user_channel_id_ptr);
77898         LDKCOption_U128Z via_user_channel_id_conv = *(LDKCOption_U128Z*)(via_user_channel_id_ptr);
77899         via_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(via_user_channel_id));
77900         void* claim_deadline_ptr = untag_ptr(claim_deadline);
77901         CHECK_ACCESS(claim_deadline_ptr);
77902         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
77903         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
77904         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
77905         *ret_copy = Event_payment_claimable(receiver_node_id_ref, payment_hash_ref, onion_fields_conv, amount_msat, counterparty_skimmed_fee_msat, purpose_conv, via_channel_id_conv, via_user_channel_id_conv, claim_deadline_conv);
77906         int64_t ret_ref = tag_ptr(ret_copy, true);
77907         return ret_ref;
77908 }
77909
77910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1claimed(JNIEnv *env, jclass clz, int8_tArray receiver_node_id, int8_tArray payment_hash, int64_t amount_msat, int64_t purpose, int64_tArray htlcs, int64_t sender_intended_total_msat) {
77911         LDKPublicKey receiver_node_id_ref;
77912         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
77913         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
77914         LDKThirtyTwoBytes payment_hash_ref;
77915         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
77916         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
77917         void* purpose_ptr = untag_ptr(purpose);
77918         CHECK_ACCESS(purpose_ptr);
77919         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
77920         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
77921         LDKCVec_ClaimedHTLCZ htlcs_constr;
77922         htlcs_constr.datalen = (*env)->GetArrayLength(env, htlcs);
77923         if (htlcs_constr.datalen > 0)
77924                 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
77925         else
77926                 htlcs_constr.data = NULL;
77927         int64_t* htlcs_vals = (*env)->GetLongArrayElements (env, htlcs, NULL);
77928         for (size_t n = 0; n < htlcs_constr.datalen; n++) {
77929                 int64_t htlcs_conv_13 = htlcs_vals[n];
77930                 LDKClaimedHTLC htlcs_conv_13_conv;
77931                 htlcs_conv_13_conv.inner = untag_ptr(htlcs_conv_13);
77932                 htlcs_conv_13_conv.is_owned = ptr_is_owned(htlcs_conv_13);
77933                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_conv);
77934                 htlcs_conv_13_conv = ClaimedHTLC_clone(&htlcs_conv_13_conv);
77935                 htlcs_constr.data[n] = htlcs_conv_13_conv;
77936         }
77937         (*env)->ReleaseLongArrayElements(env, htlcs, htlcs_vals, 0);
77938         void* sender_intended_total_msat_ptr = untag_ptr(sender_intended_total_msat);
77939         CHECK_ACCESS(sender_intended_total_msat_ptr);
77940         LDKCOption_u64Z sender_intended_total_msat_conv = *(LDKCOption_u64Z*)(sender_intended_total_msat_ptr);
77941         sender_intended_total_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(sender_intended_total_msat));
77942         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
77943         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, htlcs_constr, sender_intended_total_msat_conv);
77944         int64_t ret_ref = tag_ptr(ret_copy, true);
77945         return ret_ref;
77946 }
77947
77948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1connection_1needed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_tArray addresses) {
77949         LDKPublicKey node_id_ref;
77950         CHECK((*env)->GetArrayLength(env, node_id) == 33);
77951         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
77952         LDKCVec_SocketAddressZ addresses_constr;
77953         addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
77954         if (addresses_constr.datalen > 0)
77955                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
77956         else
77957                 addresses_constr.data = NULL;
77958         int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
77959         for (size_t p = 0; p < addresses_constr.datalen; p++) {
77960                 int64_t addresses_conv_15 = addresses_vals[p];
77961                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
77962                 CHECK_ACCESS(addresses_conv_15_ptr);
77963                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
77964                 addresses_constr.data[p] = addresses_conv_15_conv;
77965         }
77966         (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
77967         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
77968         *ret_copy = Event_connection_needed(node_id_ref, addresses_constr);
77969         int64_t ret_ref = tag_ptr(ret_copy, true);
77970         return ret_ref;
77971 }
77972
77973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1invoice_1request_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id) {
77974         LDKThirtyTwoBytes payment_id_ref;
77975         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
77976         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
77977         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
77978         *ret_copy = Event_invoice_request_failed(payment_id_ref);
77979         int64_t ret_ref = tag_ptr(ret_copy, true);
77980         return ret_ref;
77981 }
77982
77983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent(JNIEnv *env, jclass clz, int64_t payment_id, int8_tArray payment_preimage, int8_tArray payment_hash, int64_t fee_paid_msat) {
77984         void* payment_id_ptr = untag_ptr(payment_id);
77985         CHECK_ACCESS(payment_id_ptr);
77986         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
77987         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
77988         LDKThirtyTwoBytes payment_preimage_ref;
77989         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
77990         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
77991         LDKThirtyTwoBytes payment_hash_ref;
77992         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
77993         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
77994         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
77995         CHECK_ACCESS(fee_paid_msat_ptr);
77996         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
77997         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
77998         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
77999         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
78000         int64_t ret_ref = tag_ptr(ret_copy, true);
78001         return ret_ref;
78002 }
78003
78004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_t reason) {
78005         LDKThirtyTwoBytes payment_id_ref;
78006         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
78007         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
78008         LDKThirtyTwoBytes payment_hash_ref;
78009         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
78010         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
78011         void* reason_ptr = untag_ptr(reason);
78012         CHECK_ACCESS(reason_ptr);
78013         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
78014         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
78015         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78016         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
78017         int64_t ret_ref = tag_ptr(ret_copy, true);
78018         return ret_ref;
78019 }
78020
78021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1successful(JNIEnv *env, jclass clz, int8_tArray payment_id, int64_t payment_hash, int64_t path) {
78022         LDKThirtyTwoBytes payment_id_ref;
78023         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
78024         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
78025         void* payment_hash_ptr = untag_ptr(payment_hash);
78026         CHECK_ACCESS(payment_hash_ptr);
78027         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
78028         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
78029         LDKPath path_conv;
78030         path_conv.inner = untag_ptr(path);
78031         path_conv.is_owned = ptr_is_owned(path);
78032         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
78033         path_conv = Path_clone(&path_conv);
78034         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78035         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
78036         int64_t ret_ref = tag_ptr(ret_copy, true);
78037         return ret_ref;
78038 }
78039
78040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int64_t payment_id, int8_tArray payment_hash, jboolean payment_failed_permanently, int64_t failure, int64_t path, int64_t short_channel_id) {
78041         void* payment_id_ptr = untag_ptr(payment_id);
78042         CHECK_ACCESS(payment_id_ptr);
78043         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
78044         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
78045         LDKThirtyTwoBytes payment_hash_ref;
78046         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
78047         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
78048         void* failure_ptr = untag_ptr(failure);
78049         CHECK_ACCESS(failure_ptr);
78050         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
78051         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
78052         LDKPath path_conv;
78053         path_conv.inner = untag_ptr(path);
78054         path_conv.is_owned = ptr_is_owned(path);
78055         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
78056         path_conv = Path_clone(&path_conv);
78057         void* short_channel_id_ptr = untag_ptr(short_channel_id);
78058         CHECK_ACCESS(short_channel_id_ptr);
78059         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
78060         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
78061         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78062         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
78063         int64_t ret_ref = tag_ptr(ret_copy, true);
78064         return ret_ref;
78065 }
78066
78067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1probe_1successful(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_t path) {
78068         LDKThirtyTwoBytes payment_id_ref;
78069         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
78070         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
78071         LDKThirtyTwoBytes payment_hash_ref;
78072         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
78073         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
78074         LDKPath path_conv;
78075         path_conv.inner = untag_ptr(path);
78076         path_conv.is_owned = ptr_is_owned(path);
78077         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
78078         path_conv = Path_clone(&path_conv);
78079         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78080         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
78081         int64_t ret_ref = tag_ptr(ret_copy, true);
78082         return ret_ref;
78083 }
78084
78085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1probe_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_t path, int64_t short_channel_id) {
78086         LDKThirtyTwoBytes payment_id_ref;
78087         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
78088         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
78089         LDKThirtyTwoBytes payment_hash_ref;
78090         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
78091         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
78092         LDKPath path_conv;
78093         path_conv.inner = untag_ptr(path);
78094         path_conv.is_owned = ptr_is_owned(path);
78095         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
78096         path_conv = Path_clone(&path_conv);
78097         void* short_channel_id_ptr = untag_ptr(short_channel_id);
78098         CHECK_ACCESS(short_channel_id_ptr);
78099         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
78100         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
78101         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78102         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
78103         int64_t ret_ref = tag_ptr(ret_copy, true);
78104         return ret_ref;
78105 }
78106
78107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
78108         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78109         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
78110         int64_t ret_ref = tag_ptr(ret_copy, true);
78111         return ret_ref;
78112 }
78113
78114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1htlcintercepted(JNIEnv *env, jclass clz, int8_tArray intercept_id, int64_t requested_next_hop_scid, int8_tArray payment_hash, int64_t inbound_amount_msat, int64_t expected_outbound_amount_msat) {
78115         LDKThirtyTwoBytes intercept_id_ref;
78116         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
78117         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
78118         LDKThirtyTwoBytes payment_hash_ref;
78119         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
78120         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
78121         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78122         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
78123         int64_t ret_ref = tag_ptr(ret_copy, true);
78124         return ret_ref;
78125 }
78126
78127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs, int64_t channel_id) {
78128         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
78129         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
78130         if (outputs_constr.datalen > 0)
78131                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
78132         else
78133                 outputs_constr.data = NULL;
78134         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
78135         for (size_t b = 0; b < outputs_constr.datalen; b++) {
78136                 int64_t outputs_conv_27 = outputs_vals[b];
78137                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
78138                 CHECK_ACCESS(outputs_conv_27_ptr);
78139                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
78140                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
78141                 outputs_constr.data[b] = outputs_conv_27_conv;
78142         }
78143         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
78144         void* channel_id_ptr = untag_ptr(channel_id);
78145         CHECK_ACCESS(channel_id_ptr);
78146         LDKCOption_ThirtyTwoBytesZ channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(channel_id_ptr);
78147         channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(channel_id));
78148         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78149         *ret_copy = Event_spendable_outputs(outputs_constr, channel_id_conv);
78150         int64_t ret_ref = tag_ptr(ret_copy, true);
78151         return ret_ref;
78152 }
78153
78154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1forwarded(JNIEnv *env, jclass clz, int64_t prev_channel_id, int64_t next_channel_id, int64_t fee_earned_msat, jboolean claim_from_onchain_tx, int64_t outbound_amount_forwarded_msat) {
78155         void* prev_channel_id_ptr = untag_ptr(prev_channel_id);
78156         CHECK_ACCESS(prev_channel_id_ptr);
78157         LDKCOption_ThirtyTwoBytesZ prev_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(prev_channel_id_ptr);
78158         prev_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(prev_channel_id));
78159         void* next_channel_id_ptr = untag_ptr(next_channel_id);
78160         CHECK_ACCESS(next_channel_id_ptr);
78161         LDKCOption_ThirtyTwoBytesZ next_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_channel_id_ptr);
78162         next_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_channel_id));
78163         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
78164         CHECK_ACCESS(fee_earned_msat_ptr);
78165         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
78166         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
78167         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
78168         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
78169         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
78170         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
78171         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78172         *ret_copy = Event_payment_forwarded(prev_channel_id_conv, next_channel_id_conv, fee_earned_msat_conv, claim_from_onchain_tx, outbound_amount_forwarded_msat_conv);
78173         int64_t ret_ref = tag_ptr(ret_copy, true);
78174         return ret_ref;
78175 }
78176
78177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1pending(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray user_channel_id, int64_t former_temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_txo) {
78178         LDKThirtyTwoBytes channel_id_ref;
78179         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
78180         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
78181         LDKU128 user_channel_id_ref;
78182         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
78183         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
78184         void* former_temporary_channel_id_ptr = untag_ptr(former_temporary_channel_id);
78185         CHECK_ACCESS(former_temporary_channel_id_ptr);
78186         LDKCOption_ThirtyTwoBytesZ former_temporary_channel_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(former_temporary_channel_id_ptr);
78187         former_temporary_channel_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(former_temporary_channel_id));
78188         LDKPublicKey counterparty_node_id_ref;
78189         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
78190         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
78191         LDKOutPoint funding_txo_conv;
78192         funding_txo_conv.inner = untag_ptr(funding_txo);
78193         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
78194         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
78195         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
78196         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78197         *ret_copy = Event_channel_pending(channel_id_ref, user_channel_id_ref, former_temporary_channel_id_conv, counterparty_node_id_ref, funding_txo_conv);
78198         int64_t ret_ref = tag_ptr(ret_copy, true);
78199         return ret_ref;
78200 }
78201
78202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray user_channel_id, int8_tArray counterparty_node_id, int64_t channel_type) {
78203         LDKThirtyTwoBytes channel_id_ref;
78204         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
78205         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
78206         LDKU128 user_channel_id_ref;
78207         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
78208         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
78209         LDKPublicKey counterparty_node_id_ref;
78210         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
78211         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
78212         LDKChannelTypeFeatures channel_type_conv;
78213         channel_type_conv.inner = untag_ptr(channel_type);
78214         channel_type_conv.is_owned = ptr_is_owned(channel_type);
78215         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
78216         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
78217         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78218         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
78219         int64_t ret_ref = tag_ptr(ret_copy, true);
78220         return ret_ref;
78221 }
78222
78223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray user_channel_id, int64_t reason, int8_tArray counterparty_node_id, int64_t channel_capacity_sats, int64_t channel_funding_txo) {
78224         LDKThirtyTwoBytes channel_id_ref;
78225         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
78226         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
78227         LDKU128 user_channel_id_ref;
78228         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
78229         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
78230         void* reason_ptr = untag_ptr(reason);
78231         CHECK_ACCESS(reason_ptr);
78232         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
78233         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
78234         LDKPublicKey counterparty_node_id_ref;
78235         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
78236         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
78237         void* channel_capacity_sats_ptr = untag_ptr(channel_capacity_sats);
78238         CHECK_ACCESS(channel_capacity_sats_ptr);
78239         LDKCOption_u64Z channel_capacity_sats_conv = *(LDKCOption_u64Z*)(channel_capacity_sats_ptr);
78240         channel_capacity_sats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(channel_capacity_sats));
78241         LDKOutPoint channel_funding_txo_conv;
78242         channel_funding_txo_conv.inner = untag_ptr(channel_funding_txo);
78243         channel_funding_txo_conv.is_owned = ptr_is_owned(channel_funding_txo);
78244         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_conv);
78245         channel_funding_txo_conv = OutPoint_clone(&channel_funding_txo_conv);
78246         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78247         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv, counterparty_node_id_ref, channel_capacity_sats_conv, channel_funding_txo_conv);
78248         int64_t ret_ref = tag_ptr(ret_copy, true);
78249         return ret_ref;
78250 }
78251
78252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
78253         LDKThirtyTwoBytes channel_id_ref;
78254         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
78255         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
78256         LDKTransaction transaction_ref;
78257         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
78258         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
78259         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
78260         transaction_ref.data_is_owned = true;
78261         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78262         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
78263         int64_t ret_ref = tag_ptr(ret_copy, true);
78264         return ret_ref;
78265 }
78266
78267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1open_1channel_1request(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat, int64_t channel_type) {
78268         LDKThirtyTwoBytes temporary_channel_id_ref;
78269         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
78270         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
78271         LDKPublicKey counterparty_node_id_ref;
78272         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
78273         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
78274         LDKChannelTypeFeatures channel_type_conv;
78275         channel_type_conv.inner = untag_ptr(channel_type);
78276         channel_type_conv.is_owned = ptr_is_owned(channel_type);
78277         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
78278         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
78279         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78280         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
78281         int64_t ret_ref = tag_ptr(ret_copy, true);
78282         return ret_ref;
78283 }
78284
78285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1htlchandling_1failed(JNIEnv *env, jclass clz, int8_tArray prev_channel_id, int64_t failed_next_destination) {
78286         LDKThirtyTwoBytes prev_channel_id_ref;
78287         CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
78288         (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
78289         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
78290         CHECK_ACCESS(failed_next_destination_ptr);
78291         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
78292         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
78293         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78294         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
78295         int64_t ret_ref = tag_ptr(ret_copy, true);
78296         return ret_ref;
78297 }
78298
78299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1bump_1transaction(JNIEnv *env, jclass clz, int64_t a) {
78300         void* a_ptr = untag_ptr(a);
78301         CHECK_ACCESS(a_ptr);
78302         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
78303         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
78304         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
78305         *ret_copy = Event_bump_transaction(a_conv);
78306         int64_t ret_ref = tag_ptr(ret_copy, true);
78307         return ret_ref;
78308 }
78309
78310 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Event_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
78311         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
78312         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
78313         jboolean ret_conv = Event_eq(a_conv, b_conv);
78314         return ret_conv;
78315 }
78316
78317 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
78318         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
78319         LDKCVec_u8Z ret_var = Event_write(obj_conv);
78320         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
78321         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
78322         CVec_u8Z_free(ret_var);
78323         return ret_arr;
78324 }
78325
78326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
78327         LDKu8slice ser_ref;
78328         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
78329         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
78330         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
78331         *ret_conv = Event_read(ser_ref);
78332         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
78333         return tag_ptr(ret_conv, true);
78334 }
78335
78336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
78337         if (!ptr_is_owned(this_ptr)) return;
78338         void* this_ptr_ptr = untag_ptr(this_ptr);
78339         CHECK_ACCESS(this_ptr_ptr);
78340         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
78341         FREE(untag_ptr(this_ptr));
78342         MessageSendEvent_free(this_ptr_conv);
78343 }
78344
78345 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
78346         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78347         *ret_copy = MessageSendEvent_clone(arg);
78348         int64_t ret_ref = tag_ptr(ret_copy, true);
78349         return ret_ref;
78350 }
78351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
78352         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
78353         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
78354         return ret_conv;
78355 }
78356
78357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
78358         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
78359         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78360         *ret_copy = MessageSendEvent_clone(orig_conv);
78361         int64_t ret_ref = tag_ptr(ret_copy, true);
78362         return ret_ref;
78363 }
78364
78365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78366         LDKPublicKey node_id_ref;
78367         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78368         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78369         LDKAcceptChannel msg_conv;
78370         msg_conv.inner = untag_ptr(msg);
78371         msg_conv.is_owned = ptr_is_owned(msg);
78372         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78373         msg_conv = AcceptChannel_clone(&msg_conv);
78374         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78375         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
78376         int64_t ret_ref = tag_ptr(ret_copy, true);
78377         return ret_ref;
78378 }
78379
78380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel_1v2(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78381         LDKPublicKey node_id_ref;
78382         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78383         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78384         LDKAcceptChannelV2 msg_conv;
78385         msg_conv.inner = untag_ptr(msg);
78386         msg_conv.is_owned = ptr_is_owned(msg);
78387         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78388         msg_conv = AcceptChannelV2_clone(&msg_conv);
78389         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78390         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
78391         int64_t ret_ref = tag_ptr(ret_copy, true);
78392         return ret_ref;
78393 }
78394
78395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78396         LDKPublicKey node_id_ref;
78397         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78398         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78399         LDKOpenChannel msg_conv;
78400         msg_conv.inner = untag_ptr(msg);
78401         msg_conv.is_owned = ptr_is_owned(msg);
78402         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78403         msg_conv = OpenChannel_clone(&msg_conv);
78404         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78405         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
78406         int64_t ret_ref = tag_ptr(ret_copy, true);
78407         return ret_ref;
78408 }
78409
78410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel_1v2(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78411         LDKPublicKey node_id_ref;
78412         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78413         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78414         LDKOpenChannelV2 msg_conv;
78415         msg_conv.inner = untag_ptr(msg);
78416         msg_conv.is_owned = ptr_is_owned(msg);
78417         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78418         msg_conv = OpenChannelV2_clone(&msg_conv);
78419         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78420         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
78421         int64_t ret_ref = tag_ptr(ret_copy, true);
78422         return ret_ref;
78423 }
78424
78425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78426         LDKPublicKey node_id_ref;
78427         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78428         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78429         LDKFundingCreated msg_conv;
78430         msg_conv.inner = untag_ptr(msg);
78431         msg_conv.is_owned = ptr_is_owned(msg);
78432         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78433         msg_conv = FundingCreated_clone(&msg_conv);
78434         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78435         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
78436         int64_t ret_ref = tag_ptr(ret_copy, true);
78437         return ret_ref;
78438 }
78439
78440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78441         LDKPublicKey node_id_ref;
78442         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78443         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78444         LDKFundingSigned msg_conv;
78445         msg_conv.inner = untag_ptr(msg);
78446         msg_conv.is_owned = ptr_is_owned(msg);
78447         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78448         msg_conv = FundingSigned_clone(&msg_conv);
78449         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78450         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
78451         int64_t ret_ref = tag_ptr(ret_copy, true);
78452         return ret_ref;
78453 }
78454
78455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1stfu(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78456         LDKPublicKey node_id_ref;
78457         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78458         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78459         LDKStfu msg_conv;
78460         msg_conv.inner = untag_ptr(msg);
78461         msg_conv.is_owned = ptr_is_owned(msg);
78462         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78463         msg_conv = Stfu_clone(&msg_conv);
78464         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78465         *ret_copy = MessageSendEvent_send_stfu(node_id_ref, msg_conv);
78466         int64_t ret_ref = tag_ptr(ret_copy, true);
78467         return ret_ref;
78468 }
78469
78470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1splice(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78471         LDKPublicKey node_id_ref;
78472         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78473         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78474         LDKSplice msg_conv;
78475         msg_conv.inner = untag_ptr(msg);
78476         msg_conv.is_owned = ptr_is_owned(msg);
78477         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78478         msg_conv = Splice_clone(&msg_conv);
78479         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78480         *ret_copy = MessageSendEvent_send_splice(node_id_ref, msg_conv);
78481         int64_t ret_ref = tag_ptr(ret_copy, true);
78482         return ret_ref;
78483 }
78484
78485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1splice_1ack(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78486         LDKPublicKey node_id_ref;
78487         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78488         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78489         LDKSpliceAck msg_conv;
78490         msg_conv.inner = untag_ptr(msg);
78491         msg_conv.is_owned = ptr_is_owned(msg);
78492         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78493         msg_conv = SpliceAck_clone(&msg_conv);
78494         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78495         *ret_copy = MessageSendEvent_send_splice_ack(node_id_ref, msg_conv);
78496         int64_t ret_ref = tag_ptr(ret_copy, true);
78497         return ret_ref;
78498 }
78499
78500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1splice_1locked(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78501         LDKPublicKey node_id_ref;
78502         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78503         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78504         LDKSpliceLocked msg_conv;
78505         msg_conv.inner = untag_ptr(msg);
78506         msg_conv.is_owned = ptr_is_owned(msg);
78507         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78508         msg_conv = SpliceLocked_clone(&msg_conv);
78509         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78510         *ret_copy = MessageSendEvent_send_splice_locked(node_id_ref, msg_conv);
78511         int64_t ret_ref = tag_ptr(ret_copy, true);
78512         return ret_ref;
78513 }
78514
78515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1add_1input(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78516         LDKPublicKey node_id_ref;
78517         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78518         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78519         LDKTxAddInput msg_conv;
78520         msg_conv.inner = untag_ptr(msg);
78521         msg_conv.is_owned = ptr_is_owned(msg);
78522         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78523         msg_conv = TxAddInput_clone(&msg_conv);
78524         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78525         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
78526         int64_t ret_ref = tag_ptr(ret_copy, true);
78527         return ret_ref;
78528 }
78529
78530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1add_1output(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78531         LDKPublicKey node_id_ref;
78532         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78533         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78534         LDKTxAddOutput msg_conv;
78535         msg_conv.inner = untag_ptr(msg);
78536         msg_conv.is_owned = ptr_is_owned(msg);
78537         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78538         msg_conv = TxAddOutput_clone(&msg_conv);
78539         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78540         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
78541         int64_t ret_ref = tag_ptr(ret_copy, true);
78542         return ret_ref;
78543 }
78544
78545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1remove_1input(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78546         LDKPublicKey node_id_ref;
78547         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78548         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78549         LDKTxRemoveInput msg_conv;
78550         msg_conv.inner = untag_ptr(msg);
78551         msg_conv.is_owned = ptr_is_owned(msg);
78552         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78553         msg_conv = TxRemoveInput_clone(&msg_conv);
78554         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78555         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
78556         int64_t ret_ref = tag_ptr(ret_copy, true);
78557         return ret_ref;
78558 }
78559
78560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1remove_1output(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78561         LDKPublicKey node_id_ref;
78562         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78563         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78564         LDKTxRemoveOutput msg_conv;
78565         msg_conv.inner = untag_ptr(msg);
78566         msg_conv.is_owned = ptr_is_owned(msg);
78567         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78568         msg_conv = TxRemoveOutput_clone(&msg_conv);
78569         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78570         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
78571         int64_t ret_ref = tag_ptr(ret_copy, true);
78572         return ret_ref;
78573 }
78574
78575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1complete(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78576         LDKPublicKey node_id_ref;
78577         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78578         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78579         LDKTxComplete msg_conv;
78580         msg_conv.inner = untag_ptr(msg);
78581         msg_conv.is_owned = ptr_is_owned(msg);
78582         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78583         msg_conv = TxComplete_clone(&msg_conv);
78584         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78585         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
78586         int64_t ret_ref = tag_ptr(ret_copy, true);
78587         return ret_ref;
78588 }
78589
78590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78591         LDKPublicKey node_id_ref;
78592         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78593         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78594         LDKTxSignatures msg_conv;
78595         msg_conv.inner = untag_ptr(msg);
78596         msg_conv.is_owned = ptr_is_owned(msg);
78597         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78598         msg_conv = TxSignatures_clone(&msg_conv);
78599         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78600         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
78601         int64_t ret_ref = tag_ptr(ret_copy, true);
78602         return ret_ref;
78603 }
78604
78605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1init_1rbf(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78606         LDKPublicKey node_id_ref;
78607         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78608         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78609         LDKTxInitRbf msg_conv;
78610         msg_conv.inner = untag_ptr(msg);
78611         msg_conv.is_owned = ptr_is_owned(msg);
78612         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78613         msg_conv = TxInitRbf_clone(&msg_conv);
78614         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78615         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
78616         int64_t ret_ref = tag_ptr(ret_copy, true);
78617         return ret_ref;
78618 }
78619
78620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1ack_1rbf(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78621         LDKPublicKey node_id_ref;
78622         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78623         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78624         LDKTxAckRbf msg_conv;
78625         msg_conv.inner = untag_ptr(msg);
78626         msg_conv.is_owned = ptr_is_owned(msg);
78627         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78628         msg_conv = TxAckRbf_clone(&msg_conv);
78629         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78630         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
78631         int64_t ret_ref = tag_ptr(ret_copy, true);
78632         return ret_ref;
78633 }
78634
78635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1abort(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78636         LDKPublicKey node_id_ref;
78637         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78638         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78639         LDKTxAbort msg_conv;
78640         msg_conv.inner = untag_ptr(msg);
78641         msg_conv.is_owned = ptr_is_owned(msg);
78642         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78643         msg_conv = TxAbort_clone(&msg_conv);
78644         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78645         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
78646         int64_t ret_ref = tag_ptr(ret_copy, true);
78647         return ret_ref;
78648 }
78649
78650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78651         LDKPublicKey node_id_ref;
78652         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78653         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78654         LDKChannelReady msg_conv;
78655         msg_conv.inner = untag_ptr(msg);
78656         msg_conv.is_owned = ptr_is_owned(msg);
78657         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78658         msg_conv = ChannelReady_clone(&msg_conv);
78659         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78660         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
78661         int64_t ret_ref = tag_ptr(ret_copy, true);
78662         return ret_ref;
78663 }
78664
78665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78666         LDKPublicKey node_id_ref;
78667         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78668         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78669         LDKAnnouncementSignatures msg_conv;
78670         msg_conv.inner = untag_ptr(msg);
78671         msg_conv.is_owned = ptr_is_owned(msg);
78672         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78673         msg_conv = AnnouncementSignatures_clone(&msg_conv);
78674         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78675         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
78676         int64_t ret_ref = tag_ptr(ret_copy, true);
78677         return ret_ref;
78678 }
78679
78680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
78681         LDKPublicKey node_id_ref;
78682         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78683         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78684         LDKCommitmentUpdate updates_conv;
78685         updates_conv.inner = untag_ptr(updates);
78686         updates_conv.is_owned = ptr_is_owned(updates);
78687         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
78688         updates_conv = CommitmentUpdate_clone(&updates_conv);
78689         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78690         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
78691         int64_t ret_ref = tag_ptr(ret_copy, true);
78692         return ret_ref;
78693 }
78694
78695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1revoke_1and_1ack(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78696         LDKPublicKey node_id_ref;
78697         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78698         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78699         LDKRevokeAndACK msg_conv;
78700         msg_conv.inner = untag_ptr(msg);
78701         msg_conv.is_owned = ptr_is_owned(msg);
78702         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78703         msg_conv = RevokeAndACK_clone(&msg_conv);
78704         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78705         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
78706         int64_t ret_ref = tag_ptr(ret_copy, true);
78707         return ret_ref;
78708 }
78709
78710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78711         LDKPublicKey node_id_ref;
78712         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78713         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78714         LDKClosingSigned msg_conv;
78715         msg_conv.inner = untag_ptr(msg);
78716         msg_conv.is_owned = ptr_is_owned(msg);
78717         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78718         msg_conv = ClosingSigned_clone(&msg_conv);
78719         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78720         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
78721         int64_t ret_ref = tag_ptr(ret_copy, true);
78722         return ret_ref;
78723 }
78724
78725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78726         LDKPublicKey node_id_ref;
78727         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78728         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78729         LDKShutdown msg_conv;
78730         msg_conv.inner = untag_ptr(msg);
78731         msg_conv.is_owned = ptr_is_owned(msg);
78732         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78733         msg_conv = Shutdown_clone(&msg_conv);
78734         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78735         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
78736         int64_t ret_ref = tag_ptr(ret_copy, true);
78737         return ret_ref;
78738 }
78739
78740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78741         LDKPublicKey node_id_ref;
78742         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78743         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78744         LDKChannelReestablish msg_conv;
78745         msg_conv.inner = untag_ptr(msg);
78746         msg_conv.is_owned = ptr_is_owned(msg);
78747         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78748         msg_conv = ChannelReestablish_clone(&msg_conv);
78749         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78750         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
78751         int64_t ret_ref = tag_ptr(ret_copy, true);
78752         return ret_ref;
78753 }
78754
78755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1announcement(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg, int64_t update_msg) {
78756         LDKPublicKey node_id_ref;
78757         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78758         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78759         LDKChannelAnnouncement msg_conv;
78760         msg_conv.inner = untag_ptr(msg);
78761         msg_conv.is_owned = ptr_is_owned(msg);
78762         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78763         msg_conv = ChannelAnnouncement_clone(&msg_conv);
78764         LDKChannelUpdate update_msg_conv;
78765         update_msg_conv.inner = untag_ptr(update_msg);
78766         update_msg_conv.is_owned = ptr_is_owned(update_msg);
78767         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
78768         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
78769         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78770         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
78771         int64_t ret_ref = tag_ptr(ret_copy, true);
78772         return ret_ref;
78773 }
78774
78775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
78776         LDKChannelAnnouncement msg_conv;
78777         msg_conv.inner = untag_ptr(msg);
78778         msg_conv.is_owned = ptr_is_owned(msg);
78779         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78780         msg_conv = ChannelAnnouncement_clone(&msg_conv);
78781         LDKChannelUpdate update_msg_conv;
78782         update_msg_conv.inner = untag_ptr(update_msg);
78783         update_msg_conv.is_owned = ptr_is_owned(update_msg);
78784         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
78785         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
78786         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78787         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
78788         int64_t ret_ref = tag_ptr(ret_copy, true);
78789         return ret_ref;
78790 }
78791
78792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
78793         LDKChannelUpdate msg_conv;
78794         msg_conv.inner = untag_ptr(msg);
78795         msg_conv.is_owned = ptr_is_owned(msg);
78796         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78797         msg_conv = ChannelUpdate_clone(&msg_conv);
78798         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78799         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
78800         int64_t ret_ref = tag_ptr(ret_copy, true);
78801         return ret_ref;
78802 }
78803
78804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
78805         LDKNodeAnnouncement msg_conv;
78806         msg_conv.inner = untag_ptr(msg);
78807         msg_conv.is_owned = ptr_is_owned(msg);
78808         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78809         msg_conv = NodeAnnouncement_clone(&msg_conv);
78810         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78811         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
78812         int64_t ret_ref = tag_ptr(ret_copy, true);
78813         return ret_ref;
78814 }
78815
78816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78817         LDKPublicKey node_id_ref;
78818         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78819         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78820         LDKChannelUpdate msg_conv;
78821         msg_conv.inner = untag_ptr(msg);
78822         msg_conv.is_owned = ptr_is_owned(msg);
78823         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78824         msg_conv = ChannelUpdate_clone(&msg_conv);
78825         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78826         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
78827         int64_t ret_ref = tag_ptr(ret_copy, true);
78828         return ret_ref;
78829 }
78830
78831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
78832         LDKPublicKey node_id_ref;
78833         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78834         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78835         void* action_ptr = untag_ptr(action);
78836         CHECK_ACCESS(action_ptr);
78837         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
78838         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
78839         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78840         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
78841         int64_t ret_ref = tag_ptr(ret_copy, true);
78842         return ret_ref;
78843 }
78844
78845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1range_1query(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78846         LDKPublicKey node_id_ref;
78847         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78848         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78849         LDKQueryChannelRange msg_conv;
78850         msg_conv.inner = untag_ptr(msg);
78851         msg_conv.is_owned = ptr_is_owned(msg);
78852         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78853         msg_conv = QueryChannelRange_clone(&msg_conv);
78854         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78855         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
78856         int64_t ret_ref = tag_ptr(ret_copy, true);
78857         return ret_ref;
78858 }
78859
78860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1short_1ids_1query(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78861         LDKPublicKey node_id_ref;
78862         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78863         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78864         LDKQueryShortChannelIds msg_conv;
78865         msg_conv.inner = untag_ptr(msg);
78866         msg_conv.is_owned = ptr_is_owned(msg);
78867         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78868         msg_conv = QueryShortChannelIds_clone(&msg_conv);
78869         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78870         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
78871         int64_t ret_ref = tag_ptr(ret_copy, true);
78872         return ret_ref;
78873 }
78874
78875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1reply_1channel_1range(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78876         LDKPublicKey node_id_ref;
78877         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78878         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78879         LDKReplyChannelRange msg_conv;
78880         msg_conv.inner = untag_ptr(msg);
78881         msg_conv.is_owned = ptr_is_owned(msg);
78882         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78883         msg_conv = ReplyChannelRange_clone(&msg_conv);
78884         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78885         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
78886         int64_t ret_ref = tag_ptr(ret_copy, true);
78887         return ret_ref;
78888 }
78889
78890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1gossip_1timestamp_1filter(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
78891         LDKPublicKey node_id_ref;
78892         CHECK((*env)->GetArrayLength(env, node_id) == 33);
78893         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
78894         LDKGossipTimestampFilter msg_conv;
78895         msg_conv.inner = untag_ptr(msg);
78896         msg_conv.is_owned = ptr_is_owned(msg);
78897         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
78898         msg_conv = GossipTimestampFilter_clone(&msg_conv);
78899         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
78900         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
78901         int64_t ret_ref = tag_ptr(ret_copy, true);
78902         return ret_ref;
78903 }
78904
78905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
78906         if (!ptr_is_owned(this_ptr)) return;
78907         void* this_ptr_ptr = untag_ptr(this_ptr);
78908         CHECK_ACCESS(this_ptr_ptr);
78909         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
78910         FREE(untag_ptr(this_ptr));
78911         MessageSendEventsProvider_free(this_ptr_conv);
78912 }
78913
78914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
78915         if (!ptr_is_owned(this_ptr)) return;
78916         void* this_ptr_ptr = untag_ptr(this_ptr);
78917         CHECK_ACCESS(this_ptr_ptr);
78918         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
78919         FREE(untag_ptr(this_ptr));
78920         EventsProvider_free(this_ptr_conv);
78921 }
78922
78923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
78924         if (!ptr_is_owned(this_ptr)) return;
78925         void* this_ptr_ptr = untag_ptr(this_ptr);
78926         CHECK_ACCESS(this_ptr_ptr);
78927         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
78928         FREE(untag_ptr(this_ptr));
78929         EventHandler_free(this_ptr_conv);
78930 }
78931
78932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78933         LDKAnchorDescriptor this_obj_conv;
78934         this_obj_conv.inner = untag_ptr(this_obj);
78935         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78937         AnchorDescriptor_free(this_obj_conv);
78938 }
78939
78940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
78941         LDKAnchorDescriptor this_ptr_conv;
78942         this_ptr_conv.inner = untag_ptr(this_ptr);
78943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78945         this_ptr_conv.is_owned = false;
78946         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
78947         int64_t ret_ref = 0;
78948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78950         return ret_ref;
78951 }
78952
78953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
78954         LDKAnchorDescriptor this_ptr_conv;
78955         this_ptr_conv.inner = untag_ptr(this_ptr);
78956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78958         this_ptr_conv.is_owned = false;
78959         LDKChannelDerivationParameters val_conv;
78960         val_conv.inner = untag_ptr(val);
78961         val_conv.is_owned = ptr_is_owned(val);
78962         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
78963         val_conv = ChannelDerivationParameters_clone(&val_conv);
78964         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
78965 }
78966
78967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
78968         LDKAnchorDescriptor this_ptr_conv;
78969         this_ptr_conv.inner = untag_ptr(this_ptr);
78970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78972         this_ptr_conv.is_owned = false;
78973         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
78974         int64_t ret_ref = 0;
78975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78977         return ret_ref;
78978 }
78979
78980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
78981         LDKAnchorDescriptor this_ptr_conv;
78982         this_ptr_conv.inner = untag_ptr(this_ptr);
78983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78985         this_ptr_conv.is_owned = false;
78986         LDKOutPoint val_conv;
78987         val_conv.inner = untag_ptr(val);
78988         val_conv.is_owned = ptr_is_owned(val);
78989         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
78990         val_conv = OutPoint_clone(&val_conv);
78991         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
78992 }
78993
78994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1new(JNIEnv *env, jclass clz, int64_t channel_derivation_parameters_arg, int64_t outpoint_arg) {
78995         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
78996         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
78997         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
78998         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
78999         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
79000         LDKOutPoint outpoint_arg_conv;
79001         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
79002         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
79003         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
79004         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
79005         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
79006         int64_t ret_ref = 0;
79007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79009         return ret_ref;
79010 }
79011
79012 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
79013         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
79014         int64_t ret_ref = 0;
79015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79017         return ret_ref;
79018 }
79019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79020         LDKAnchorDescriptor arg_conv;
79021         arg_conv.inner = untag_ptr(arg);
79022         arg_conv.is_owned = ptr_is_owned(arg);
79023         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79024         arg_conv.is_owned = false;
79025         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
79026         return ret_conv;
79027 }
79028
79029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79030         LDKAnchorDescriptor orig_conv;
79031         orig_conv.inner = untag_ptr(orig);
79032         orig_conv.is_owned = ptr_is_owned(orig);
79033         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79034         orig_conv.is_owned = false;
79035         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
79036         int64_t ret_ref = 0;
79037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79039         return ret_ref;
79040 }
79041
79042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
79043         LDKAnchorDescriptor a_conv;
79044         a_conv.inner = untag_ptr(a);
79045         a_conv.is_owned = ptr_is_owned(a);
79046         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79047         a_conv.is_owned = false;
79048         LDKAnchorDescriptor b_conv;
79049         b_conv.inner = untag_ptr(b);
79050         b_conv.is_owned = ptr_is_owned(b);
79051         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
79052         b_conv.is_owned = false;
79053         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
79054         return ret_conv;
79055 }
79056
79057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) {
79058         LDKAnchorDescriptor this_arg_conv;
79059         this_arg_conv.inner = untag_ptr(this_arg);
79060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79062         this_arg_conv.is_owned = false;
79063         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
79064         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
79065         return tag_ptr(ret_ref, true);
79066 }
79067
79068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) {
79069         LDKAnchorDescriptor this_arg_conv;
79070         this_arg_conv.inner = untag_ptr(this_arg);
79071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79073         this_arg_conv.is_owned = false;
79074         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
79075         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
79076         return tag_ptr(ret_ref, true);
79077 }
79078
79079 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
79080         LDKAnchorDescriptor this_arg_conv;
79081         this_arg_conv.inner = untag_ptr(this_arg);
79082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79084         this_arg_conv.is_owned = false;
79085         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
79086         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
79087         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
79088         CVec_u8Z_free(ret_var);
79089         return ret_arr;
79090 }
79091
79092 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1tx_1input_1witness(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray signature) {
79093         LDKAnchorDescriptor this_arg_conv;
79094         this_arg_conv.inner = untag_ptr(this_arg);
79095         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79097         this_arg_conv.is_owned = false;
79098         LDKECDSASignature signature_ref;
79099         CHECK((*env)->GetArrayLength(env, signature) == 64);
79100         (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form);
79101         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
79102         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
79103         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
79104         Witness_free(ret_var);
79105         return ret_arr;
79106 }
79107
79108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1derive_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t signer_provider) {
79109         LDKAnchorDescriptor this_arg_conv;
79110         this_arg_conv.inner = untag_ptr(this_arg);
79111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79113         this_arg_conv.is_owned = false;
79114         void* signer_provider_ptr = untag_ptr(signer_provider);
79115         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
79116         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
79117         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
79118         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
79119         return tag_ptr(ret_ret, true);
79120 }
79121
79122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
79123         if (!ptr_is_owned(this_ptr)) return;
79124         void* this_ptr_ptr = untag_ptr(this_ptr);
79125         CHECK_ACCESS(this_ptr_ptr);
79126         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
79127         FREE(untag_ptr(this_ptr));
79128         BumpTransactionEvent_free(this_ptr_conv);
79129 }
79130
79131 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
79132         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
79133         *ret_copy = BumpTransactionEvent_clone(arg);
79134         int64_t ret_ref = tag_ptr(ret_copy, true);
79135         return ret_ref;
79136 }
79137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79138         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
79139         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
79140         return ret_conv;
79141 }
79142
79143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79144         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
79145         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
79146         *ret_copy = BumpTransactionEvent_clone(orig_conv);
79147         int64_t ret_ref = tag_ptr(ret_copy, true);
79148         return ret_ref;
79149 }
79150
79151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1channel_1close(JNIEnv *env, jclass clz, int8_tArray claim_id, int32_t package_target_feerate_sat_per_1000_weight, int8_tArray commitment_tx, int64_t commitment_tx_fee_satoshis, int64_t anchor_descriptor, int64_tArray pending_htlcs) {
79152         LDKThirtyTwoBytes claim_id_ref;
79153         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
79154         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
79155         LDKTransaction commitment_tx_ref;
79156         commitment_tx_ref.datalen = (*env)->GetArrayLength(env, commitment_tx);
79157         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
79158         (*env)->GetByteArrayRegion(env, commitment_tx, 0, commitment_tx_ref.datalen, commitment_tx_ref.data);
79159         commitment_tx_ref.data_is_owned = true;
79160         LDKAnchorDescriptor anchor_descriptor_conv;
79161         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
79162         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
79163         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
79164         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
79165         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
79166         pending_htlcs_constr.datalen = (*env)->GetArrayLength(env, pending_htlcs);
79167         if (pending_htlcs_constr.datalen > 0)
79168                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
79169         else
79170                 pending_htlcs_constr.data = NULL;
79171         int64_t* pending_htlcs_vals = (*env)->GetLongArrayElements (env, pending_htlcs, NULL);
79172         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
79173                 int64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
79174                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
79175                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
79176                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
79177                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
79178                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
79179                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
79180         }
79181         (*env)->ReleaseLongArrayElements(env, pending_htlcs, pending_htlcs_vals, 0);
79182         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
79183         *ret_copy = BumpTransactionEvent_channel_close(claim_id_ref, package_target_feerate_sat_per_1000_weight, commitment_tx_ref, commitment_tx_fee_satoshis, anchor_descriptor_conv, pending_htlcs_constr);
79184         int64_t ret_ref = tag_ptr(ret_copy, true);
79185         return ret_ref;
79186 }
79187
79188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1htlcresolution(JNIEnv *env, jclass clz, int8_tArray claim_id, int32_t target_feerate_sat_per_1000_weight, int64_tArray htlc_descriptors, int32_t tx_lock_time) {
79189         LDKThirtyTwoBytes claim_id_ref;
79190         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
79191         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
79192         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
79193         htlc_descriptors_constr.datalen = (*env)->GetArrayLength(env, htlc_descriptors);
79194         if (htlc_descriptors_constr.datalen > 0)
79195                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
79196         else
79197                 htlc_descriptors_constr.data = NULL;
79198         int64_t* htlc_descriptors_vals = (*env)->GetLongArrayElements (env, htlc_descriptors, NULL);
79199         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
79200                 int64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
79201                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
79202                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
79203                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
79204                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
79205                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
79206                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
79207         }
79208         (*env)->ReleaseLongArrayElements(env, htlc_descriptors, htlc_descriptors_vals, 0);
79209         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
79210         *ret_copy = BumpTransactionEvent_htlcresolution(claim_id_ref, target_feerate_sat_per_1000_weight, htlc_descriptors_constr, tx_lock_time);
79211         int64_t ret_ref = tag_ptr(ret_copy, true);
79212         return ret_ref;
79213 }
79214
79215 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
79216         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
79217         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
79218         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
79219         return ret_conv;
79220 }
79221
79222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79223         LDKInput this_obj_conv;
79224         this_obj_conv.inner = untag_ptr(this_obj);
79225         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79227         Input_free(this_obj_conv);
79228 }
79229
79230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
79231         LDKInput this_ptr_conv;
79232         this_ptr_conv.inner = untag_ptr(this_ptr);
79233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79235         this_ptr_conv.is_owned = false;
79236         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
79237         int64_t ret_ref = 0;
79238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79240         return ret_ref;
79241 }
79242
79243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79244         LDKInput this_ptr_conv;
79245         this_ptr_conv.inner = untag_ptr(this_ptr);
79246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79248         this_ptr_conv.is_owned = false;
79249         LDKOutPoint val_conv;
79250         val_conv.inner = untag_ptr(val);
79251         val_conv.is_owned = ptr_is_owned(val);
79252         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79253         val_conv = OutPoint_clone(&val_conv);
79254         Input_set_outpoint(&this_ptr_conv, val_conv);
79255 }
79256
79257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_ptr) {
79258         LDKInput this_ptr_conv;
79259         this_ptr_conv.inner = untag_ptr(this_ptr);
79260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79262         this_ptr_conv.is_owned = false;
79263         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
79264         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
79265         return tag_ptr(ret_ref, true);
79266 }
79267
79268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79269         LDKInput this_ptr_conv;
79270         this_ptr_conv.inner = untag_ptr(this_ptr);
79271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79273         this_ptr_conv.is_owned = false;
79274         void* val_ptr = untag_ptr(val);
79275         CHECK_ACCESS(val_ptr);
79276         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
79277         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
79278         Input_set_previous_utxo(&this_ptr_conv, val_conv);
79279 }
79280
79281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
79282         LDKInput this_ptr_conv;
79283         this_ptr_conv.inner = untag_ptr(this_ptr);
79284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79286         this_ptr_conv.is_owned = false;
79287         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
79288         return ret_conv;
79289 }
79290
79291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79292         LDKInput this_ptr_conv;
79293         this_ptr_conv.inner = untag_ptr(this_ptr);
79294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79296         this_ptr_conv.is_owned = false;
79297         Input_set_satisfaction_weight(&this_ptr_conv, val);
79298 }
79299
79300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int64_t previous_utxo_arg, int64_t satisfaction_weight_arg) {
79301         LDKOutPoint outpoint_arg_conv;
79302         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
79303         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
79304         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
79305         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
79306         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
79307         CHECK_ACCESS(previous_utxo_arg_ptr);
79308         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
79309         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
79310         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
79311         int64_t ret_ref = 0;
79312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79314         return ret_ref;
79315 }
79316
79317 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
79318         LDKInput ret_var = Input_clone(arg);
79319         int64_t ret_ref = 0;
79320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79322         return ret_ref;
79323 }
79324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79325         LDKInput arg_conv;
79326         arg_conv.inner = untag_ptr(arg);
79327         arg_conv.is_owned = ptr_is_owned(arg);
79328         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79329         arg_conv.is_owned = false;
79330         int64_t ret_conv = Input_clone_ptr(&arg_conv);
79331         return ret_conv;
79332 }
79333
79334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79335         LDKInput orig_conv;
79336         orig_conv.inner = untag_ptr(orig);
79337         orig_conv.is_owned = ptr_is_owned(orig);
79338         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79339         orig_conv.is_owned = false;
79340         LDKInput ret_var = Input_clone(&orig_conv);
79341         int64_t ret_ref = 0;
79342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79344         return ret_ref;
79345 }
79346
79347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1hash(JNIEnv *env, jclass clz, int64_t o) {
79348         LDKInput o_conv;
79349         o_conv.inner = untag_ptr(o);
79350         o_conv.is_owned = ptr_is_owned(o);
79351         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
79352         o_conv.is_owned = false;
79353         int64_t ret_conv = Input_hash(&o_conv);
79354         return ret_conv;
79355 }
79356
79357 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Input_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
79358         LDKInput a_conv;
79359         a_conv.inner = untag_ptr(a);
79360         a_conv.is_owned = ptr_is_owned(a);
79361         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79362         a_conv.is_owned = false;
79363         LDKInput b_conv;
79364         b_conv.inner = untag_ptr(b);
79365         b_conv.is_owned = ptr_is_owned(b);
79366         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
79367         b_conv.is_owned = false;
79368         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
79369         return ret_conv;
79370 }
79371
79372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79373         LDKUtxo this_obj_conv;
79374         this_obj_conv.inner = untag_ptr(this_obj);
79375         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79377         Utxo_free(this_obj_conv);
79378 }
79379
79380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
79381         LDKUtxo this_ptr_conv;
79382         this_ptr_conv.inner = untag_ptr(this_ptr);
79383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79385         this_ptr_conv.is_owned = false;
79386         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
79387         int64_t ret_ref = 0;
79388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79390         return ret_ref;
79391 }
79392
79393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79394         LDKUtxo this_ptr_conv;
79395         this_ptr_conv.inner = untag_ptr(this_ptr);
79396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79398         this_ptr_conv.is_owned = false;
79399         LDKOutPoint val_conv;
79400         val_conv.inner = untag_ptr(val);
79401         val_conv.is_owned = ptr_is_owned(val);
79402         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79403         val_conv = OutPoint_clone(&val_conv);
79404         Utxo_set_outpoint(&this_ptr_conv, val_conv);
79405 }
79406
79407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
79408         LDKUtxo this_ptr_conv;
79409         this_ptr_conv.inner = untag_ptr(this_ptr);
79410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79412         this_ptr_conv.is_owned = false;
79413         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
79414         *ret_ref = Utxo_get_output(&this_ptr_conv);
79415         return tag_ptr(ret_ref, true);
79416 }
79417
79418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79419         LDKUtxo this_ptr_conv;
79420         this_ptr_conv.inner = untag_ptr(this_ptr);
79421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79423         this_ptr_conv.is_owned = false;
79424         void* val_ptr = untag_ptr(val);
79425         CHECK_ACCESS(val_ptr);
79426         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
79427         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
79428         Utxo_set_output(&this_ptr_conv, val_conv);
79429 }
79430
79431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
79432         LDKUtxo this_ptr_conv;
79433         this_ptr_conv.inner = untag_ptr(this_ptr);
79434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79436         this_ptr_conv.is_owned = false;
79437         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
79438         return ret_conv;
79439 }
79440
79441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79442         LDKUtxo this_ptr_conv;
79443         this_ptr_conv.inner = untag_ptr(this_ptr);
79444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79446         this_ptr_conv.is_owned = false;
79447         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
79448 }
79449
79450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int64_t output_arg, int64_t satisfaction_weight_arg) {
79451         LDKOutPoint outpoint_arg_conv;
79452         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
79453         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
79454         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
79455         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
79456         void* output_arg_ptr = untag_ptr(output_arg);
79457         CHECK_ACCESS(output_arg_ptr);
79458         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
79459         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
79460         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
79461         int64_t ret_ref = 0;
79462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79464         return ret_ref;
79465 }
79466
79467 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
79468         LDKUtxo ret_var = Utxo_clone(arg);
79469         int64_t ret_ref = 0;
79470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79472         return ret_ref;
79473 }
79474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79475         LDKUtxo arg_conv;
79476         arg_conv.inner = untag_ptr(arg);
79477         arg_conv.is_owned = ptr_is_owned(arg);
79478         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79479         arg_conv.is_owned = false;
79480         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
79481         return ret_conv;
79482 }
79483
79484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79485         LDKUtxo orig_conv;
79486         orig_conv.inner = untag_ptr(orig);
79487         orig_conv.is_owned = ptr_is_owned(orig);
79488         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79489         orig_conv.is_owned = false;
79490         LDKUtxo ret_var = Utxo_clone(&orig_conv);
79491         int64_t ret_ref = 0;
79492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79494         return ret_ref;
79495 }
79496
79497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1hash(JNIEnv *env, jclass clz, int64_t o) {
79498         LDKUtxo o_conv;
79499         o_conv.inner = untag_ptr(o);
79500         o_conv.is_owned = ptr_is_owned(o);
79501         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
79502         o_conv.is_owned = false;
79503         int64_t ret_conv = Utxo_hash(&o_conv);
79504         return ret_conv;
79505 }
79506
79507 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Utxo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
79508         LDKUtxo a_conv;
79509         a_conv.inner = untag_ptr(a);
79510         a_conv.is_owned = ptr_is_owned(a);
79511         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79512         a_conv.is_owned = false;
79513         LDKUtxo b_conv;
79514         b_conv.inner = untag_ptr(b);
79515         b_conv.is_owned = ptr_is_owned(b);
79516         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
79517         b_conv.is_owned = false;
79518         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
79519         return ret_conv;
79520 }
79521
79522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1new_1p2pkh(JNIEnv *env, jclass clz, int64_t outpoint, int64_t value, int8_tArray pubkey_hash) {
79523         LDKOutPoint outpoint_conv;
79524         outpoint_conv.inner = untag_ptr(outpoint);
79525         outpoint_conv.is_owned = ptr_is_owned(outpoint);
79526         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
79527         outpoint_conv = OutPoint_clone(&outpoint_conv);
79528         uint8_t pubkey_hash_arr[20];
79529         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
79530         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
79531         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
79532         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
79533         int64_t ret_ref = 0;
79534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79536         return ret_ref;
79537 }
79538
79539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79540         LDKCoinSelection this_obj_conv;
79541         this_obj_conv.inner = untag_ptr(this_obj);
79542         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79544         CoinSelection_free(this_obj_conv);
79545 }
79546
79547 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CoinSelection_1get_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_ptr) {
79548         LDKCoinSelection this_ptr_conv;
79549         this_ptr_conv.inner = untag_ptr(this_ptr);
79550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79552         this_ptr_conv.is_owned = false;
79553         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
79554         int64_tArray ret_arr = NULL;
79555         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
79556         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
79557         for (size_t g = 0; g < ret_var.datalen; g++) {
79558                 LDKUtxo ret_conv_6_var = ret_var.data[g];
79559                 int64_t ret_conv_6_ref = 0;
79560                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
79561                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
79562                 ret_arr_ptr[g] = ret_conv_6_ref;
79563         }
79564         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
79565         FREE(ret_var.data);
79566         return ret_arr;
79567 }
79568
79569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1set_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
79570         LDKCoinSelection this_ptr_conv;
79571         this_ptr_conv.inner = untag_ptr(this_ptr);
79572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79574         this_ptr_conv.is_owned = false;
79575         LDKCVec_UtxoZ val_constr;
79576         val_constr.datalen = (*env)->GetArrayLength(env, val);
79577         if (val_constr.datalen > 0)
79578                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
79579         else
79580                 val_constr.data = NULL;
79581         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
79582         for (size_t g = 0; g < val_constr.datalen; g++) {
79583                 int64_t val_conv_6 = val_vals[g];
79584                 LDKUtxo val_conv_6_conv;
79585                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
79586                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
79587                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
79588                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
79589                 val_constr.data[g] = val_conv_6_conv;
79590         }
79591         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
79592         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
79593 }
79594
79595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1get_1change_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
79596         LDKCoinSelection this_ptr_conv;
79597         this_ptr_conv.inner = untag_ptr(this_ptr);
79598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79600         this_ptr_conv.is_owned = false;
79601         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
79602         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
79603         int64_t ret_ref = tag_ptr(ret_copy, true);
79604         return ret_ref;
79605 }
79606
79607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1set_1change_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79608         LDKCoinSelection this_ptr_conv;
79609         this_ptr_conv.inner = untag_ptr(this_ptr);
79610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79612         this_ptr_conv.is_owned = false;
79613         void* val_ptr = untag_ptr(val);
79614         CHECK_ACCESS(val_ptr);
79615         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
79616         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
79617         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
79618 }
79619
79620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1new(JNIEnv *env, jclass clz, int64_tArray confirmed_utxos_arg, int64_t change_output_arg) {
79621         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
79622         confirmed_utxos_arg_constr.datalen = (*env)->GetArrayLength(env, confirmed_utxos_arg);
79623         if (confirmed_utxos_arg_constr.datalen > 0)
79624                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
79625         else
79626                 confirmed_utxos_arg_constr.data = NULL;
79627         int64_t* confirmed_utxos_arg_vals = (*env)->GetLongArrayElements (env, confirmed_utxos_arg, NULL);
79628         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
79629                 int64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
79630                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
79631                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
79632                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
79633                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
79634                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
79635                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
79636         }
79637         (*env)->ReleaseLongArrayElements(env, confirmed_utxos_arg, confirmed_utxos_arg_vals, 0);
79638         void* change_output_arg_ptr = untag_ptr(change_output_arg);
79639         CHECK_ACCESS(change_output_arg_ptr);
79640         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
79641         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
79642         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
79643         int64_t ret_ref = 0;
79644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79646         return ret_ref;
79647 }
79648
79649 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
79650         LDKCoinSelection ret_var = CoinSelection_clone(arg);
79651         int64_t ret_ref = 0;
79652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79654         return ret_ref;
79655 }
79656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79657         LDKCoinSelection arg_conv;
79658         arg_conv.inner = untag_ptr(arg);
79659         arg_conv.is_owned = ptr_is_owned(arg);
79660         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79661         arg_conv.is_owned = false;
79662         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
79663         return ret_conv;
79664 }
79665
79666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79667         LDKCoinSelection orig_conv;
79668         orig_conv.inner = untag_ptr(orig);
79669         orig_conv.is_owned = ptr_is_owned(orig);
79670         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79671         orig_conv.is_owned = false;
79672         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
79673         int64_t ret_ref = 0;
79674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79676         return ret_ref;
79677 }
79678
79679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
79680         if (!ptr_is_owned(this_ptr)) return;
79681         void* this_ptr_ptr = untag_ptr(this_ptr);
79682         CHECK_ACCESS(this_ptr_ptr);
79683         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
79684         FREE(untag_ptr(this_ptr));
79685         CoinSelectionSource_free(this_ptr_conv);
79686 }
79687
79688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WalletSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
79689         if (!ptr_is_owned(this_ptr)) return;
79690         void* this_ptr_ptr = untag_ptr(this_ptr);
79691         CHECK_ACCESS(this_ptr_ptr);
79692         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
79693         FREE(untag_ptr(this_ptr));
79694         WalletSource_free(this_ptr_conv);
79695 }
79696
79697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Wallet_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79698         LDKWallet this_obj_conv;
79699         this_obj_conv.inner = untag_ptr(this_obj);
79700         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79702         Wallet_free(this_obj_conv);
79703 }
79704
79705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Wallet_1new(JNIEnv *env, jclass clz, int64_t source, int64_t logger) {
79706         void* source_ptr = untag_ptr(source);
79707         CHECK_ACCESS(source_ptr);
79708         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
79709         if (source_conv.free == LDKWalletSource_JCalls_free) {
79710                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79711                 LDKWalletSource_JCalls_cloned(&source_conv);
79712         }
79713         void* logger_ptr = untag_ptr(logger);
79714         CHECK_ACCESS(logger_ptr);
79715         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
79716         if (logger_conv.free == LDKLogger_JCalls_free) {
79717                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79718                 LDKLogger_JCalls_cloned(&logger_conv);
79719         }
79720         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
79721         int64_t ret_ref = 0;
79722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79724         return ret_ref;
79725 }
79726
79727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Wallet_1as_1CoinSelectionSource(JNIEnv *env, jclass clz, int64_t this_arg) {
79728         LDKWallet this_arg_conv;
79729         this_arg_conv.inner = untag_ptr(this_arg);
79730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79732         this_arg_conv.is_owned = false;
79733         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
79734         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
79735         return tag_ptr(ret_ret, true);
79736 }
79737
79738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79739         LDKBumpTransactionEventHandler this_obj_conv;
79740         this_obj_conv.inner = untag_ptr(this_obj);
79741         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79743         BumpTransactionEventHandler_free(this_obj_conv);
79744 }
79745
79746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1new(JNIEnv *env, jclass clz, int64_t broadcaster, int64_t utxo_source, int64_t signer_provider, int64_t logger) {
79747         void* broadcaster_ptr = untag_ptr(broadcaster);
79748         CHECK_ACCESS(broadcaster_ptr);
79749         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
79750         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
79751                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79752                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
79753         }
79754         void* utxo_source_ptr = untag_ptr(utxo_source);
79755         CHECK_ACCESS(utxo_source_ptr);
79756         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
79757         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
79758                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79759                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
79760         }
79761         void* signer_provider_ptr = untag_ptr(signer_provider);
79762         CHECK_ACCESS(signer_provider_ptr);
79763         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
79764         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
79765                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79766                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
79767         }
79768         void* logger_ptr = untag_ptr(logger);
79769         CHECK_ACCESS(logger_ptr);
79770         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
79771         if (logger_conv.free == LDKLogger_JCalls_free) {
79772                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79773                 LDKLogger_JCalls_cloned(&logger_conv);
79774         }
79775         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
79776         int64_t ret_ref = 0;
79777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79779         return ret_ref;
79780 }
79781
79782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
79783         LDKBumpTransactionEventHandler this_arg_conv;
79784         this_arg_conv.inner = untag_ptr(this_arg);
79785         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79787         this_arg_conv.is_owned = false;
79788         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
79789         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
79790 }
79791
79792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79793         LDKFilesystemStore this_obj_conv;
79794         this_obj_conv.inner = untag_ptr(this_obj);
79795         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79797         FilesystemStore_free(this_obj_conv);
79798 }
79799
79800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1new(JNIEnv *env, jclass clz, jstring data_dir) {
79801         LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
79802         LDKFilesystemStore ret_var = FilesystemStore_new(data_dir_conv);
79803         int64_t ret_ref = 0;
79804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79806         return ret_ref;
79807 }
79808
79809 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
79810         LDKFilesystemStore this_arg_conv;
79811         this_arg_conv.inner = untag_ptr(this_arg);
79812         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79814         this_arg_conv.is_owned = false;
79815         LDKStr ret_str = FilesystemStore_get_data_dir(&this_arg_conv);
79816         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
79817         Str_free(ret_str);
79818         return ret_conv;
79819 }
79820
79821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1as_1KVStore(JNIEnv *env, jclass clz, int64_t this_arg) {
79822         LDKFilesystemStore this_arg_conv;
79823         this_arg_conv.inner = untag_ptr(this_arg);
79824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79826         this_arg_conv.is_owned = false;
79827         LDKKVStore* ret_ret = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
79828         *ret_ret = FilesystemStore_as_KVStore(&this_arg_conv);
79829         return tag_ptr(ret_ret, true);
79830 }
79831
79832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79833         LDKBackgroundProcessor this_obj_conv;
79834         this_obj_conv.inner = untag_ptr(this_obj);
79835         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79837         BackgroundProcessor_free(this_obj_conv);
79838 }
79839
79840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipSync_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
79841         if (!ptr_is_owned(this_ptr)) return;
79842         void* this_ptr_ptr = untag_ptr(this_ptr);
79843         CHECK_ACCESS(this_ptr_ptr);
79844         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
79845         FREE(untag_ptr(this_ptr));
79846         GossipSync_free(this_ptr_conv);
79847 }
79848
79849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1p2_1p(JNIEnv *env, jclass clz, int64_t a) {
79850         LDKP2PGossipSync a_conv;
79851         a_conv.inner = untag_ptr(a);
79852         a_conv.is_owned = ptr_is_owned(a);
79853         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79854         a_conv.is_owned = false;
79855         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
79856         *ret_copy = GossipSync_p2_p(&a_conv);
79857         int64_t ret_ref = tag_ptr(ret_copy, true);
79858         return ret_ref;
79859 }
79860
79861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1rapid(JNIEnv *env, jclass clz, int64_t a) {
79862         LDKRapidGossipSync a_conv;
79863         a_conv.inner = untag_ptr(a);
79864         a_conv.is_owned = ptr_is_owned(a);
79865         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79866         a_conv.is_owned = false;
79867         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
79868         *ret_copy = GossipSync_rapid(&a_conv);
79869         int64_t ret_ref = tag_ptr(ret_copy, true);
79870         return ret_ref;
79871 }
79872
79873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1none(JNIEnv *env, jclass clz) {
79874         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
79875         *ret_copy = GossipSync_none();
79876         int64_t ret_ref = tag_ptr(ret_copy, true);
79877         return ret_ref;
79878 }
79879
79880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start(JNIEnv *env, jclass clz, int64_t persister, int64_t event_handler, int64_t chain_monitor, int64_t channel_manager, int64_t gossip_sync, int64_t peer_manager, int64_t logger, int64_t scorer) {
79881         void* persister_ptr = untag_ptr(persister);
79882         CHECK_ACCESS(persister_ptr);
79883         LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
79884         if (persister_conv.free == LDKPersister_JCalls_free) {
79885                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79886                 LDKPersister_JCalls_cloned(&persister_conv);
79887         }
79888         void* event_handler_ptr = untag_ptr(event_handler);
79889         CHECK_ACCESS(event_handler_ptr);
79890         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
79891         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
79892                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79893                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
79894         }
79895         LDKChainMonitor chain_monitor_conv;
79896         chain_monitor_conv.inner = untag_ptr(chain_monitor);
79897         chain_monitor_conv.is_owned = ptr_is_owned(chain_monitor);
79898         CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
79899         chain_monitor_conv.is_owned = false;
79900         LDKChannelManager channel_manager_conv;
79901         channel_manager_conv.inner = untag_ptr(channel_manager);
79902         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
79903         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
79904         channel_manager_conv.is_owned = false;
79905         void* gossip_sync_ptr = untag_ptr(gossip_sync);
79906         CHECK_ACCESS(gossip_sync_ptr);
79907         LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
79908         // WARNING: we may need a move here but no clone is available for LDKGossipSync
79909         LDKPeerManager peer_manager_conv;
79910         peer_manager_conv.inner = untag_ptr(peer_manager);
79911         peer_manager_conv.is_owned = ptr_is_owned(peer_manager);
79912         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
79913         peer_manager_conv.is_owned = false;
79914         void* logger_ptr = untag_ptr(logger);
79915         CHECK_ACCESS(logger_ptr);
79916         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
79917         if (logger_conv.free == LDKLogger_JCalls_free) {
79918                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79919                 LDKLogger_JCalls_cloned(&logger_conv);
79920         }
79921         void* scorer_ptr = untag_ptr(scorer);
79922         CHECK_ACCESS(scorer_ptr);
79923         LDKCOption_WriteableScoreZ scorer_conv = *(LDKCOption_WriteableScoreZ*)(scorer_ptr);
79924         // WARNING: we may need a move here but no clone is available for LDKCOption_WriteableScoreZ
79925         if (scorer_conv.tag == LDKCOption_WriteableScoreZ_Some) {
79926                 // Manually implement clone for Java trait instances
79927                 if (scorer_conv.some.free == LDKWriteableScore_JCalls_free) {
79928                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79929                         LDKWriteableScore_JCalls_cloned(&scorer_conv.some);
79930                 }
79931         }
79932         LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, gossip_sync_conv, &peer_manager_conv, logger_conv, scorer_conv);
79933         int64_t ret_ref = 0;
79934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79936         return ret_ref;
79937 }
79938
79939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
79940         LDKBackgroundProcessor this_arg_conv;
79941         this_arg_conv.inner = untag_ptr(this_arg);
79942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79944         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
79945         
79946         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
79947         *ret_conv = BackgroundProcessor_join(this_arg_conv);
79948         return tag_ptr(ret_conv, true);
79949 }
79950
79951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
79952         LDKBackgroundProcessor this_arg_conv;
79953         this_arg_conv.inner = untag_ptr(this_arg);
79954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79956         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
79957         
79958         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
79959         *ret_conv = BackgroundProcessor_stop(this_arg_conv);
79960         return tag_ptr(ret_conv, true);
79961 }
79962
79963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
79964         if (!ptr_is_owned(this_ptr)) return;
79965         void* this_ptr_ptr = untag_ptr(this_ptr);
79966         CHECK_ACCESS(this_ptr_ptr);
79967         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
79968         FREE(untag_ptr(this_ptr));
79969         Bolt11ParseError_free(this_ptr_conv);
79970 }
79971
79972 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
79973         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
79974         *ret_copy = Bolt11ParseError_clone(arg);
79975         int64_t ret_ref = tag_ptr(ret_copy, true);
79976         return ret_ref;
79977 }
79978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79979         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
79980         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
79981         return ret_conv;
79982 }
79983
79984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79985         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
79986         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
79987         *ret_copy = Bolt11ParseError_clone(orig_conv);
79988         int64_t ret_ref = tag_ptr(ret_copy, true);
79989         return ret_ref;
79990 }
79991
79992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) {
79993         void* a_ptr = untag_ptr(a);
79994         CHECK_ACCESS(a_ptr);
79995         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
79996         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
79997         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
79998         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
79999         int64_t ret_ref = tag_ptr(ret_copy, true);
80000         return ret_ref;
80001 }
80002
80003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) {
80004         
80005         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80006         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
80007         int64_t ret_ref = tag_ptr(ret_copy, true);
80008         return ret_ref;
80009 }
80010
80011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) {
80012         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
80013         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80014         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
80015         int64_t ret_ref = tag_ptr(ret_copy, true);
80016         return ret_ref;
80017 }
80018
80019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1bad_1prefix(JNIEnv *env, jclass clz) {
80020         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80021         *ret_copy = Bolt11ParseError_bad_prefix();
80022         int64_t ret_ref = tag_ptr(ret_copy, true);
80023         return ret_ref;
80024 }
80025
80026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unknown_1currency(JNIEnv *env, jclass clz) {
80027         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80028         *ret_copy = Bolt11ParseError_unknown_currency();
80029         int64_t ret_ref = tag_ptr(ret_copy, true);
80030         return ret_ref;
80031 }
80032
80033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) {
80034         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80035         *ret_copy = Bolt11ParseError_unknown_si_prefix();
80036         int64_t ret_ref = tag_ptr(ret_copy, true);
80037         return ret_ref;
80038 }
80039
80040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) {
80041         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80042         *ret_copy = Bolt11ParseError_malformed_hrp();
80043         int64_t ret_ref = tag_ptr(ret_copy, true);
80044         return ret_ref;
80045 }
80046
80047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) {
80048         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80049         *ret_copy = Bolt11ParseError_too_short_data_part();
80050         int64_t ret_ref = tag_ptr(ret_copy, true);
80051         return ret_ref;
80052 }
80053
80054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) {
80055         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80056         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
80057         int64_t ret_ref = tag_ptr(ret_copy, true);
80058         return ret_ref;
80059 }
80060
80061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) {
80062         
80063         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80064         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
80065         int64_t ret_ref = tag_ptr(ret_copy, true);
80066         return ret_ref;
80067 }
80068
80069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1padding_1error(JNIEnv *env, jclass clz) {
80070         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80071         *ret_copy = Bolt11ParseError_padding_error();
80072         int64_t ret_ref = tag_ptr(ret_copy, true);
80073         return ret_ref;
80074 }
80075
80076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) {
80077         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80078         *ret_copy = Bolt11ParseError_integer_overflow_error();
80079         int64_t ret_ref = tag_ptr(ret_copy, true);
80080         return ret_ref;
80081 }
80082
80083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) {
80084         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80085         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
80086         int64_t ret_ref = tag_ptr(ret_copy, true);
80087         return ret_ref;
80088 }
80089
80090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) {
80091         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80092         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
80093         int64_t ret_ref = tag_ptr(ret_copy, true);
80094         return ret_ref;
80095 }
80096
80097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) {
80098         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80099         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
80100         int64_t ret_ref = tag_ptr(ret_copy, true);
80101         return ret_ref;
80102 }
80103
80104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
80105         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80106         *ret_copy = Bolt11ParseError_invalid_recovery_id();
80107         int64_t ret_ref = tag_ptr(ret_copy, true);
80108         return ret_ref;
80109 }
80110
80111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) {
80112         LDKStr a_conv = java_to_owned_str(env, a);
80113         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80114         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
80115         int64_t ret_ref = tag_ptr(ret_copy, true);
80116         return ret_ref;
80117 }
80118
80119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1skip(JNIEnv *env, jclass clz) {
80120         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
80121         *ret_copy = Bolt11ParseError_skip();
80122         int64_t ret_ref = tag_ptr(ret_copy, true);
80123         return ret_ref;
80124 }
80125
80126 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80127         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
80128         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
80129         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
80130         return ret_conv;
80131 }
80132
80133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
80134         if (!ptr_is_owned(this_ptr)) return;
80135         void* this_ptr_ptr = untag_ptr(this_ptr);
80136         CHECK_ACCESS(this_ptr_ptr);
80137         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
80138         FREE(untag_ptr(this_ptr));
80139         ParseOrSemanticError_free(this_ptr_conv);
80140 }
80141
80142 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
80143         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
80144         *ret_copy = ParseOrSemanticError_clone(arg);
80145         int64_t ret_ref = tag_ptr(ret_copy, true);
80146         return ret_ref;
80147 }
80148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80149         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
80150         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
80151         return ret_conv;
80152 }
80153
80154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80155         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
80156         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
80157         *ret_copy = ParseOrSemanticError_clone(orig_conv);
80158         int64_t ret_ref = tag_ptr(ret_copy, true);
80159         return ret_ref;
80160 }
80161
80162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) {
80163         void* a_ptr = untag_ptr(a);
80164         CHECK_ACCESS(a_ptr);
80165         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
80166         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
80167         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
80168         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
80169         int64_t ret_ref = tag_ptr(ret_copy, true);
80170         return ret_ref;
80171 }
80172
80173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) {
80174         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_java(env, a);
80175         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
80176         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
80177         int64_t ret_ref = tag_ptr(ret_copy, true);
80178         return ret_ref;
80179 }
80180
80181 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80182         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
80183         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
80184         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
80185         return ret_conv;
80186 }
80187
80188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80189         LDKBolt11Invoice this_obj_conv;
80190         this_obj_conv.inner = untag_ptr(this_obj);
80191         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80193         Bolt11Invoice_free(this_obj_conv);
80194 }
80195
80196 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80197         LDKBolt11Invoice a_conv;
80198         a_conv.inner = untag_ptr(a);
80199         a_conv.is_owned = ptr_is_owned(a);
80200         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80201         a_conv.is_owned = false;
80202         LDKBolt11Invoice b_conv;
80203         b_conv.inner = untag_ptr(b);
80204         b_conv.is_owned = ptr_is_owned(b);
80205         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80206         b_conv.is_owned = false;
80207         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
80208         return ret_conv;
80209 }
80210
80211 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
80212         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
80213         int64_t ret_ref = 0;
80214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80216         return ret_ref;
80217 }
80218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80219         LDKBolt11Invoice arg_conv;
80220         arg_conv.inner = untag_ptr(arg);
80221         arg_conv.is_owned = ptr_is_owned(arg);
80222         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80223         arg_conv.is_owned = false;
80224         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
80225         return ret_conv;
80226 }
80227
80228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80229         LDKBolt11Invoice orig_conv;
80230         orig_conv.inner = untag_ptr(orig);
80231         orig_conv.is_owned = ptr_is_owned(orig);
80232         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80233         orig_conv.is_owned = false;
80234         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
80235         int64_t ret_ref = 0;
80236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80238         return ret_ref;
80239 }
80240
80241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
80242         LDKBolt11Invoice o_conv;
80243         o_conv.inner = untag_ptr(o);
80244         o_conv.is_owned = ptr_is_owned(o);
80245         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
80246         o_conv.is_owned = false;
80247         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
80248         return ret_conv;
80249 }
80250
80251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80252         LDKSignedRawBolt11Invoice this_obj_conv;
80253         this_obj_conv.inner = untag_ptr(this_obj);
80254         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80256         SignedRawBolt11Invoice_free(this_obj_conv);
80257 }
80258
80259 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80260         LDKSignedRawBolt11Invoice a_conv;
80261         a_conv.inner = untag_ptr(a);
80262         a_conv.is_owned = ptr_is_owned(a);
80263         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80264         a_conv.is_owned = false;
80265         LDKSignedRawBolt11Invoice b_conv;
80266         b_conv.inner = untag_ptr(b);
80267         b_conv.is_owned = ptr_is_owned(b);
80268         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80269         b_conv.is_owned = false;
80270         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
80271         return ret_conv;
80272 }
80273
80274 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
80275         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
80276         int64_t ret_ref = 0;
80277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80279         return ret_ref;
80280 }
80281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80282         LDKSignedRawBolt11Invoice arg_conv;
80283         arg_conv.inner = untag_ptr(arg);
80284         arg_conv.is_owned = ptr_is_owned(arg);
80285         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80286         arg_conv.is_owned = false;
80287         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
80288         return ret_conv;
80289 }
80290
80291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80292         LDKSignedRawBolt11Invoice orig_conv;
80293         orig_conv.inner = untag_ptr(orig);
80294         orig_conv.is_owned = ptr_is_owned(orig);
80295         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80296         orig_conv.is_owned = false;
80297         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
80298         int64_t ret_ref = 0;
80299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80301         return ret_ref;
80302 }
80303
80304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
80305         LDKSignedRawBolt11Invoice o_conv;
80306         o_conv.inner = untag_ptr(o);
80307         o_conv.is_owned = ptr_is_owned(o);
80308         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
80309         o_conv.is_owned = false;
80310         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
80311         return ret_conv;
80312 }
80313
80314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80315         LDKRawBolt11Invoice this_obj_conv;
80316         this_obj_conv.inner = untag_ptr(this_obj);
80317         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80319         RawBolt11Invoice_free(this_obj_conv);
80320 }
80321
80322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
80323         LDKRawBolt11Invoice this_ptr_conv;
80324         this_ptr_conv.inner = untag_ptr(this_ptr);
80325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80327         this_ptr_conv.is_owned = false;
80328         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
80329         int64_t ret_ref = 0;
80330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80332         return ret_ref;
80333 }
80334
80335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80336         LDKRawBolt11Invoice this_ptr_conv;
80337         this_ptr_conv.inner = untag_ptr(this_ptr);
80338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80340         this_ptr_conv.is_owned = false;
80341         LDKRawDataPart val_conv;
80342         val_conv.inner = untag_ptr(val);
80343         val_conv.is_owned = ptr_is_owned(val);
80344         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
80345         val_conv = RawDataPart_clone(&val_conv);
80346         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
80347 }
80348
80349 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80350         LDKRawBolt11Invoice a_conv;
80351         a_conv.inner = untag_ptr(a);
80352         a_conv.is_owned = ptr_is_owned(a);
80353         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80354         a_conv.is_owned = false;
80355         LDKRawBolt11Invoice b_conv;
80356         b_conv.inner = untag_ptr(b);
80357         b_conv.is_owned = ptr_is_owned(b);
80358         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80359         b_conv.is_owned = false;
80360         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
80361         return ret_conv;
80362 }
80363
80364 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
80365         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
80366         int64_t ret_ref = 0;
80367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80369         return ret_ref;
80370 }
80371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80372         LDKRawBolt11Invoice arg_conv;
80373         arg_conv.inner = untag_ptr(arg);
80374         arg_conv.is_owned = ptr_is_owned(arg);
80375         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80376         arg_conv.is_owned = false;
80377         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
80378         return ret_conv;
80379 }
80380
80381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80382         LDKRawBolt11Invoice orig_conv;
80383         orig_conv.inner = untag_ptr(orig);
80384         orig_conv.is_owned = ptr_is_owned(orig);
80385         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80386         orig_conv.is_owned = false;
80387         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
80388         int64_t ret_ref = 0;
80389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80391         return ret_ref;
80392 }
80393
80394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
80395         LDKRawBolt11Invoice o_conv;
80396         o_conv.inner = untag_ptr(o);
80397         o_conv.is_owned = ptr_is_owned(o);
80398         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
80399         o_conv.is_owned = false;
80400         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
80401         return ret_conv;
80402 }
80403
80404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80405         LDKRawDataPart this_obj_conv;
80406         this_obj_conv.inner = untag_ptr(this_obj);
80407         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80409         RawDataPart_free(this_obj_conv);
80410 }
80411
80412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
80413         LDKRawDataPart this_ptr_conv;
80414         this_ptr_conv.inner = untag_ptr(this_ptr);
80415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80417         this_ptr_conv.is_owned = false;
80418         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
80419         int64_t ret_ref = 0;
80420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80422         return ret_ref;
80423 }
80424
80425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80426         LDKRawDataPart this_ptr_conv;
80427         this_ptr_conv.inner = untag_ptr(this_ptr);
80428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80430         this_ptr_conv.is_owned = false;
80431         LDKPositiveTimestamp val_conv;
80432         val_conv.inner = untag_ptr(val);
80433         val_conv.is_owned = ptr_is_owned(val);
80434         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
80435         val_conv = PositiveTimestamp_clone(&val_conv);
80436         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
80437 }
80438
80439 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80440         LDKRawDataPart a_conv;
80441         a_conv.inner = untag_ptr(a);
80442         a_conv.is_owned = ptr_is_owned(a);
80443         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80444         a_conv.is_owned = false;
80445         LDKRawDataPart b_conv;
80446         b_conv.inner = untag_ptr(b);
80447         b_conv.is_owned = ptr_is_owned(b);
80448         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80449         b_conv.is_owned = false;
80450         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
80451         return ret_conv;
80452 }
80453
80454 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
80455         LDKRawDataPart ret_var = RawDataPart_clone(arg);
80456         int64_t ret_ref = 0;
80457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80459         return ret_ref;
80460 }
80461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80462         LDKRawDataPart arg_conv;
80463         arg_conv.inner = untag_ptr(arg);
80464         arg_conv.is_owned = ptr_is_owned(arg);
80465         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80466         arg_conv.is_owned = false;
80467         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
80468         return ret_conv;
80469 }
80470
80471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80472         LDKRawDataPart orig_conv;
80473         orig_conv.inner = untag_ptr(orig);
80474         orig_conv.is_owned = ptr_is_owned(orig);
80475         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80476         orig_conv.is_owned = false;
80477         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
80478         int64_t ret_ref = 0;
80479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80481         return ret_ref;
80482 }
80483
80484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1hash(JNIEnv *env, jclass clz, int64_t o) {
80485         LDKRawDataPart o_conv;
80486         o_conv.inner = untag_ptr(o);
80487         o_conv.is_owned = ptr_is_owned(o);
80488         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
80489         o_conv.is_owned = false;
80490         int64_t ret_conv = RawDataPart_hash(&o_conv);
80491         return ret_conv;
80492 }
80493
80494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80495         LDKPositiveTimestamp this_obj_conv;
80496         this_obj_conv.inner = untag_ptr(this_obj);
80497         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80499         PositiveTimestamp_free(this_obj_conv);
80500 }
80501
80502 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80503         LDKPositiveTimestamp a_conv;
80504         a_conv.inner = untag_ptr(a);
80505         a_conv.is_owned = ptr_is_owned(a);
80506         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80507         a_conv.is_owned = false;
80508         LDKPositiveTimestamp b_conv;
80509         b_conv.inner = untag_ptr(b);
80510         b_conv.is_owned = ptr_is_owned(b);
80511         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80512         b_conv.is_owned = false;
80513         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
80514         return ret_conv;
80515 }
80516
80517 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
80518         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
80519         int64_t ret_ref = 0;
80520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80522         return ret_ref;
80523 }
80524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80525         LDKPositiveTimestamp arg_conv;
80526         arg_conv.inner = untag_ptr(arg);
80527         arg_conv.is_owned = ptr_is_owned(arg);
80528         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80529         arg_conv.is_owned = false;
80530         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
80531         return ret_conv;
80532 }
80533
80534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80535         LDKPositiveTimestamp orig_conv;
80536         orig_conv.inner = untag_ptr(orig);
80537         orig_conv.is_owned = ptr_is_owned(orig);
80538         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80539         orig_conv.is_owned = false;
80540         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
80541         int64_t ret_ref = 0;
80542         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80543         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80544         return ret_ref;
80545 }
80546
80547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1hash(JNIEnv *env, jclass clz, int64_t o) {
80548         LDKPositiveTimestamp o_conv;
80549         o_conv.inner = untag_ptr(o);
80550         o_conv.is_owned = ptr_is_owned(o);
80551         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
80552         o_conv.is_owned = false;
80553         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
80554         return ret_conv;
80555 }
80556
80557 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80558         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
80559         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
80560         return ret_conv;
80561 }
80562
80563 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
80564         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
80565         return ret_conv;
80566 }
80567
80568 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
80569         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
80570         return ret_conv;
80571 }
80572
80573 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
80574         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
80575         return ret_conv;
80576 }
80577
80578 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
80579         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
80580         return ret_conv;
80581 }
80582
80583 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80584         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
80585         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
80586         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
80587         return ret_conv;
80588 }
80589
80590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1hash(JNIEnv *env, jclass clz, int64_t o) {
80591         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
80592         int64_t ret_conv = SiPrefix_hash(o_conv);
80593         return ret_conv;
80594 }
80595
80596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
80597         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
80598         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
80599         return ret_conv;
80600 }
80601
80602 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80603         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
80604         jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
80605         return ret_conv;
80606 }
80607
80608 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
80609         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
80610         return ret_conv;
80611 }
80612
80613 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
80614         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
80615         return ret_conv;
80616 }
80617
80618 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
80619         jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
80620         return ret_conv;
80621 }
80622
80623 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
80624         jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
80625         return ret_conv;
80626 }
80627
80628 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
80629         jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
80630         return ret_conv;
80631 }
80632
80633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
80634         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
80635         int64_t ret_conv = Currency_hash(o_conv);
80636         return ret_conv;
80637 }
80638
80639 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80640         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
80641         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
80642         jboolean ret_conv = Currency_eq(a_conv, b_conv);
80643         return ret_conv;
80644 }
80645
80646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80647         LDKSha256 this_obj_conv;
80648         this_obj_conv.inner = untag_ptr(this_obj);
80649         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80651         Sha256_free(this_obj_conv);
80652 }
80653
80654 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
80655         LDKSha256 ret_var = Sha256_clone(arg);
80656         int64_t ret_ref = 0;
80657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80659         return ret_ref;
80660 }
80661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80662         LDKSha256 arg_conv;
80663         arg_conv.inner = untag_ptr(arg);
80664         arg_conv.is_owned = ptr_is_owned(arg);
80665         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80666         arg_conv.is_owned = false;
80667         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
80668         return ret_conv;
80669 }
80670
80671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80672         LDKSha256 orig_conv;
80673         orig_conv.inner = untag_ptr(orig);
80674         orig_conv.is_owned = ptr_is_owned(orig);
80675         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80676         orig_conv.is_owned = false;
80677         LDKSha256 ret_var = Sha256_clone(&orig_conv);
80678         int64_t ret_ref = 0;
80679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80681         return ret_ref;
80682 }
80683
80684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
80685         LDKSha256 o_conv;
80686         o_conv.inner = untag_ptr(o);
80687         o_conv.is_owned = ptr_is_owned(o);
80688         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
80689         o_conv.is_owned = false;
80690         int64_t ret_conv = Sha256_hash(&o_conv);
80691         return ret_conv;
80692 }
80693
80694 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80695         LDKSha256 a_conv;
80696         a_conv.inner = untag_ptr(a);
80697         a_conv.is_owned = ptr_is_owned(a);
80698         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80699         a_conv.is_owned = false;
80700         LDKSha256 b_conv;
80701         b_conv.inner = untag_ptr(b);
80702         b_conv.is_owned = ptr_is_owned(b);
80703         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80704         b_conv.is_owned = false;
80705         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
80706         return ret_conv;
80707 }
80708
80709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1from_1bytes(JNIEnv *env, jclass clz, int8_tArray bytes) {
80710         uint8_t bytes_arr[32];
80711         CHECK((*env)->GetArrayLength(env, bytes) == 32);
80712         (*env)->GetByteArrayRegion(env, bytes, 0, 32, bytes_arr);
80713         uint8_t (*bytes_ref)[32] = &bytes_arr;
80714         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
80715         int64_t ret_ref = 0;
80716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80718         return ret_ref;
80719 }
80720
80721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80722         LDKDescription this_obj_conv;
80723         this_obj_conv.inner = untag_ptr(this_obj);
80724         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80726         Description_free(this_obj_conv);
80727 }
80728
80729 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
80730         LDKDescription ret_var = Description_clone(arg);
80731         int64_t ret_ref = 0;
80732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80734         return ret_ref;
80735 }
80736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80737         LDKDescription arg_conv;
80738         arg_conv.inner = untag_ptr(arg);
80739         arg_conv.is_owned = ptr_is_owned(arg);
80740         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80741         arg_conv.is_owned = false;
80742         int64_t ret_conv = Description_clone_ptr(&arg_conv);
80743         return ret_conv;
80744 }
80745
80746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80747         LDKDescription orig_conv;
80748         orig_conv.inner = untag_ptr(orig);
80749         orig_conv.is_owned = ptr_is_owned(orig);
80750         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80751         orig_conv.is_owned = false;
80752         LDKDescription ret_var = Description_clone(&orig_conv);
80753         int64_t ret_ref = 0;
80754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80756         return ret_ref;
80757 }
80758
80759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
80760         LDKDescription o_conv;
80761         o_conv.inner = untag_ptr(o);
80762         o_conv.is_owned = ptr_is_owned(o);
80763         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
80764         o_conv.is_owned = false;
80765         int64_t ret_conv = Description_hash(&o_conv);
80766         return ret_conv;
80767 }
80768
80769 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80770         LDKDescription a_conv;
80771         a_conv.inner = untag_ptr(a);
80772         a_conv.is_owned = ptr_is_owned(a);
80773         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80774         a_conv.is_owned = false;
80775         LDKDescription b_conv;
80776         b_conv.inner = untag_ptr(b);
80777         b_conv.is_owned = ptr_is_owned(b);
80778         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80779         b_conv.is_owned = false;
80780         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
80781         return ret_conv;
80782 }
80783
80784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80785         LDKPayeePubKey this_obj_conv;
80786         this_obj_conv.inner = untag_ptr(this_obj);
80787         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80789         PayeePubKey_free(this_obj_conv);
80790 }
80791
80792 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
80793         LDKPayeePubKey this_ptr_conv;
80794         this_ptr_conv.inner = untag_ptr(this_ptr);
80795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80797         this_ptr_conv.is_owned = false;
80798         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
80799         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
80800         return ret_arr;
80801 }
80802
80803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
80804         LDKPayeePubKey this_ptr_conv;
80805         this_ptr_conv.inner = untag_ptr(this_ptr);
80806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80808         this_ptr_conv.is_owned = false;
80809         LDKPublicKey val_ref;
80810         CHECK((*env)->GetArrayLength(env, val) == 33);
80811         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
80812         PayeePubKey_set_a(&this_ptr_conv, val_ref);
80813 }
80814
80815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
80816         LDKPublicKey a_arg_ref;
80817         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
80818         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
80819         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
80820         int64_t ret_ref = 0;
80821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80823         return ret_ref;
80824 }
80825
80826 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
80827         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
80828         int64_t ret_ref = 0;
80829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80831         return ret_ref;
80832 }
80833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80834         LDKPayeePubKey arg_conv;
80835         arg_conv.inner = untag_ptr(arg);
80836         arg_conv.is_owned = ptr_is_owned(arg);
80837         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80838         arg_conv.is_owned = false;
80839         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
80840         return ret_conv;
80841 }
80842
80843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80844         LDKPayeePubKey orig_conv;
80845         orig_conv.inner = untag_ptr(orig);
80846         orig_conv.is_owned = ptr_is_owned(orig);
80847         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80848         orig_conv.is_owned = false;
80849         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
80850         int64_t ret_ref = 0;
80851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80853         return ret_ref;
80854 }
80855
80856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
80857         LDKPayeePubKey o_conv;
80858         o_conv.inner = untag_ptr(o);
80859         o_conv.is_owned = ptr_is_owned(o);
80860         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
80861         o_conv.is_owned = false;
80862         int64_t ret_conv = PayeePubKey_hash(&o_conv);
80863         return ret_conv;
80864 }
80865
80866 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80867         LDKPayeePubKey a_conv;
80868         a_conv.inner = untag_ptr(a);
80869         a_conv.is_owned = ptr_is_owned(a);
80870         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80871         a_conv.is_owned = false;
80872         LDKPayeePubKey b_conv;
80873         b_conv.inner = untag_ptr(b);
80874         b_conv.is_owned = ptr_is_owned(b);
80875         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80876         b_conv.is_owned = false;
80877         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
80878         return ret_conv;
80879 }
80880
80881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80882         LDKExpiryTime this_obj_conv;
80883         this_obj_conv.inner = untag_ptr(this_obj);
80884         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80886         ExpiryTime_free(this_obj_conv);
80887 }
80888
80889 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
80890         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
80891         int64_t ret_ref = 0;
80892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80894         return ret_ref;
80895 }
80896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80897         LDKExpiryTime arg_conv;
80898         arg_conv.inner = untag_ptr(arg);
80899         arg_conv.is_owned = ptr_is_owned(arg);
80900         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80901         arg_conv.is_owned = false;
80902         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
80903         return ret_conv;
80904 }
80905
80906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80907         LDKExpiryTime orig_conv;
80908         orig_conv.inner = untag_ptr(orig);
80909         orig_conv.is_owned = ptr_is_owned(orig);
80910         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80911         orig_conv.is_owned = false;
80912         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
80913         int64_t ret_ref = 0;
80914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80916         return ret_ref;
80917 }
80918
80919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
80920         LDKExpiryTime o_conv;
80921         o_conv.inner = untag_ptr(o);
80922         o_conv.is_owned = ptr_is_owned(o);
80923         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
80924         o_conv.is_owned = false;
80925         int64_t ret_conv = ExpiryTime_hash(&o_conv);
80926         return ret_conv;
80927 }
80928
80929 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80930         LDKExpiryTime a_conv;
80931         a_conv.inner = untag_ptr(a);
80932         a_conv.is_owned = ptr_is_owned(a);
80933         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80934         a_conv.is_owned = false;
80935         LDKExpiryTime b_conv;
80936         b_conv.inner = untag_ptr(b);
80937         b_conv.is_owned = ptr_is_owned(b);
80938         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80939         b_conv.is_owned = false;
80940         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
80941         return ret_conv;
80942 }
80943
80944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80945         LDKMinFinalCltvExpiryDelta this_obj_conv;
80946         this_obj_conv.inner = untag_ptr(this_obj);
80947         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80949         MinFinalCltvExpiryDelta_free(this_obj_conv);
80950 }
80951
80952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
80953         LDKMinFinalCltvExpiryDelta this_ptr_conv;
80954         this_ptr_conv.inner = untag_ptr(this_ptr);
80955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80957         this_ptr_conv.is_owned = false;
80958         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
80959         return ret_conv;
80960 }
80961
80962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80963         LDKMinFinalCltvExpiryDelta this_ptr_conv;
80964         this_ptr_conv.inner = untag_ptr(this_ptr);
80965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80967         this_ptr_conv.is_owned = false;
80968         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
80969 }
80970
80971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
80972         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
80973         int64_t ret_ref = 0;
80974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80976         return ret_ref;
80977 }
80978
80979 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
80980         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
80981         int64_t ret_ref = 0;
80982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80984         return ret_ref;
80985 }
80986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80987         LDKMinFinalCltvExpiryDelta arg_conv;
80988         arg_conv.inner = untag_ptr(arg);
80989         arg_conv.is_owned = ptr_is_owned(arg);
80990         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80991         arg_conv.is_owned = false;
80992         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
80993         return ret_conv;
80994 }
80995
80996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80997         LDKMinFinalCltvExpiryDelta orig_conv;
80998         orig_conv.inner = untag_ptr(orig);
80999         orig_conv.is_owned = ptr_is_owned(orig);
81000         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81001         orig_conv.is_owned = false;
81002         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
81003         int64_t ret_ref = 0;
81004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81006         return ret_ref;
81007 }
81008
81009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1hash(JNIEnv *env, jclass clz, int64_t o) {
81010         LDKMinFinalCltvExpiryDelta o_conv;
81011         o_conv.inner = untag_ptr(o);
81012         o_conv.is_owned = ptr_is_owned(o);
81013         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81014         o_conv.is_owned = false;
81015         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
81016         return ret_conv;
81017 }
81018
81019 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
81020         LDKMinFinalCltvExpiryDelta a_conv;
81021         a_conv.inner = untag_ptr(a);
81022         a_conv.is_owned = ptr_is_owned(a);
81023         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81024         a_conv.is_owned = false;
81025         LDKMinFinalCltvExpiryDelta b_conv;
81026         b_conv.inner = untag_ptr(b);
81027         b_conv.is_owned = ptr_is_owned(b);
81028         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81029         b_conv.is_owned = false;
81030         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
81031         return ret_conv;
81032 }
81033
81034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
81035         if (!ptr_is_owned(this_ptr)) return;
81036         void* this_ptr_ptr = untag_ptr(this_ptr);
81037         CHECK_ACCESS(this_ptr_ptr);
81038         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
81039         FREE(untag_ptr(this_ptr));
81040         Fallback_free(this_ptr_conv);
81041 }
81042
81043 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
81044         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
81045         *ret_copy = Fallback_clone(arg);
81046         int64_t ret_ref = tag_ptr(ret_copy, true);
81047         return ret_ref;
81048 }
81049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
81050         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
81051         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
81052         return ret_conv;
81053 }
81054
81055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81056         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
81057         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
81058         *ret_copy = Fallback_clone(orig_conv);
81059         int64_t ret_ref = tag_ptr(ret_copy, true);
81060         return ret_ref;
81061 }
81062
81063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
81064         
81065         LDKCVec_u8Z program_ref;
81066         program_ref.datalen = (*env)->GetArrayLength(env, program);
81067         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
81068         (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
81069         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
81070         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
81071         int64_t ret_ref = tag_ptr(ret_copy, true);
81072         return ret_ref;
81073 }
81074
81075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
81076         LDKTwentyBytes a_ref;
81077         CHECK((*env)->GetArrayLength(env, a) == 20);
81078         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
81079         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
81080         *ret_copy = Fallback_pub_key_hash(a_ref);
81081         int64_t ret_ref = tag_ptr(ret_copy, true);
81082         return ret_ref;
81083 }
81084
81085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
81086         LDKTwentyBytes a_ref;
81087         CHECK((*env)->GetArrayLength(env, a) == 20);
81088         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
81089         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
81090         *ret_copy = Fallback_script_hash(a_ref);
81091         int64_t ret_ref = tag_ptr(ret_copy, true);
81092         return ret_ref;
81093 }
81094
81095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
81096         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
81097         int64_t ret_conv = Fallback_hash(o_conv);
81098         return ret_conv;
81099 }
81100
81101 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
81102         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
81103         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
81104         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
81105         return ret_conv;
81106 }
81107
81108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
81109         LDKBolt11InvoiceSignature this_obj_conv;
81110         this_obj_conv.inner = untag_ptr(this_obj);
81111         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81113         Bolt11InvoiceSignature_free(this_obj_conv);
81114 }
81115
81116 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
81117         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
81118         int64_t ret_ref = 0;
81119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81121         return ret_ref;
81122 }
81123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
81124         LDKBolt11InvoiceSignature arg_conv;
81125         arg_conv.inner = untag_ptr(arg);
81126         arg_conv.is_owned = ptr_is_owned(arg);
81127         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81128         arg_conv.is_owned = false;
81129         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
81130         return ret_conv;
81131 }
81132
81133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81134         LDKBolt11InvoiceSignature orig_conv;
81135         orig_conv.inner = untag_ptr(orig);
81136         orig_conv.is_owned = ptr_is_owned(orig);
81137         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81138         orig_conv.is_owned = false;
81139         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
81140         int64_t ret_ref = 0;
81141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81143         return ret_ref;
81144 }
81145
81146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1hash(JNIEnv *env, jclass clz, int64_t o) {
81147         LDKBolt11InvoiceSignature o_conv;
81148         o_conv.inner = untag_ptr(o);
81149         o_conv.is_owned = ptr_is_owned(o);
81150         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81151         o_conv.is_owned = false;
81152         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
81153         return ret_conv;
81154 }
81155
81156 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
81157         LDKBolt11InvoiceSignature a_conv;
81158         a_conv.inner = untag_ptr(a);
81159         a_conv.is_owned = ptr_is_owned(a);
81160         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81161         a_conv.is_owned = false;
81162         LDKBolt11InvoiceSignature b_conv;
81163         b_conv.inner = untag_ptr(b);
81164         b_conv.is_owned = ptr_is_owned(b);
81165         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81166         b_conv.is_owned = false;
81167         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
81168         return ret_conv;
81169 }
81170
81171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
81172         LDKPrivateRoute this_obj_conv;
81173         this_obj_conv.inner = untag_ptr(this_obj);
81174         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81176         PrivateRoute_free(this_obj_conv);
81177 }
81178
81179 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
81180         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
81181         int64_t ret_ref = 0;
81182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81184         return ret_ref;
81185 }
81186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
81187         LDKPrivateRoute arg_conv;
81188         arg_conv.inner = untag_ptr(arg);
81189         arg_conv.is_owned = ptr_is_owned(arg);
81190         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81191         arg_conv.is_owned = false;
81192         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
81193         return ret_conv;
81194 }
81195
81196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81197         LDKPrivateRoute orig_conv;
81198         orig_conv.inner = untag_ptr(orig);
81199         orig_conv.is_owned = ptr_is_owned(orig);
81200         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81201         orig_conv.is_owned = false;
81202         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
81203         int64_t ret_ref = 0;
81204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81206         return ret_ref;
81207 }
81208
81209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
81210         LDKPrivateRoute o_conv;
81211         o_conv.inner = untag_ptr(o);
81212         o_conv.is_owned = ptr_is_owned(o);
81213         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81214         o_conv.is_owned = false;
81215         int64_t ret_conv = PrivateRoute_hash(&o_conv);
81216         return ret_conv;
81217 }
81218
81219 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
81220         LDKPrivateRoute a_conv;
81221         a_conv.inner = untag_ptr(a);
81222         a_conv.is_owned = ptr_is_owned(a);
81223         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81224         a_conv.is_owned = false;
81225         LDKPrivateRoute b_conv;
81226         b_conv.inner = untag_ptr(b);
81227         b_conv.is_owned = ptr_is_owned(b);
81228         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81229         b_conv.is_owned = false;
81230         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
81231         return ret_conv;
81232 }
81233
81234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
81235         LDKSignedRawBolt11Invoice this_arg_conv;
81236         this_arg_conv.inner = untag_ptr(this_arg);
81237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81239         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
81240         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
81241         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
81242         return tag_ptr(ret_conv, true);
81243 }
81244
81245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
81246         LDKSignedRawBolt11Invoice this_arg_conv;
81247         this_arg_conv.inner = untag_ptr(this_arg);
81248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81250         this_arg_conv.is_owned = false;
81251         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
81252         int64_t ret_ref = 0;
81253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81255         return ret_ref;
81256 }
81257
81258 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
81259         LDKSignedRawBolt11Invoice this_arg_conv;
81260         this_arg_conv.inner = untag_ptr(this_arg);
81261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81263         this_arg_conv.is_owned = false;
81264         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
81265         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv));
81266         return ret_arr;
81267 }
81268
81269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
81270         LDKSignedRawBolt11Invoice this_arg_conv;
81271         this_arg_conv.inner = untag_ptr(this_arg);
81272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81274         this_arg_conv.is_owned = false;
81275         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
81276         int64_t ret_ref = 0;
81277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81279         return ret_ref;
81280 }
81281
81282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
81283         LDKSignedRawBolt11Invoice this_arg_conv;
81284         this_arg_conv.inner = untag_ptr(this_arg);
81285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81287         this_arg_conv.is_owned = false;
81288         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
81289         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
81290         return tag_ptr(ret_conv, true);
81291 }
81292
81293 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
81294         LDKSignedRawBolt11Invoice this_arg_conv;
81295         this_arg_conv.inner = untag_ptr(this_arg);
81296         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81298         this_arg_conv.is_owned = false;
81299         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
81300         return ret_conv;
81301 }
81302
81303 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
81304         LDKRawBolt11Invoice this_arg_conv;
81305         this_arg_conv.inner = untag_ptr(this_arg);
81306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81308         this_arg_conv.is_owned = false;
81309         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
81310         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawBolt11Invoice_signable_hash(&this_arg_conv).data);
81311         return ret_arr;
81312 }
81313
81314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
81315         LDKRawBolt11Invoice this_arg_conv;
81316         this_arg_conv.inner = untag_ptr(this_arg);
81317         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81319         this_arg_conv.is_owned = false;
81320         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
81321         int64_t ret_ref = 0;
81322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81324         return ret_ref;
81325 }
81326
81327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
81328         LDKRawBolt11Invoice this_arg_conv;
81329         this_arg_conv.inner = untag_ptr(this_arg);
81330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81332         this_arg_conv.is_owned = false;
81333         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
81334         int64_t ret_ref = 0;
81335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81337         return ret_ref;
81338 }
81339
81340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
81341         LDKRawBolt11Invoice this_arg_conv;
81342         this_arg_conv.inner = untag_ptr(this_arg);
81343         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81345         this_arg_conv.is_owned = false;
81346         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
81347         int64_t ret_ref = 0;
81348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81350         return ret_ref;
81351 }
81352
81353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
81354         LDKRawBolt11Invoice this_arg_conv;
81355         this_arg_conv.inner = untag_ptr(this_arg);
81356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81358         this_arg_conv.is_owned = false;
81359         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
81360         int64_t ret_ref = 0;
81361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81363         return ret_ref;
81364 }
81365
81366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
81367         LDKRawBolt11Invoice this_arg_conv;
81368         this_arg_conv.inner = untag_ptr(this_arg);
81369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81371         this_arg_conv.is_owned = false;
81372         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
81373         int64_t ret_ref = 0;
81374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81376         return ret_ref;
81377 }
81378
81379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
81380         LDKRawBolt11Invoice this_arg_conv;
81381         this_arg_conv.inner = untag_ptr(this_arg);
81382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81384         this_arg_conv.is_owned = false;
81385         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
81386         int64_t ret_ref = 0;
81387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81389         return ret_ref;
81390 }
81391
81392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
81393         LDKRawBolt11Invoice this_arg_conv;
81394         this_arg_conv.inner = untag_ptr(this_arg);
81395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81397         this_arg_conv.is_owned = false;
81398         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
81399         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
81400         int64_t ret_ref = tag_ptr(ret_copy, true);
81401         return ret_ref;
81402 }
81403
81404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
81405         LDKRawBolt11Invoice this_arg_conv;
81406         this_arg_conv.inner = untag_ptr(this_arg);
81407         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81409         this_arg_conv.is_owned = false;
81410         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
81411         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
81412         int64_t ret_ref = tag_ptr(ret_copy, true);
81413         return ret_ref;
81414 }
81415
81416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
81417         LDKRawBolt11Invoice this_arg_conv;
81418         this_arg_conv.inner = untag_ptr(this_arg);
81419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81421         this_arg_conv.is_owned = false;
81422         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
81423         int64_t ret_ref = 0;
81424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81426         return ret_ref;
81427 }
81428
81429 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
81430         LDKRawBolt11Invoice this_arg_conv;
81431         this_arg_conv.inner = untag_ptr(this_arg);
81432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81434         this_arg_conv.is_owned = false;
81435         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
81436         int64_tArray ret_arr = NULL;
81437         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
81438         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
81439         for (size_t o = 0; o < ret_var.datalen; o++) {
81440                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
81441                 int64_t ret_conv_14_ref = 0;
81442                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
81443                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
81444                 ret_arr_ptr[o] = ret_conv_14_ref;
81445         }
81446         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
81447         FREE(ret_var.data);
81448         return ret_arr;
81449 }
81450
81451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
81452         LDKRawBolt11Invoice this_arg_conv;
81453         this_arg_conv.inner = untag_ptr(this_arg);
81454         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81456         this_arg_conv.is_owned = false;
81457         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
81458         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
81459         int64_t ret_ref = tag_ptr(ret_copy, true);
81460         return ret_ref;
81461 }
81462
81463 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
81464         LDKRawBolt11Invoice this_arg_conv;
81465         this_arg_conv.inner = untag_ptr(this_arg);
81466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81468         this_arg_conv.is_owned = false;
81469         jclass ret_conv = LDKCurrency_to_java(env, RawBolt11Invoice_currency(&this_arg_conv));
81470         return ret_conv;
81471 }
81472
81473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
81474         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
81475         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
81476         return tag_ptr(ret_conv, true);
81477 }
81478
81479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
81480         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
81481         *ret_conv = PositiveTimestamp_from_system_time(time);
81482         return tag_ptr(ret_conv, true);
81483 }
81484
81485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
81486         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
81487         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
81488         return tag_ptr(ret_conv, true);
81489 }
81490
81491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
81492         LDKPositiveTimestamp this_arg_conv;
81493         this_arg_conv.inner = untag_ptr(this_arg);
81494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81496         this_arg_conv.is_owned = false;
81497         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
81498         return ret_conv;
81499 }
81500
81501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
81502         LDKPositiveTimestamp this_arg_conv;
81503         this_arg_conv.inner = untag_ptr(this_arg);
81504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81506         this_arg_conv.is_owned = false;
81507         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
81508         return ret_conv;
81509 }
81510
81511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
81512         LDKPositiveTimestamp this_arg_conv;
81513         this_arg_conv.inner = untag_ptr(this_arg);
81514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81516         this_arg_conv.is_owned = false;
81517         int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
81518         return ret_conv;
81519 }
81520
81521 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
81522         LDKBolt11Invoice this_arg_conv;
81523         this_arg_conv.inner = untag_ptr(this_arg);
81524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81526         this_arg_conv.is_owned = false;
81527         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
81528         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt11Invoice_signable_hash(&this_arg_conv).data);
81529         return ret_arr;
81530 }
81531
81532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
81533         LDKBolt11Invoice this_arg_conv;
81534         this_arg_conv.inner = untag_ptr(this_arg);
81535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81537         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
81538         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
81539         int64_t ret_ref = 0;
81540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81542         return ret_ref;
81543 }
81544
81545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
81546         LDKBolt11Invoice this_arg_conv;
81547         this_arg_conv.inner = untag_ptr(this_arg);
81548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81550         this_arg_conv.is_owned = false;
81551         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
81552         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
81553         return tag_ptr(ret_conv, true);
81554 }
81555
81556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
81557         LDKSignedRawBolt11Invoice signed_invoice_conv;
81558         signed_invoice_conv.inner = untag_ptr(signed_invoice);
81559         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
81560         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
81561         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
81562         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
81563         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
81564         return tag_ptr(ret_conv, true);
81565 }
81566
81567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
81568         LDKBolt11Invoice this_arg_conv;
81569         this_arg_conv.inner = untag_ptr(this_arg);
81570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81572         this_arg_conv.is_owned = false;
81573         int64_t ret_conv = Bolt11Invoice_timestamp(&this_arg_conv);
81574         return ret_conv;
81575 }
81576
81577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
81578         LDKBolt11Invoice this_arg_conv;
81579         this_arg_conv.inner = untag_ptr(this_arg);
81580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81582         this_arg_conv.is_owned = false;
81583         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
81584         return ret_conv;
81585 }
81586
81587 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
81588         LDKBolt11Invoice this_arg_conv;
81589         this_arg_conv.inner = untag_ptr(this_arg);
81590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81592         this_arg_conv.is_owned = false;
81593         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
81594         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Bolt11Invoice_payment_hash(&this_arg_conv));
81595         return ret_arr;
81596 }
81597
81598 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
81599         LDKBolt11Invoice this_arg_conv;
81600         this_arg_conv.inner = untag_ptr(this_arg);
81601         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81603         this_arg_conv.is_owned = false;
81604         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
81605         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form);
81606         return ret_arr;
81607 }
81608
81609 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
81610         LDKBolt11Invoice this_arg_conv;
81611         this_arg_conv.inner = untag_ptr(this_arg);
81612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81614         this_arg_conv.is_owned = false;
81615         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
81616         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Bolt11Invoice_payment_secret(&this_arg_conv));
81617         return ret_arr;
81618 }
81619
81620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
81621         LDKBolt11Invoice this_arg_conv;
81622         this_arg_conv.inner = untag_ptr(this_arg);
81623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81625         this_arg_conv.is_owned = false;
81626         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
81627         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
81628         int64_t ret_ref = tag_ptr(ret_copy, true);
81629         return ret_ref;
81630 }
81631
81632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
81633         LDKBolt11Invoice this_arg_conv;
81634         this_arg_conv.inner = untag_ptr(this_arg);
81635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81637         this_arg_conv.is_owned = false;
81638         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
81639         int64_t ret_ref = 0;
81640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81642         return ret_ref;
81643 }
81644
81645 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
81646         LDKBolt11Invoice this_arg_conv;
81647         this_arg_conv.inner = untag_ptr(this_arg);
81648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81650         this_arg_conv.is_owned = false;
81651         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
81652         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
81653         return ret_arr;
81654 }
81655
81656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expires_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
81657         LDKBolt11Invoice this_arg_conv;
81658         this_arg_conv.inner = untag_ptr(this_arg);
81659         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81661         this_arg_conv.is_owned = false;
81662         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
81663         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
81664         int64_t ret_ref = tag_ptr(ret_copy, true);
81665         return ret_ref;
81666 }
81667
81668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
81669         LDKBolt11Invoice this_arg_conv;
81670         this_arg_conv.inner = untag_ptr(this_arg);
81671         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81673         this_arg_conv.is_owned = false;
81674         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
81675         return ret_conv;
81676 }
81677
81678 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
81679         LDKBolt11Invoice this_arg_conv;
81680         this_arg_conv.inner = untag_ptr(this_arg);
81681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81683         this_arg_conv.is_owned = false;
81684         jboolean ret_conv = Bolt11Invoice_is_expired(&this_arg_conv);
81685         return ret_conv;
81686 }
81687
81688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1duration_1until_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
81689         LDKBolt11Invoice this_arg_conv;
81690         this_arg_conv.inner = untag_ptr(this_arg);
81691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81693         this_arg_conv.is_owned = false;
81694         int64_t ret_conv = Bolt11Invoice_duration_until_expiry(&this_arg_conv);
81695         return ret_conv;
81696 }
81697
81698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expiration_1remaining_1from_1epoch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t time) {
81699         LDKBolt11Invoice this_arg_conv;
81700         this_arg_conv.inner = untag_ptr(this_arg);
81701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81703         this_arg_conv.is_owned = false;
81704         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
81705         return ret_conv;
81706 }
81707
81708 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
81709         LDKBolt11Invoice this_arg_conv;
81710         this_arg_conv.inner = untag_ptr(this_arg);
81711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81713         this_arg_conv.is_owned = false;
81714         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
81715         return ret_conv;
81716 }
81717
81718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
81719         LDKBolt11Invoice this_arg_conv;
81720         this_arg_conv.inner = untag_ptr(this_arg);
81721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81723         this_arg_conv.is_owned = false;
81724         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
81725         return ret_conv;
81726 }
81727
81728 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1fallback_1addresses(JNIEnv *env, jclass clz, int64_t this_arg) {
81729         LDKBolt11Invoice this_arg_conv;
81730         this_arg_conv.inner = untag_ptr(this_arg);
81731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81733         this_arg_conv.is_owned = false;
81734         LDKCVec_StrZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
81735         jobjectArray ret_arr = NULL;
81736         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, String_clz, NULL);
81737         ;
81738         jstring *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
81739         for (size_t i = 0; i < ret_var.datalen; i++) {
81740                 LDKStr ret_conv_8_str = ret_var.data[i];
81741                 jstring ret_conv_8_conv = str_ref_to_java(env, ret_conv_8_str.chars, ret_conv_8_str.len);
81742                 Str_free(ret_conv_8_str);
81743                 ret_arr_ptr[i] = ret_conv_8_conv;
81744         }
81745         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
81746         FREE(ret_var.data);
81747         return ret_arr;
81748 }
81749
81750 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
81751         LDKBolt11Invoice this_arg_conv;
81752         this_arg_conv.inner = untag_ptr(this_arg);
81753         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81755         this_arg_conv.is_owned = false;
81756         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
81757         int64_tArray ret_arr = NULL;
81758         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
81759         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
81760         for (size_t o = 0; o < ret_var.datalen; o++) {
81761                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
81762                 int64_t ret_conv_14_ref = 0;
81763                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
81764                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
81765                 ret_arr_ptr[o] = ret_conv_14_ref;
81766         }
81767         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
81768         FREE(ret_var.data);
81769         return ret_arr;
81770 }
81771
81772 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
81773         LDKBolt11Invoice this_arg_conv;
81774         this_arg_conv.inner = untag_ptr(this_arg);
81775         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81777         this_arg_conv.is_owned = false;
81778         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
81779         int64_tArray ret_arr = NULL;
81780         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
81781         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
81782         for (size_t l = 0; l < ret_var.datalen; l++) {
81783                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
81784                 int64_t ret_conv_11_ref = 0;
81785                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
81786                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
81787                 ret_arr_ptr[l] = ret_conv_11_ref;
81788         }
81789         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
81790         FREE(ret_var.data);
81791         return ret_arr;
81792 }
81793
81794 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
81795         LDKBolt11Invoice this_arg_conv;
81796         this_arg_conv.inner = untag_ptr(this_arg);
81797         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81799         this_arg_conv.is_owned = false;
81800         jclass ret_conv = LDKCurrency_to_java(env, Bolt11Invoice_currency(&this_arg_conv));
81801         return ret_conv;
81802 }
81803
81804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
81805         LDKBolt11Invoice this_arg_conv;
81806         this_arg_conv.inner = untag_ptr(this_arg);
81807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81809         this_arg_conv.is_owned = false;
81810         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
81811         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
81812         int64_t ret_ref = tag_ptr(ret_copy, true);
81813         return ret_ref;
81814 }
81815
81816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
81817         LDKStr description_conv = java_to_owned_str(env, description);
81818         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
81819         *ret_conv = Description_new(description_conv);
81820         return tag_ptr(ret_conv, true);
81821 }
81822
81823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
81824         LDKDescription this_arg_conv;
81825         this_arg_conv.inner = untag_ptr(this_arg);
81826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81828         this_arg_conv = Description_clone(&this_arg_conv);
81829         LDKUntrustedString ret_var = Description_into_inner(this_arg_conv);
81830         int64_t ret_ref = 0;
81831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81833         return ret_ref;
81834 }
81835
81836 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
81837         LDKDescription o_conv;
81838         o_conv.inner = untag_ptr(o);
81839         o_conv.is_owned = ptr_is_owned(o);
81840         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
81841         o_conv.is_owned = false;
81842         LDKStr ret_str = Description_to_str(&o_conv);
81843         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
81844         Str_free(ret_str);
81845         return ret_conv;
81846 }
81847
81848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
81849         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
81850         int64_t ret_ref = 0;
81851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81853         return ret_ref;
81854 }
81855
81856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
81857         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
81858         int64_t ret_ref = 0;
81859         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81860         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81861         return ret_ref;
81862 }
81863
81864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
81865         LDKExpiryTime this_arg_conv;
81866         this_arg_conv.inner = untag_ptr(this_arg);
81867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81869         this_arg_conv.is_owned = false;
81870         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
81871         return ret_conv;
81872 }
81873
81874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
81875         LDKExpiryTime this_arg_conv;
81876         this_arg_conv.inner = untag_ptr(this_arg);
81877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81879         this_arg_conv.is_owned = false;
81880         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
81881         return ret_conv;
81882 }
81883
81884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
81885         LDKRouteHint hops_conv;
81886         hops_conv.inner = untag_ptr(hops);
81887         hops_conv.is_owned = ptr_is_owned(hops);
81888         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
81889         hops_conv = RouteHint_clone(&hops_conv);
81890         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
81891         *ret_conv = PrivateRoute_new(hops_conv);
81892         return tag_ptr(ret_conv, true);
81893 }
81894
81895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
81896         LDKPrivateRoute this_arg_conv;
81897         this_arg_conv.inner = untag_ptr(this_arg);
81898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81900         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
81901         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
81902         int64_t ret_ref = 0;
81903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81905         return ret_ref;
81906 }
81907
81908 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81909         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
81910         jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
81911         return ret_conv;
81912 }
81913
81914 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
81915         jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
81916         return ret_conv;
81917 }
81918
81919 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
81920         jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
81921         return ret_conv;
81922 }
81923
81924 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
81925         jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
81926         return ret_conv;
81927 }
81928
81929 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
81930         jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
81931         return ret_conv;
81932 }
81933
81934 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
81935         jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
81936         return ret_conv;
81937 }
81938
81939 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1min_1final_1cltv_1expiry_1delta_1too_1short(JNIEnv *env, jclass clz) {
81940         jclass ret_conv = LDKCreationError_to_java(env, CreationError_min_final_cltv_expiry_delta_too_short());
81941         return ret_conv;
81942 }
81943
81944 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
81945         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
81946         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
81947         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
81948         return ret_conv;
81949 }
81950
81951 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
81952         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
81953         LDKStr ret_str = CreationError_to_str(o_conv);
81954         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
81955         Str_free(ret_str);
81956         return ret_conv;
81957 }
81958
81959 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81960         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
81961         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_clone(orig_conv));
81962         return ret_conv;
81963 }
81964
81965 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
81966         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_payment_hash());
81967         return ret_conv;
81968 }
81969
81970 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
81971         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_payment_hashes());
81972         return ret_conv;
81973 }
81974
81975 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1description(JNIEnv *env, jclass clz) {
81976         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_description());
81977         return ret_conv;
81978 }
81979
81980 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
81981         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_descriptions());
81982         return ret_conv;
81983 }
81984
81985 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
81986         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_payment_secret());
81987         return ret_conv;
81988 }
81989
81990 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
81991         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_payment_secrets());
81992         return ret_conv;
81993 }
81994
81995 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
81996         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_features());
81997         return ret_conv;
81998 }
81999
82000 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
82001         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_recovery_id());
82002         return ret_conv;
82003 }
82004
82005 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
82006         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_signature());
82007         return ret_conv;
82008 }
82009
82010 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
82011         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_imprecise_amount());
82012         return ret_conv;
82013 }
82014
82015 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
82016         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
82017         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
82018         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
82019         return ret_conv;
82020 }
82021
82022 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
82023         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
82024         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
82025         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
82026         Str_free(ret_str);
82027         return ret_conv;
82028 }
82029
82030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82031         if (!ptr_is_owned(this_ptr)) return;
82032         void* this_ptr_ptr = untag_ptr(this_ptr);
82033         CHECK_ACCESS(this_ptr_ptr);
82034         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
82035         FREE(untag_ptr(this_ptr));
82036         SignOrCreationError_free(this_ptr_conv);
82037 }
82038
82039 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
82040         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
82041         *ret_copy = SignOrCreationError_clone(arg);
82042         int64_t ret_ref = tag_ptr(ret_copy, true);
82043         return ret_ref;
82044 }
82045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
82046         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
82047         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
82048         return ret_conv;
82049 }
82050
82051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82052         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
82053         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
82054         *ret_copy = SignOrCreationError_clone(orig_conv);
82055         int64_t ret_ref = tag_ptr(ret_copy, true);
82056         return ret_ref;
82057 }
82058
82059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
82060         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
82061         *ret_copy = SignOrCreationError_sign_error();
82062         int64_t ret_ref = tag_ptr(ret_copy, true);
82063         return ret_ref;
82064 }
82065
82066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
82067         LDKCreationError a_conv = LDKCreationError_from_java(env, a);
82068         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
82069         *ret_copy = SignOrCreationError_creation_error(a_conv);
82070         int64_t ret_ref = tag_ptr(ret_copy, true);
82071         return ret_ref;
82072 }
82073
82074 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
82075         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
82076         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
82077         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
82078         return ret_conv;
82079 }
82080
82081 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
82082         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
82083         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
82084         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
82085         Str_free(ret_str);
82086         return ret_conv;
82087 }
82088
82089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_payment_1parameters_1from_1zero_1amount_1invoice(JNIEnv *env, jclass clz, int64_t invoice, int64_t amount_msat) {
82090         LDKBolt11Invoice invoice_conv;
82091         invoice_conv.inner = untag_ptr(invoice);
82092         invoice_conv.is_owned = ptr_is_owned(invoice);
82093         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
82094         invoice_conv.is_owned = false;
82095         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
82096         *ret_conv = payment_parameters_from_zero_amount_invoice(&invoice_conv, amount_msat);
82097         return tag_ptr(ret_conv, true);
82098 }
82099
82100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_payment_1parameters_1from_1invoice(JNIEnv *env, jclass clz, int64_t invoice) {
82101         LDKBolt11Invoice invoice_conv;
82102         invoice_conv.inner = untag_ptr(invoice);
82103         invoice_conv.is_owned = ptr_is_owned(invoice);
82104         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
82105         invoice_conv.is_owned = false;
82106         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
82107         *ret_conv = payment_parameters_from_invoice(&invoice_conv);
82108         return tag_ptr(ret_conv, true);
82109 }
82110
82111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice(JNIEnv *env, jclass clz, int64_t amt_msat, int64_t payment_hash, jstring description, int32_t invoice_expiry_delta_secs, int64_tArray phantom_route_hints, int64_t entropy_source, int64_t node_signer, int64_t logger, jclass network, int64_t min_final_cltv_expiry_delta, int64_t duration_since_epoch) {
82112         void* amt_msat_ptr = untag_ptr(amt_msat);
82113         CHECK_ACCESS(amt_msat_ptr);
82114         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
82115         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
82116         void* payment_hash_ptr = untag_ptr(payment_hash);
82117         CHECK_ACCESS(payment_hash_ptr);
82118         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
82119         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
82120         LDKStr description_conv = java_to_owned_str(env, description);
82121         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
82122         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
82123         if (phantom_route_hints_constr.datalen > 0)
82124                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
82125         else
82126                 phantom_route_hints_constr.data = NULL;
82127         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
82128         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
82129                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
82130                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
82131                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
82132                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
82133                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
82134                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
82135                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
82136         }
82137         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
82138         void* entropy_source_ptr = untag_ptr(entropy_source);
82139         CHECK_ACCESS(entropy_source_ptr);
82140         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
82141         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
82142                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82143                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
82144         }
82145         void* node_signer_ptr = untag_ptr(node_signer);
82146         CHECK_ACCESS(node_signer_ptr);
82147         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
82148         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
82149                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82150                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
82151         }
82152         void* logger_ptr = untag_ptr(logger);
82153         CHECK_ACCESS(logger_ptr);
82154         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82155         if (logger_conv.free == LDKLogger_JCalls_free) {
82156                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82157                 LDKLogger_JCalls_cloned(&logger_conv);
82158         }
82159         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
82160         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
82161         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
82162         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
82163         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
82164         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
82165         *ret_conv = create_phantom_invoice(amt_msat_conv, payment_hash_conv, description_conv, invoice_expiry_delta_secs, phantom_route_hints_constr, entropy_source_conv, node_signer_conv, logger_conv, network_conv, min_final_cltv_expiry_delta_conv, duration_since_epoch);
82166         return tag_ptr(ret_conv, true);
82167 }
82168
82169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t amt_msat, int64_t payment_hash, int32_t invoice_expiry_delta_secs, int64_t description_hash, int64_tArray phantom_route_hints, int64_t entropy_source, int64_t node_signer, int64_t logger, jclass network, int64_t min_final_cltv_expiry_delta, int64_t duration_since_epoch) {
82170         void* amt_msat_ptr = untag_ptr(amt_msat);
82171         CHECK_ACCESS(amt_msat_ptr);
82172         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
82173         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
82174         void* payment_hash_ptr = untag_ptr(payment_hash);
82175         CHECK_ACCESS(payment_hash_ptr);
82176         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
82177         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
82178         LDKSha256 description_hash_conv;
82179         description_hash_conv.inner = untag_ptr(description_hash);
82180         description_hash_conv.is_owned = ptr_is_owned(description_hash);
82181         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
82182         description_hash_conv = Sha256_clone(&description_hash_conv);
82183         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
82184         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
82185         if (phantom_route_hints_constr.datalen > 0)
82186                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
82187         else
82188                 phantom_route_hints_constr.data = NULL;
82189         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
82190         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
82191                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
82192                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
82193                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
82194                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
82195                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
82196                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
82197                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
82198         }
82199         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
82200         void* entropy_source_ptr = untag_ptr(entropy_source);
82201         CHECK_ACCESS(entropy_source_ptr);
82202         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
82203         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
82204                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82205                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
82206         }
82207         void* node_signer_ptr = untag_ptr(node_signer);
82208         CHECK_ACCESS(node_signer_ptr);
82209         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
82210         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
82211                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82212                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
82213         }
82214         void* logger_ptr = untag_ptr(logger);
82215         CHECK_ACCESS(logger_ptr);
82216         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82217         if (logger_conv.free == LDKLogger_JCalls_free) {
82218                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82219                 LDKLogger_JCalls_cloned(&logger_conv);
82220         }
82221         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
82222         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
82223         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
82224         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
82225         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
82226         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
82227         *ret_conv = create_phantom_invoice_with_description_hash(amt_msat_conv, payment_hash_conv, invoice_expiry_delta_secs, description_hash_conv, phantom_route_hints_constr, entropy_source_conv, node_signer_conv, logger_conv, network_conv, min_final_cltv_expiry_delta_conv, duration_since_epoch);
82228         return tag_ptr(ret_conv, true);
82229 }
82230
82231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, jstring description, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) {
82232         LDKChannelManager channelmanager_conv;
82233         channelmanager_conv.inner = untag_ptr(channelmanager);
82234         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
82235         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
82236         channelmanager_conv.is_owned = false;
82237         void* node_signer_ptr = untag_ptr(node_signer);
82238         CHECK_ACCESS(node_signer_ptr);
82239         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
82240         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
82241                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82242                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
82243         }
82244         void* logger_ptr = untag_ptr(logger);
82245         CHECK_ACCESS(logger_ptr);
82246         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82247         if (logger_conv.free == LDKLogger_JCalls_free) {
82248                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82249                 LDKLogger_JCalls_cloned(&logger_conv);
82250         }
82251         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
82252         void* amt_msat_ptr = untag_ptr(amt_msat);
82253         CHECK_ACCESS(amt_msat_ptr);
82254         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
82255         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
82256         LDKStr description_conv = java_to_owned_str(env, description);
82257         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
82258         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
82259         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
82260         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
82261         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
82262         *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
82263         return tag_ptr(ret_conv, true);
82264 }
82265
82266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, int64_t description_hash, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) {
82267         LDKChannelManager channelmanager_conv;
82268         channelmanager_conv.inner = untag_ptr(channelmanager);
82269         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
82270         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
82271         channelmanager_conv.is_owned = false;
82272         void* node_signer_ptr = untag_ptr(node_signer);
82273         CHECK_ACCESS(node_signer_ptr);
82274         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
82275         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
82276                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82277                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
82278         }
82279         void* logger_ptr = untag_ptr(logger);
82280         CHECK_ACCESS(logger_ptr);
82281         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82282         if (logger_conv.free == LDKLogger_JCalls_free) {
82283                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82284                 LDKLogger_JCalls_cloned(&logger_conv);
82285         }
82286         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
82287         void* amt_msat_ptr = untag_ptr(amt_msat);
82288         CHECK_ACCESS(amt_msat_ptr);
82289         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
82290         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
82291         LDKSha256 description_hash_conv;
82292         description_hash_conv.inner = untag_ptr(description_hash);
82293         description_hash_conv.is_owned = ptr_is_owned(description_hash);
82294         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
82295         description_hash_conv = Sha256_clone(&description_hash_conv);
82296         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
82297         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
82298         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
82299         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
82300         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
82301         *ret_conv = create_invoice_from_channelmanager_with_description_hash(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_hash_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
82302         return tag_ptr(ret_conv, true);
82303 }
82304
82305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash_1and_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, int64_t description_hash, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) {
82306         LDKChannelManager channelmanager_conv;
82307         channelmanager_conv.inner = untag_ptr(channelmanager);
82308         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
82309         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
82310         channelmanager_conv.is_owned = false;
82311         void* node_signer_ptr = untag_ptr(node_signer);
82312         CHECK_ACCESS(node_signer_ptr);
82313         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
82314         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
82315                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82316                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
82317         }
82318         void* logger_ptr = untag_ptr(logger);
82319         CHECK_ACCESS(logger_ptr);
82320         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82321         if (logger_conv.free == LDKLogger_JCalls_free) {
82322                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82323                 LDKLogger_JCalls_cloned(&logger_conv);
82324         }
82325         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
82326         void* amt_msat_ptr = untag_ptr(amt_msat);
82327         CHECK_ACCESS(amt_msat_ptr);
82328         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
82329         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
82330         LDKSha256 description_hash_conv;
82331         description_hash_conv.inner = untag_ptr(description_hash);
82332         description_hash_conv.is_owned = ptr_is_owned(description_hash);
82333         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
82334         description_hash_conv = Sha256_clone(&description_hash_conv);
82335         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
82336         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
82337         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
82338         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
82339         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
82340         *ret_conv = create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_hash_conv, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
82341         return tag_ptr(ret_conv, true);
82342 }
82343
82344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1and_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, jstring description, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) {
82345         LDKChannelManager channelmanager_conv;
82346         channelmanager_conv.inner = untag_ptr(channelmanager);
82347         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
82348         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
82349         channelmanager_conv.is_owned = false;
82350         void* node_signer_ptr = untag_ptr(node_signer);
82351         CHECK_ACCESS(node_signer_ptr);
82352         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
82353         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
82354                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82355                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
82356         }
82357         void* logger_ptr = untag_ptr(logger);
82358         CHECK_ACCESS(logger_ptr);
82359         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82360         if (logger_conv.free == LDKLogger_JCalls_free) {
82361                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82362                 LDKLogger_JCalls_cloned(&logger_conv);
82363         }
82364         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
82365         void* amt_msat_ptr = untag_ptr(amt_msat);
82366         CHECK_ACCESS(amt_msat_ptr);
82367         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
82368         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
82369         LDKStr description_conv = java_to_owned_str(env, description);
82370         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
82371         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
82372         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
82373         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
82374         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
82375         *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
82376         return tag_ptr(ret_conv, true);
82377 }
82378
82379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1and_1duration_1since_1epoch_1with_1payment_1hash(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, jstring description, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs, int8_tArray payment_hash, int64_t min_final_cltv_expiry_delta) {
82380         LDKChannelManager channelmanager_conv;
82381         channelmanager_conv.inner = untag_ptr(channelmanager);
82382         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
82383         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
82384         channelmanager_conv.is_owned = false;
82385         void* node_signer_ptr = untag_ptr(node_signer);
82386         CHECK_ACCESS(node_signer_ptr);
82387         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
82388         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
82389                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82390                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
82391         }
82392         void* logger_ptr = untag_ptr(logger);
82393         CHECK_ACCESS(logger_ptr);
82394         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82395         if (logger_conv.free == LDKLogger_JCalls_free) {
82396                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82397                 LDKLogger_JCalls_cloned(&logger_conv);
82398         }
82399         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
82400         void* amt_msat_ptr = untag_ptr(amt_msat);
82401         CHECK_ACCESS(amt_msat_ptr);
82402         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
82403         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
82404         LDKStr description_conv = java_to_owned_str(env, description);
82405         LDKThirtyTwoBytes payment_hash_ref;
82406         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
82407         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
82408         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
82409         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
82410         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
82411         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
82412         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
82413         *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs, payment_hash_ref, min_final_cltv_expiry_delta_conv);
82414         return tag_ptr(ret_conv, true);
82415 }
82416
82417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
82418         LDKStr s_conv = java_to_owned_str(env, s);
82419         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
82420         *ret_conv = SiPrefix_from_str(s_conv);
82421         return tag_ptr(ret_conv, true);
82422 }
82423
82424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
82425         LDKStr s_conv = java_to_owned_str(env, s);
82426         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
82427         *ret_conv = Bolt11Invoice_from_str(s_conv);
82428         return tag_ptr(ret_conv, true);
82429 }
82430
82431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
82432         LDKStr s_conv = java_to_owned_str(env, s);
82433         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
82434         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
82435         return tag_ptr(ret_conv, true);
82436 }
82437
82438 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
82439         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
82440         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
82441         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
82442         Str_free(ret_str);
82443         return ret_conv;
82444 }
82445
82446 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
82447         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
82448         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
82449         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
82450         Str_free(ret_str);
82451         return ret_conv;
82452 }
82453
82454 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
82455         LDKBolt11Invoice o_conv;
82456         o_conv.inner = untag_ptr(o);
82457         o_conv.is_owned = ptr_is_owned(o);
82458         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82459         o_conv.is_owned = false;
82460         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
82461         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
82462         Str_free(ret_str);
82463         return ret_conv;
82464 }
82465
82466 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
82467         LDKSignedRawBolt11Invoice o_conv;
82468         o_conv.inner = untag_ptr(o);
82469         o_conv.is_owned = ptr_is_owned(o);
82470         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82471         o_conv.is_owned = false;
82472         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
82473         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
82474         Str_free(ret_str);
82475         return ret_conv;
82476 }
82477
82478 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
82479         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
82480         LDKStr ret_str = Currency_to_str(o_conv);
82481         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
82482         Str_free(ret_str);
82483         return ret_conv;
82484 }
82485
82486 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
82487         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
82488         LDKStr ret_str = SiPrefix_to_str(o_conv);
82489         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
82490         Str_free(ret_str);
82491         return ret_conv;
82492 }
82493
82494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82495         if (!ptr_is_owned(this_ptr)) return;
82496         void* this_ptr_ptr = untag_ptr(this_ptr);
82497         CHECK_ACCESS(this_ptr_ptr);
82498         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
82499         FREE(untag_ptr(this_ptr));
82500         GraphSyncError_free(this_ptr_conv);
82501 }
82502
82503 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
82504         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
82505         *ret_copy = GraphSyncError_clone(arg);
82506         int64_t ret_ref = tag_ptr(ret_copy, true);
82507         return ret_ref;
82508 }
82509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
82510         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
82511         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
82512         return ret_conv;
82513 }
82514
82515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82516         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
82517         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
82518         *ret_copy = GraphSyncError_clone(orig_conv);
82519         int64_t ret_ref = tag_ptr(ret_copy, true);
82520         return ret_ref;
82521 }
82522
82523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1decode_1error(JNIEnv *env, jclass clz, int64_t a) {
82524         void* a_ptr = untag_ptr(a);
82525         CHECK_ACCESS(a_ptr);
82526         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
82527         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
82528         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
82529         *ret_copy = GraphSyncError_decode_error(a_conv);
82530         int64_t ret_ref = tag_ptr(ret_copy, true);
82531         return ret_ref;
82532 }
82533
82534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1lightning_1error(JNIEnv *env, jclass clz, int64_t a) {
82535         LDKLightningError a_conv;
82536         a_conv.inner = untag_ptr(a);
82537         a_conv.is_owned = ptr_is_owned(a);
82538         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82539         a_conv = LightningError_clone(&a_conv);
82540         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
82541         *ret_copy = GraphSyncError_lightning_error(a_conv);
82542         int64_t ret_ref = tag_ptr(ret_copy, true);
82543         return ret_ref;
82544 }
82545
82546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
82547         LDKRapidGossipSync this_obj_conv;
82548         this_obj_conv.inner = untag_ptr(this_obj);
82549         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82551         RapidGossipSync_free(this_obj_conv);
82552 }
82553
82554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger) {
82555         LDKNetworkGraph network_graph_conv;
82556         network_graph_conv.inner = untag_ptr(network_graph);
82557         network_graph_conv.is_owned = ptr_is_owned(network_graph);
82558         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
82559         network_graph_conv.is_owned = false;
82560         void* logger_ptr = untag_ptr(logger);
82561         CHECK_ACCESS(logger_ptr);
82562         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82563         if (logger_conv.free == LDKLogger_JCalls_free) {
82564                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82565                 LDKLogger_JCalls_cloned(&logger_conv);
82566         }
82567         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
82568         int64_t ret_ref = 0;
82569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82571         return ret_ref;
82572 }
82573
82574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1sync_1network_1graph_1with_1file_1path(JNIEnv *env, jclass clz, int64_t this_arg, jstring sync_path) {
82575         LDKRapidGossipSync this_arg_conv;
82576         this_arg_conv.inner = untag_ptr(this_arg);
82577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82579         this_arg_conv.is_owned = false;
82580         LDKStr sync_path_conv = java_to_owned_str(env, sync_path);
82581         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
82582         *ret_conv = RapidGossipSync_sync_network_graph_with_file_path(&this_arg_conv, sync_path_conv);
82583         return tag_ptr(ret_conv, true);
82584 }
82585
82586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1update_1network_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray update_data) {
82587         LDKRapidGossipSync this_arg_conv;
82588         this_arg_conv.inner = untag_ptr(this_arg);
82589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82591         this_arg_conv.is_owned = false;
82592         LDKu8slice update_data_ref;
82593         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
82594         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
82595         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
82596         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
82597         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
82598         return tag_ptr(ret_conv, true);
82599 }
82600
82601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1update_1network_1graph_1no_1std(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray update_data, int64_t current_time_unix) {
82602         LDKRapidGossipSync this_arg_conv;
82603         this_arg_conv.inner = untag_ptr(this_arg);
82604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82606         this_arg_conv.is_owned = false;
82607         LDKu8slice update_data_ref;
82608         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
82609         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
82610         void* current_time_unix_ptr = untag_ptr(current_time_unix);
82611         CHECK_ACCESS(current_time_unix_ptr);
82612         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
82613         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
82614         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
82615         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
82616         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
82617         return tag_ptr(ret_conv, true);
82618 }
82619
82620 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1is_1initial_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_arg) {
82621         LDKRapidGossipSync this_arg_conv;
82622         this_arg_conv.inner = untag_ptr(this_arg);
82623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82625         this_arg_conv.is_owned = false;
82626         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
82627         return ret_conv;
82628 }
82629